[Mesa-dev] [PATCH 01/23] glapi: add GL_ARB_program_interface_query skeleton

Tapani Pälli tapani.palli at intel.com
Fri Mar 13 01:37:47 PDT 2015


v2: update dispatch_sanity test (Jason Ekstrand)
    + small code cleanups

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/mapi/glapi/gen/ARB_program_interface_query.xml | 109 +++++++++++++++++++++
 src/mapi/glapi/gen/gl_API.xml                      |   2 +
 src/mapi/glapi/gen/gl_genexec.py                   |   1 +
 src/mesa/Makefile.sources                          |   2 +
 src/mesa/main/program_resource.c                   |  68 +++++++++++++
 src/mesa/main/program_resource.h                   |  58 +++++++++++
 src/mesa/main/tests/dispatch_sanity.cpp            |  12 +--
 7 files changed, 246 insertions(+), 6 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_program_interface_query.xml
 create mode 100644 src/mesa/main/program_resource.c
 create mode 100644 src/mesa/main/program_resource.h

diff --git a/src/mapi/glapi/gen/ARB_program_interface_query.xml b/src/mapi/glapi/gen/ARB_program_interface_query.xml
new file mode 100644
index 0000000..fb83a36
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_program_interface_query.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_program_interface_query" number="134">
+
+    <enum name="UNIFORM"                                         value="0x92E1"/>
+    <enum name="UNIFORM_BLOCK"                                   value="0x92E2"/>
+    <enum name="PROGRAM_INPUT"                                   value="0x92E3"/>
+    <enum name="PROGRAM_OUTPUT"                                  value="0x92E4"/>
+    <enum name="BUFFER_VARIABLE"                                 value="0x92E5"/>
+    <enum name="SHADER_STORAGE_BLOCK"                            value="0x92E6"/>
+    <enum name="ATOMIC_COUNTER_BUFFER"                           value="0x92C0"/>
+    <enum name="VERTEX_SUBROUTINE"                               value="0x92E8"/>
+    <enum name="TESS_CONTROL_SUBROUTINE"                         value="0x92E9"/>
+    <enum name="TESS_EVALUATION_SUBROUTINE"                      value="0x92EA"/>
+    <enum name="GEOMETRY_SUBROUTINE"                             value="0x92EB"/>
+    <enum name="FRAGMENT_SUBROUTINE"                             value="0x92EC"/>
+    <enum name="COMPUTE_SUBROUTINE"                              value="0x92ED"/>
+    <enum name="VERTEX_SUBROUTINE_UNIFORM"                       value="0x92EE"/>
+    <enum name="TESS_CONTROL_SUBROUTINE_UNIFORM"                 value="0x92EF"/>
+    <enum name="TESS_EVALUATION_SUBROUTINE_UNIFORM"              value="0x92F0"/>
+    <enum name="GEOMETRY_SUBROUTINE_UNIFORM"                     value="0x92F1"/>
+    <enum name="FRAGMENT_SUBROUTINE_UNIFORM"                     value="0x92F2"/>
+    <enum name="COMPUTE_SUBROUTINE_UNIFORM"                      value="0x92F3"/>
+    <enum name="TRANSFORM_FEEDBACK_VARYING"                      value="0x92F4"/>
+    <enum name="ACTIVE_RESOURCES"                                value="0x92F5"/>
+    <enum name="MAX_NAME_LENGTH"                                 value="0x92F6"/>
+    <enum name="MAX_NUM_ACTIVE_VARIABLES"                        value="0x92F7"/>
+    <enum name="MAX_NUM_COMPATIBLE_SUBROUTINES"                  value="0x92F8"/>
+    <enum name="NAME_LENGTH"                                     value="0x92F9"/>
+    <enum name="TYPE"                                            value="0x92FA"/>
+    <enum name="ARRAY_SIZE"                                      value="0x92FB"/>
+    <enum name="OFFSET"                                          value="0x92FC"/>
+    <enum name="BLOCK_INDEX"                                     value="0x92FD"/>
+    <enum name="ARRAY_STRIDE"                                    value="0x92FE"/>
+    <enum name="MATRIX_STRIDE"                                   value="0x92FF"/>
+    <enum name="IS_ROW_MAJOR"                                    value="0x9300"/>
+    <enum name="ATOMIC_COUNTER_BUFFER_INDEX"                     value="0x9301"/>
+    <enum name="BUFFER_BINDING"                                  value="0x9302"/>
+    <enum name="BUFFER_DATA_SIZE"                                value="0x9303"/>
+    <enum name="NUM_ACTIVE_VARIABLES"                            value="0x9304"/>
+    <enum name="ACTIVE_VARIABLES"                                value="0x9305"/>
+    <enum name="REFERENCED_BY_VERTEX_SHADER"                     value="0x9306"/>
+    <enum name="REFERENCED_BY_TESS_CONTROL_SHADER"               value="0x9307"/>
+    <enum name="REFERENCED_BY_TESS_EVALUATION_SHADER"            value="0x9308"/>
+    <enum name="REFERENCED_BY_GEOMETRY_SHADER"                   value="0x9309"/>
+    <enum name="REFERENCED_BY_FRAGMENT_SHADER"                   value="0x930A"/>
+    <enum name="REFERENCED_BY_COMPUTE_SHADER"                    value="0x930B"/>
+    <enum name="TOP_LEVEL_ARRAY_SIZE"                            value="0x930C"/>
+    <enum name="TOP_LEVEL_ARRAY_STRIDE"                          value="0x930D"/>
+    <enum name="LOCATION"                                        value="0x930E"/>
+    <enum name="LOCATION_INDEX"                                  value="0x930F"/>
+    <enum name="IS_PER_PATCH"                                    value="0x92E7"/>
+    <enum name="NUM_COMPATIBLE_SUBROUTINES"                      value="0x8E4A"/>
+    <enum name="COMPATIBLE_SUBROUTINES"                          value="0x8E4B"/>
+
+    <function name="GetProgramInterfaceiv" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="pname" type="GLenum"/>
+        <param name="params" type="GLint *"/>
+    </function>
+
+    <function name="GetProgramResourceIndex" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="name" type="const GLchar *"/>
+        <return type="GLuint"/>
+    </function>
+
+    <function name="GetProgramResourceName" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="index" type="GLuint"/>
+        <param name="bufSize" type="GLsizei "/>
+        <param name="length" type="GLsizei *" output="true"/>
+        <param name="name" type="GLchar *" output="true"/>
+    </function>
+
+    <function name="GetProgramResourceiv" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="index" type="GLuint"/>
+        <param name="propCount" type="GLsizei "/>
+        <param name="props" type="const GLenum *" output="true"/>
+        <param name="bufSize" type="GLsizei "/>
+        <param name="length" type="GLsizei *" output="true"/>
+        <param name="params" type="GLint *" output="true"/>
+    </function>
+
+    <function name="GetProgramResourceLocation" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="name" type="const GLchar *"/>
+        <return type="GLint"/>
+    </function>
+
+    <function name="GetProgramResourceLocationIndex" offset="assign">
+        <param name="program" type="GLuint"/>
+        <param name="programInterface" type="GLenum"/>
+        <param name="name" type="const GLchar *"/>
+        <return type="GLint"/>
+    </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 1ceb60a..11b0a45 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8339,6 +8339,8 @@
 
 <!-- ARB extensions #134...#138 -->
 
+<xi:include href="ARB_program_interface_query.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
 <xi:include href="ARB_texture_buffer_range.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <!-- 140. GL_ARB_texture_query_levels -->
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index d479e66..7151f0d 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -92,6 +92,7 @@ header = """/**
 #include "main/pixelstore.h"
 #include "main/points.h"
 #include "main/polygon.h"
+#include "main/program_resource.h"
 #include "main/querymatrix.h"
 #include "main/queryobj.h"
 #include "main/readpix.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 217be9a..d514aeb 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -159,6 +159,8 @@ MAIN_FILES = \
 	main/rastpos.c \
 	main/rastpos.h \
 	main/readpix.c \
+	main/program_resource.c \
+	main/program_resource.h \
 	main/readpix.h \
 	main/remap.c \
 	main/remap.h \
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
new file mode 100644
index 0000000..b3b93aa
--- /dev/null
+++ b/src/mesa/main/program_resource.c
@@ -0,0 +1,68 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2015 Intel Corporation.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "program_resource.h"
+
+void GLAPIENTRY
+_mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface,
+                            GLenum pname, GLint *params)
+{
+}
+
+GLuint GLAPIENTRY
+_mesa_GetProgramResourceIndex(GLuint program, GLenum programInterface,
+                              const GLchar *name)
+{
+   return 0;
+}
+
+void GLAPIENTRY
+_mesa_GetProgramResourceName(GLuint program, GLenum programInterface,
+                             GLuint index, GLsizei bufSize, GLsizei *length,
+                             GLchar *name)
+{
+}
+
+void GLAPIENTRY
+_mesa_GetProgramResourceiv(GLuint program, GLenum programInterface,
+                           GLuint index, GLsizei propCount,
+                           const GLenum *props, GLsizei bufSize,
+                           GLsizei *length, GLint *params)
+{
+}
+
+GLint GLAPIENTRY
+_mesa_GetProgramResourceLocation(GLuint program, GLenum programInterface,
+                                 const GLchar *name)
+{
+   return -1;
+}
+
+GLint GLAPIENTRY
+_mesa_GetProgramResourceLocationIndex(GLuint program, GLenum programInterface,
+                                      const GLchar *name)
+{
+   return -1;
+}
diff --git a/src/mesa/main/program_resource.h b/src/mesa/main/program_resource.h
new file mode 100644
index 0000000..326ae1f
--- /dev/null
+++ b/src/mesa/main/program_resource.h
@@ -0,0 +1,58 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2015 Intel Corporation.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef PROGRAM_RESOURCE_H
+#define PROGRAM_RESOURCE_H
+
+#include "glheader.h"
+
+extern void GLAPIENTRY
+_mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface,
+                            GLenum pname, GLint *params);
+
+extern GLuint GLAPIENTRY
+_mesa_GetProgramResourceIndex(GLuint program, GLenum programInterface,
+                              const GLchar *name);
+
+extern void GLAPIENTRY
+_mesa_GetProgramResourceName(GLuint program, GLenum programInterface,
+                             GLuint index, GLsizei bufSize, GLsizei *length,
+                             GLchar *name);
+
+extern void GLAPIENTRY
+_mesa_GetProgramResourceiv(GLuint program, GLenum programInterface,
+                           GLuint index, GLsizei propCount,
+                           const GLenum *props, GLsizei bufSize,
+                           GLsizei *length, GLint *params);
+
+extern GLint GLAPIENTRY
+_mesa_GetProgramResourceLocation(GLuint program, GLenum programInterface,
+                                 const GLchar *name);
+
+extern GLint GLAPIENTRY
+_mesa_GetProgramResourceLocationIndex(GLuint program, GLenum programInterface,
+                                      const GLchar *name);
+
+#endif
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 8f7f69e..06ce331 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -863,12 +863,12 @@ const struct function gl_core_functions_possible[] = {
    { "glInvalidateSubFramebuffer", 43, -1 },
    { "glMultiDrawArraysIndirect", 43, -1 },
    { "glMultiDrawElementsIndirect", 43, -1 },
-// { "glGetProgramInterfaceiv", 43, -1 },               // XXX: Add to xml
-// { "glGetProgramResourceIndex", 43, -1 },             // XXX: Add to xml
-// { "glGetProgramResourceName", 43, -1 },              // XXX: Add to xml
-// { "glGetProgramResourceiv", 43, -1 },                // XXX: Add to xml
-// { "glGetProgramResourceLocation", 43, -1 },          // XXX: Add to xml
-// { "glGetProgramResourceLocationIndex", 43, -1 },     // XXX: Add to xml
+   { "glGetProgramInterfaceiv", 43, -1 },
+   { "glGetProgramResourceIndex", 43, -1 },
+   { "glGetProgramResourceName", 43, -1 },
+   { "glGetProgramResourceiv", 43, -1 },
+   { "glGetProgramResourceLocation", 43, -1 },
+   { "glGetProgramResourceLocationIndex", 43, -1 },
 // { "glShaderStorageBlockBinding", 43, -1 },           // XXX: Add to xml
    { "glTexBufferRange", 43, -1 },
 // { "glTextureBufferRangeEXT", 43, -1 },               // XXX: Add to xml
-- 
2.1.0



More information about the mesa-dev mailing list