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
        }
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2019-04-29 17:39:49 +02:00 committed by Marek Olšák
parent 7534c536ca
commit ef84d93f3d
5 changed files with 76 additions and 2 deletions

View File

@ -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>

View File

@ -1514,6 +1514,8 @@ offsets = {
"NamedFramebufferTexture3DEXT": 1478,
"NamedFramebufferRenderbufferEXT": 1479,
"GetNamedFramebufferAttachmentParameterivEXT": 1480,
"EnableClientStateiEXT": 1481,
"DisableClientStateiEXT": 1482,
}

View File

@ -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) { \

View File

@ -64,9 +64,15 @@ _mesa_IsEnabledi( GLenum cap, GLuint index );
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);

View File

@ -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 },