mesa: add EXT_dsa indexed generic queries
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 2 May 2019 13:01:05 +0000 (15:01 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 31 Jul 2019 02:04:26 +0000 (22:04 -0400)
Only GetPointerIndexedvEXT needs an implementation, the other functions are
aliases of existing functions.

src/mapi/glapi/gen/EXT_direct_state_access.xml
src/mapi/glapi/gen/static_data.py
src/mesa/main/get.c
src/mesa/main/get.h
src/mesa/main/getstring.c
src/mesa/main/tests/dispatch_sanity.cpp

index be1ddbafe592be6446b5ab6546d1868e369753cf..41fcf1e93b6af61115352502d99bd6ad0a24f32f 100644 (file)
       <param name="index" type="GLuint" />
    </function>
 
+   <function name="GetFloatIndexedvEXT" alias="GetFloati_v">
+      <param name="target" type="GLenum" />
+      <param name="index" type="GLuint" />
+      <param name="params" type="GLfloat*" />
+   </function>
+
+   <function name="GetDoubleIndexedvEXT" alias="GetDoublei_v">
+      <param name="target" type="GLenum" />
+      <param name="index" type="GLuint" />
+      <param name="params" type="GLdouble*" />
+   </function>
+
+   <function name="GetPointerIndexedvEXT">
+      <param name="target" type="GLenum" />
+      <param name="index" type="GLuint" />
+      <param name="params" type="GLvoid**" />
+   </function>
+
    <!-- OpenGL 1.3 -->
 
    <function name="MatrixLoadTransposefEXT" offset="assign">
       <param name="array" type="GLenum" />
       <param name="index" type="GLuint" />
    </function>
+
+   <function name="GetPointeri_vEXT" alias="GetPointerIndexedvEXT">
+      <param name="target" type="GLenum" />
+      <param name="index" type="GLuint" />
+      <param name="params" type="GLvoid**" />
+   </function>
 </category>
 </OpenGLAPI>
index 4ce68fc01e89c047f97adaf2ae525d82afb92a0e..fae79d470d9517947205062506325c64400a0311 100644 (file)
@@ -1516,7 +1516,7 @@ offsets = {
     "GetNamedFramebufferAttachmentParameterivEXT": 1480,
     "EnableClientStateiEXT": 1481,
     "DisableClientStateiEXT": 1482,
-
+    "GetPointerIndexedvEXT": 1483,
 }
 
 functions = [
index f213002d9f878d423bdb3e6d78f7e012e8c9a5d2..b32552a9cb8cb84a8b2b33b6ae238034d4ddf06d 100644 (file)
@@ -2678,8 +2678,6 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
    case GL_TEXTURE_BINDING_RECTANGLE: {
       int target;
 
-      if (ctx->API != API_OPENGL_CORE)
-         goto invalid_enum;
       target = tex_binding_to_index(ctx, pname);
       if (target < 0)
          goto invalid_enum;
@@ -2771,6 +2769,16 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
       _mesa_ClientActiveTexture(GL_TEXTURE0 + curTexUnitSave);
       return TYPE_INT;
    }
+   case GL_TEXTURE_MATRIX:
+      if (index >= ARRAY_SIZE(ctx->TextureMatrixStack))
+         goto invalid_enum;
+      v->value_matrix = ctx->TextureMatrixStack[index].Top;
+      return TYPE_MATRIX;
+   case GL_TRANSPOSE_TEXTURE_MATRIX:
+      if (index >= ARRAY_SIZE(ctx->TextureMatrixStack))
+         goto invalid_enum;
+      v->value_matrix = ctx->TextureMatrixStack[index].Top;
+      return TYPE_MATRIX_T;
    }
 
  invalid_enum:
index 34cb9381fedc02f17af68639cf8e7c4f3ab3c1c5..898fb49cdb39366d4c23fe81ffe7cc3c0933c45e 100644 (file)
@@ -68,6 +68,9 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params );
 extern void GLAPIENTRY
 _mesa_GetPointerv( GLenum pname, GLvoid **params );
 
+extern void GLAPIENTRY
+_mesa_GetPointerIndexedvEXT( GLenum pname, GLuint index, GLvoid **params );
+
 extern void GLAPIENTRY
 _mesa_GetFloati_v(GLenum target, GLuint index, GLfloat *data);
 
index e2f5af29b373ca837ff739edd2f59d8a26cf3c73..bd02b9db0b0b0a29bead37fa6fef8f5fd2ee4caf 100644 (file)
@@ -328,6 +328,32 @@ invalid_pname:
 }
 
 
+void GLAPIENTRY
+_mesa_GetPointerIndexedvEXT( GLenum pname, GLuint index, GLvoid **params )
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (!params)
+      return;
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "%s %s\n", "glGetPointerIndexedvEXT", _mesa_enum_to_string(pname));
+
+   switch (pname) {
+      case GL_TEXTURE_COORD_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(index)].Ptr;
+         break;
+      default:
+         goto invalid_pname;
+   }
+
+   return;
+
+invalid_pname:
+   _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerIndexedvEXT");
+   return;
+}
+
 /**
  * Returns the current GL error code, or GL_NO_ERROR.
  * \return current error code
index cecca5e0aa91d1fcd3b01cf799016038a0f14423..0702c6de0a3d8403d523394d2dccacd5b80157f7 100644 (file)
@@ -1094,7 +1094,7 @@ const struct function common_desktop_functions_possible[] = {
    //{ "glCopyMultiTexSubImage3DEXT", 12, -1 },
    { "glEnableClientStateIndexedEXT", 12, -1 },
    { "glDisableClientStateIndexedEXT", 12, -1 },
-   //{ "glGetPointerIndexedvEXT", 12, -1 },
+   { "glGetPointerIndexedvEXT", 12, -1 },
    /* GL_EXT_direct_state_access - ARB_vertex_program */
    //{ "glNamedProgramStringEXT", 10, -1 },
    //{ "glNamedProgramLocalParameter4dEXT", 10, -1 },
@@ -1185,7 +1185,6 @@ const struct function common_desktop_functions_possible[] = {
    /* GL_EXT_direct_state_access - GL 3.0 */
    //{ "glGetFloati_vEXT", 30, -1 },
    //{ "glGetDoublei_vEXT", 30, -1 },
-   //{ "glGetPointeri_vEXT", 30, -1 },
    //{ "glNamedRenderbufferStorageEXT", 30, -1 },
    //{ "glGetNamedRenderbufferParameterivEXT", 30, -1 },
    //{ "glNamedRenderbufferStorageMultisampleEXT", 30, -1 },