summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/mapi/glapi/gen/EXT_direct_state_access.xml20
-rw-r--r--src/mapi/glapi/gen/static_data.py2
-rw-r--r--src/mesa/main/enable.c46
-rw-r--r--src/mesa/main/enable.h6
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp4
5 files changed, 76 insertions, 2 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index ddefa07de00..be1ddbafe59 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -313,6 +313,16 @@
<param name="texture" type="GLuint" />
</function>
+ <function name="EnableClientStateIndexedEXT" alias="EnableClientStateiEXT">
+ <param name="array" type="GLenum" />
+ <param name="index" type="GLuint" />
+ </function>
+
+ <function name="DisableClientStateIndexedEXT" alias="DisableClientStateiEXT">
+ <param name="array" type="GLenum" />
+ <param name="index" type="GLuint" />
+ </function>
+
<!-- OpenGL 1.3 -->
<function name="MatrixLoadTransposefEXT" offset="assign">
@@ -476,5 +486,15 @@
<param name="pname" type="GLenum" />
<param name="params" type="GLint *" />
</function>
+
+ <function name="EnableClientStateiEXT">
+ <param name="array" type="GLenum" />
+ <param name="index" type="GLuint" />
+ </function>
+
+ <function name="DisableClientStateiEXT">
+ <param name="array" type="GLenum" />
+ <param name="index" type="GLuint" />
+ </function>
</category>
</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 696ba60fa89..4ce68fc01e8 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1514,6 +1514,8 @@ offsets = {
"NamedFramebufferTexture3DEXT": 1478,
"NamedFramebufferRenderbufferEXT": 1479,
"GetNamedFramebufferAttachmentParameterivEXT": 1480,
+ "EnableClientStateiEXT": 1481,
+ "DisableClientStateiEXT": 1482,
}
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) { \
diff --git a/src/mesa/main/enable.h b/src/mesa/main/enable.h
index 10755e549d3..fa569edadd2 100644
--- a/src/mesa/main/enable.h
+++ b/src/mesa/main/enable.h
@@ -65,8 +65,14 @@ extern void GLAPIENTRY
_mesa_EnableClientState( GLenum cap );
extern void GLAPIENTRY
+_mesa_EnableClientStateiEXT( GLenum cap, GLuint index );
+
+extern void GLAPIENTRY
_mesa_DisableClientState( GLenum cap );
+extern void GLAPIENTRY
+_mesa_DisableClientStateiEXT( GLenum cap, GLuint index );
+
extern void
_mesa_set_multisample(struct gl_context *ctx, GLboolean state);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 3e0e273dd04..cecca5e0aa9 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1092,8 +1092,8 @@ const struct function common_desktop_functions_possible[] = {
//{ "glMultiTexImage3DEXT", 12, -1 },
//{ "glMultiTexSubImage3DEXT", 12, -1 },
//{ "glCopyMultiTexSubImage3DEXT", 12, -1 },
- //{ "glEnableClientStateIndexedEXT", 12, -1 },
- //{ "glDisableClientStateIndexedEXT", 12, -1 },
+ { "glEnableClientStateIndexedEXT", 12, -1 },
+ { "glDisableClientStateIndexedEXT", 12, -1 },
//{ "glGetPointerIndexedvEXT", 12, -1 },
/* GL_EXT_direct_state_access - ARB_vertex_program */
//{ "glNamedProgramStringEXT", 10, -1 },