summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/enable.c
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-29 17:39:49 +0200
committerMarek Olšák <[email protected]>2019-07-30 22:04:26 -0400
commitef84d93f3dabfa7e5bca82cfff05e836545a01ea (patch)
tree03d9cc02ccd383c971b84e6b142c15a8a4631222 /src/mesa/main/enable.c
parent7534c536ca0f4b2b123200f421460094034f37a3 (diff)
mesa: add EXT_dsa indexed texture commands functions
Added functions: - EnableClientStateIndexedEXT - DisableClientStateIndexedEXT - EnableClientStateiEXT - DisableClientStateiEXT Implemented using the idiom provided by the spec: if (array == TEXTURE_COORD_ARRAY) { int savedClientActiveTexture; GetIntegerv(CLIENT_ACTIVE_TEXTURE, &savedClientActiveTexture); ClientActiveTexture(TEXTURE0+index); XXX(array); ClientActiveTexture(savedActiveTexture); } else { // Invalid enum }
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r--src/mesa/main/enable.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index ffdd3d8783a..418fc75c724 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -133,6 +133,38 @@ invalid_enum_error:
}
+/* Helper for GL_EXT_direct_state_access following functions:
+ * - EnableClientStateIndexedEXT
+ * - EnableClientStateiEXT
+ * - DisableClientStateIndexedEXT
+ * - DisableClientStateiEXT
+ */
+static void
+client_state_i(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state)
+{
+ int saved_active;
+
+ if (cap != GL_TEXTURE_COORD_ARRAY) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientStateiEXT(cap=%s)",
+ state ? "Enable" : "Disable",
+ _mesa_enum_to_string(cap));
+ return;
+ }
+
+ if (index >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "gl%sClientStateiEXT(index=%d)",
+ state ? "Enable" : "Disable",
+ index);
+ return;
+ }
+
+ saved_active = ctx->Array.ActiveTexture;
+ _mesa_ClientActiveTexture(GL_TEXTURE0 + index);
+ client_state(ctx, cap, state);
+ _mesa_ClientActiveTexture(GL_TEXTURE0 + saved_active);
+}
+
+
/**
* Enable GL capability.
* \param cap state to enable/disable.
@@ -148,6 +180,14 @@ _mesa_EnableClientState( GLenum cap )
}
+void GLAPIENTRY
+_mesa_EnableClientStateiEXT( GLenum cap, GLuint index )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ client_state_i(ctx, cap, index, GL_TRUE);
+}
+
+
/**
* Disable GL capability.
* \param cap state to enable/disable.
@@ -162,6 +202,12 @@ _mesa_DisableClientState( GLenum cap )
client_state( ctx, cap, GL_FALSE );
}
+void GLAPIENTRY
+_mesa_DisableClientStateiEXT( GLenum cap, GLuint index )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ client_state_i(ctx, cap, index, GL_FALSE);
+}
#define CHECK_EXTENSION(EXTNAME) \
if (!ctx->Extensions.EXTNAME) { \