diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-04-29 17:39:49 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-07-30 22:04:26 -0400 |
commit | ef84d93f3dabfa7e5bca82cfff05e836545a01ea (patch) | |
tree | 03d9cc02ccd383c971b84e6b142c15a8a4631222 /src/mesa | |
parent | 7534c536ca0f4b2b123200f421460094034f37a3 (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')
-rw-r--r-- | src/mesa/main/enable.c | 46 | ||||
-rw-r--r-- | src/mesa/main/enable.h | 6 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 4 |
3 files changed, 54 insertions, 2 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) { \ 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 }, |