Throw GL_INVALID_OPERATION if mipmaps are specified for non-square textures

This commit is contained in:
Luke Benstead 2019-04-17 16:19:03 +01:00
parent f39e2c0972
commit 3395f17687
2 changed files with 12 additions and 0 deletions

View File

@ -206,6 +206,13 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) {
TextureObject* tex = _glGetBoundTexture();
if(tex->width != tex->height) {
fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n");
_glKosThrowError(GL_INVALID_OPERATION, __func__);
_glKosPrintError();
return;
}
if(!tex || !tex->data || !tex->mipmapCount) {
_glKosThrowError(GL_INVALID_OPERATION, __func__);
_glKosPrintError();

View File

@ -852,6 +852,11 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
_glKosThrowError(GL_INVALID_VALUE, "glTexImage2D");
}
if(level > 0 && width != height) {
fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n");
_glKosThrowError(GL_INVALID_OPERATION, __func__);
}
if(border) {
_glKosThrowError(GL_INVALID_VALUE, "glTexImage2D");
}