Mesa (master): mesa: add EXT_dsa indexed generic queries

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 31 02:05:40 UTC 2019


Module: Mesa
Branch: master
Commit: a0ac0e26539eaa4501da2691edab3c183a9634ec
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0ac0e26539eaa4501da2691edab3c183a9634ec

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Thu May  2 15:01:05 2019 +0200

mesa: add EXT_dsa indexed generic queries

Only GetPointerIndexedvEXT needs an implementation, the other functions are
aliases of existing functions.

---

 src/mapi/glapi/gen/EXT_direct_state_access.xml | 24 ++++++++++++++++++++++++
 src/mapi/glapi/gen/static_data.py              |  2 +-
 src/mesa/main/get.c                            | 12 ++++++++++--
 src/mesa/main/get.h                            |  3 +++
 src/mesa/main/getstring.c                      | 26 ++++++++++++++++++++++++++
 src/mesa/main/tests/dispatch_sanity.cpp        |  3 +--
 6 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index be1ddbafe59..41fcf1e93b6 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -323,6 +323,24 @@
       <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">
@@ -496,5 +514,11 @@
       <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>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 4ce68fc01e8..fae79d470d9 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1516,7 +1516,7 @@ offsets = {
     "GetNamedFramebufferAttachmentParameterivEXT": 1480,
     "EnableClientStateiEXT": 1481,
     "DisableClientStateiEXT": 1482,
-
+    "GetPointerIndexedvEXT": 1483,
 }
 
 functions = [
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index f213002d9f8..b32552a9cb8 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -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:
diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h
index 34cb9381fed..898fb49cdb3 100644
--- a/src/mesa/main/get.h
+++ b/src/mesa/main/get.h
@@ -69,6 +69,9 @@ 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);
 
 extern void GLAPIENTRY
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index e2f5af29b37..bd02b9db0b0 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -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
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index cecca5e0aa9..0702c6de0a3 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -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 },




More information about the mesa-commit mailing list