summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/enable.c
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-26 16:50:57 +0200
committerMarek Olšák <[email protected]>2019-07-19 20:04:07 -0400
commitb1efc9d05f0f70a0e7d3e91c2f31084bfb09581b (patch)
treeac5c90e180717c9d1c55535e7e6817367c7ca01a /src/mesa/main/enable.c
parentff0cafc8f3ae85b9bc604334082da999a0abb2a0 (diff)
mesa: add EXT_dsa glEnabledIndexedEXT
The implementation uses _mesa_ActiveTexture to change the active texture unit and then reset it. It causes an unnecessary _NEW_TEXTURE_STATE but: - adding an index argument to _mesa_set_enable causes a lot of changes (~140 callers) - enable_texture (called by _mesa_set_enable) might cause a _NEW_TEXTURE_STATE anyway. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r--src/mesa/main/enable.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index c4c3a0c27fb..ffdd3d8783a 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1246,6 +1246,28 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
ctx->Scissor.EnableFlags &= ~(1 << index);
}
break;
+ /* EXT_direct_state_access */
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_GEN_S:
+ case GL_TEXTURE_GEN_T:
+ case GL_TEXTURE_GEN_R:
+ case GL_TEXTURE_GEN_Q:
+ case GL_TEXTURE_RECTANGLE_ARB: {
+ const GLuint curTexUnitSave = ctx->Texture.CurrentUnit;
+ if (index >= MAX2(ctx->Const.MaxCombinedTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
+ state ? "glEnablei" : "glDisablei", index);
+ return;
+ }
+ _mesa_ActiveTexture(GL_TEXTURE0 + index);
+ _mesa_set_enable( ctx, cap, state );
+ _mesa_ActiveTexture(GL_TEXTURE0 + curTexUnitSave);
+ break;
+ }
default:
goto invalid_enum_error;
}
@@ -1294,6 +1316,29 @@ _mesa_IsEnabledi( GLenum cap, GLuint index )
return GL_FALSE;
}
return (ctx->Scissor.EnableFlags >> index) & 1;
+ /* EXT_direct_state_access */
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_GEN_S:
+ case GL_TEXTURE_GEN_T:
+ case GL_TEXTURE_GEN_R:
+ case GL_TEXTURE_GEN_Q:
+ case GL_TEXTURE_RECTANGLE_ARB: {
+ GLboolean state;
+ const GLuint curTexUnitSave = ctx->Texture.CurrentUnit;
+ if (index >= MAX2(ctx->Const.MaxCombinedTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
+ index);
+ return GL_FALSE;
+ }
+ _mesa_ActiveTexture(GL_TEXTURE0 + index);
+ state = _mesa_IsEnabled(cap);
+ _mesa_ActiveTexture(GL_TEXTURE0 + curTexUnitSave);
+ return state;
+ }
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)",
_mesa_enum_to_string(cap));