mesa: add EXT_dsa glEnableVertexArrayEXT / glDisableVertexArrayEXT
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 25 Oct 2019 13:20:31 +0000 (15:20 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 5 Nov 2019 12:58:28 +0000 (13:58 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mapi/glapi/gen/EXT_direct_state_access.xml
src/mapi/glapi/gen/static_data.py
src/mesa/main/enable.c
src/mesa/main/enable.h
src/mesa/main/tests/dispatch_sanity.cpp

index 19f9048f84a41c5841fcb8f40ef46f7d92e4878c..145d3b92c8e2b0cb8312e7900d9590a47f7c5c0a 100644 (file)
       <param name="offset" type="GLintptr" />
    </function>
 
       <param name="offset" type="GLintptr" />
    </function>
 
+   <function name="EnableVertexArrayEXT">
+      <param name="vaobj" type="GLuint" />
+      <param name="array" type="GLenum" />
+   </function>
+
+   <function name="DisableVertexArrayEXT">
+      <param name="vaobj" type="GLuint" />
+      <param name="array" type="GLenum" />
+   </function>
+
    <!-- ARB_vertex_program -->
    <function name="NamedProgramStringEXT">
       <param name="program" type="GLuint" />
    <!-- ARB_vertex_program -->
    <function name="NamedProgramStringEXT">
       <param name="program" type="GLuint" />
index 43011be402d26733225bbfaabc56f2f9e8cbe0fb..28ef42c12aa8450c03999aa41e37b8ab4ae3e75f 100644 (file)
@@ -1608,6 +1608,8 @@ offsets = {
     "VertexArraySecondaryColorOffsetEXT": 1572,
     "VertexArrayVertexAttribOffsetEXT": 1573,
     "VertexArrayVertexAttribIOffsetEXT": 1574,
     "VertexArraySecondaryColorOffsetEXT": 1572,
     "VertexArrayVertexAttribOffsetEXT": 1573,
     "VertexArrayVertexAttribIOffsetEXT": 1574,
+    "EnableVertexArrayEXT": 1575,
+    "DisableVertexArrayEXT": 1576,
 }
 
 functions = [
 }
 
 functions = [
index f72a3be0591cdff8e92f537c8aaf7db871da25ac..e398a67fcb34c12689b8a1831aa4eca6df42f84d 100644 (file)
@@ -183,6 +183,37 @@ _mesa_EnableClientState( GLenum cap )
 }
 
 
 }
 
 
+void GLAPIENTRY
+_mesa_EnableVertexArrayEXT( GLuint vaobj, GLenum cap )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_vertex_array_object* vao = _mesa_lookup_vao_err(ctx, vaobj,
+                                                             true,
+                                                             "glEnableVertexArrayEXT");
+   if (!vao)
+      return;
+
+   /* The EXT_direct_state_access spec says:
+    *    "Additionally EnableVertexArrayEXT and DisableVertexArrayEXT accept
+    *    the tokens TEXTURE0 through TEXTUREn where n is less than the
+    *    implementation-dependent limit of MAX_TEXTURE_COORDS.  For these
+    *    GL_TEXTUREi tokens, EnableVertexArrayEXT and DisableVertexArrayEXT
+    *    act identically to EnableVertexArrayEXT(vaobj, TEXTURE_COORD_ARRAY)
+    *    or DisableVertexArrayEXT(vaobj, TEXTURE_COORD_ARRAY) respectively
+    *    as if the active client texture is set to texture coordinate set i
+    *    based on the token TEXTUREi indicated by array."
+    */
+   if (GL_TEXTURE0 <= cap && cap < GL_TEXTURE0 + ctx->Const.MaxTextureCoordUnits) {
+      GLuint saved_active = ctx->Array.ActiveTexture;
+      _mesa_ClientActiveTexture(cap);
+      client_state(ctx, vao, GL_TEXTURE_COORD_ARRAY, GL_TRUE);
+      _mesa_ClientActiveTexture(GL_TEXTURE0 + saved_active);
+   } else {
+      client_state(ctx, vao, cap, GL_TRUE);
+   }
+}
+
+
 void GLAPIENTRY
 _mesa_EnableClientStateiEXT( GLenum cap, GLuint index )
 {
 void GLAPIENTRY
 _mesa_EnableClientStateiEXT( GLenum cap, GLuint index )
 {
@@ -205,6 +236,36 @@ _mesa_DisableClientState( GLenum cap )
    client_state( ctx, ctx->Array.VAO, cap, GL_FALSE );
 }
 
    client_state( ctx, ctx->Array.VAO, cap, GL_FALSE );
 }
 
+void GLAPIENTRY
+_mesa_DisableVertexArrayEXT( GLuint vaobj, GLenum cap )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_vertex_array_object* vao = _mesa_lookup_vao_err(ctx, vaobj,
+                                                             true,
+                                                             "glDisableVertexArrayEXT");
+   if (!vao)
+      return;
+
+   /* The EXT_direct_state_access spec says:
+    *    "Additionally EnableVertexArrayEXT and DisableVertexArrayEXT accept
+    *    the tokens TEXTURE0 through TEXTUREn where n is less than the
+    *    implementation-dependent limit of MAX_TEXTURE_COORDS.  For these
+    *    GL_TEXTUREi tokens, EnableVertexArrayEXT and DisableVertexArrayEXT
+    *    act identically to EnableVertexArrayEXT(vaobj, TEXTURE_COORD_ARRAY)
+    *    or DisableVertexArrayEXT(vaobj, TEXTURE_COORD_ARRAY) respectively
+    *    as if the active client texture is set to texture coordinate set i
+    *    based on the token TEXTUREi indicated by array."
+    */
+   if (GL_TEXTURE0 <= cap && cap < GL_TEXTURE0 + ctx->Const.MaxTextureCoordUnits) {
+      GLuint saved_active = ctx->Array.ActiveTexture;
+      _mesa_ClientActiveTexture(cap);
+      client_state(ctx, vao, GL_TEXTURE_COORD_ARRAY, GL_FALSE);
+      _mesa_ClientActiveTexture(GL_TEXTURE0 + saved_active);
+   } else {
+      client_state(ctx, vao, cap, GL_FALSE);
+   }
+}
+
 void GLAPIENTRY
 _mesa_DisableClientStateiEXT( GLenum cap, GLuint index )
 {
 void GLAPIENTRY
 _mesa_DisableClientStateiEXT( GLenum cap, GLuint index )
 {
index fa569edadd28a21de1fccb1c18fbe8856c04cc89..1cd8f675d330b9d229c3876104f6535e18e9644a 100644 (file)
@@ -67,12 +67,18 @@ _mesa_EnableClientState( GLenum cap );
 extern void GLAPIENTRY
 _mesa_EnableClientStateiEXT( GLenum cap, GLuint index );
 
 extern void GLAPIENTRY
 _mesa_EnableClientStateiEXT( GLenum cap, GLuint index );
 
+extern void GLAPIENTRY
+_mesa_EnableVertexArrayEXT( GLuint vaobj, GLenum cap );
+
 extern void GLAPIENTRY
 _mesa_DisableClientState( GLenum cap );
 
 extern void GLAPIENTRY
 _mesa_DisableClientStateiEXT( GLenum cap, GLuint index );
 
 extern void GLAPIENTRY
 _mesa_DisableClientState( GLenum cap );
 
 extern void GLAPIENTRY
 _mesa_DisableClientStateiEXT( GLenum cap, GLuint index );
 
+extern void GLAPIENTRY
+_mesa_DisableVertexArrayEXT( GLuint vaobj, GLenum cap );
+
 extern void
 _mesa_set_multisample(struct gl_context *ctx, GLboolean state);
 
 extern void
 _mesa_set_multisample(struct gl_context *ctx, GLboolean state);
 
index 78a50532c5ce6df05d0c5293c0271567e5f6925b..c58c294356302a9f79c20450911894cb3457ccd8 100644 (file)
@@ -1180,8 +1180,8 @@ const struct function common_desktop_functions_possible[] = {
    { "glVertexArraySecondaryColorOffsetEXT", 30, -1 },
    { "glVertexArrayVertexAttribOffsetEXT", 30, -1 },
    { "glVertexArrayVertexAttribIOffsetEXT", 30, -1 },
    { "glVertexArraySecondaryColorOffsetEXT", 30, -1 },
    { "glVertexArrayVertexAttribOffsetEXT", 30, -1 },
    { "glVertexArrayVertexAttribIOffsetEXT", 30, -1 },
-   //{ "glEnableVertexArrayEXT", 30, -1 },
-   //{ "glDisableVertexArrayEXT", 30, -1 },
+   { "glEnableVertexArrayEXT", 30, -1 },
+   { "glDisableVertexArrayEXT", 30, -1 },
    //{ "glEnableVertexArrayAttribEXT", 30, -1 },
    //{ "glDisableVertexArrayAttribEXT", 30, -1 },
    //{ "glGetVertexArrayIntegervEXT", 30, -1 },
    //{ "glEnableVertexArrayAttribEXT", 30, -1 },
    //{ "glDisableVertexArrayAttribEXT", 30, -1 },
    //{ "glGetVertexArrayIntegervEXT", 30, -1 },