Don't apply the color table unless a texture is bound

This commit is contained in:
Luke Benstead 2019-03-03 18:54:25 +00:00
parent 3c3018450f
commit ef06af793a
2 changed files with 16 additions and 5 deletions

View File

@ -221,9 +221,6 @@ void _glUpdatePVRTextureContext(pvr_poly_cxt_t* context, GLshort textureUnit) {
} else {
context->txr.enable = PVR_TEXTURE_DISABLE;
}
/* Apply the texture palette if necessary */
_glApplyColorTable();
}
static GLboolean LIGHTING_ENABLED = GL_FALSE;
@ -301,8 +298,12 @@ GLAPI void APIENTRY glEnable(GLenum cap) {
case GL_COLOR_MATERIAL:
COLOR_MATERIAL_ENABLED = GL_TRUE;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
case GL_SHARED_TEXTURE_PALETTE_EXT: {
SHARED_PALETTE_ENABLED = GL_TRUE;
/* Apply the texture palette if necessary */
_glApplyColorTable();
}
break;
case GL_LIGHT0:
case GL_LIGHT1:
@ -351,8 +352,12 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
case GL_COLOR_MATERIAL:
COLOR_MATERIAL_ENABLED = GL_FALSE;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
case GL_SHARED_TEXTURE_PALETTE_EXT: {
SHARED_PALETTE_ENABLED = GL_FALSE;
/* Restore whatever palette may exist on a bound texture */
_glApplyColorTable();
}
break;
case GL_LIGHT0:
case GL_LIGHT1:

View File

@ -255,6 +255,9 @@ void APIENTRY glBindTexture(GLenum target, GLuint texture) {
}
TEXTURE_UNITS[ACTIVE_TEXTURE] = (TextureObject*) named_array_get(&TEXTURE_OBJECTS, texture);
/* Apply the texture palette if necessary */
_glApplyColorTable();
} else {
TEXTURE_UNITS[ACTIVE_TEXTURE] = NULL;
}
@ -1028,6 +1031,9 @@ GLAPI void APIENTRY glColorTableEXT(GLenum target, GLenum internalFormat, GLsize
src += sourceStride;
dst += 4;
}
/* Apply the texture palette if necessary */
_glApplyColorTable();
}
GLAPI void APIENTRY glColorSubTableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) {