mesa: add EXT_dsa + EXT_gpu_program_parameters functions
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 9 Sep 2019 15:26:30 +0000 (17:26 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 18 Oct 2019 08:26:26 +0000 (10:26 +0200)
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/arbprogram.c
src/mesa/main/arbprogram.h
src/mesa/main/tests/dispatch_sanity.cpp

index 4e1bd241ee065b4ea1140cbbf822c95351eea69a..bf900eb930696033a0da08b57edd8d4fd54f2170 100644 (file)
       ProgramUniform*EXT functions are added in EXT_separate_shader_objects.xml
    -->
 
+   <!-- EXT_gpu_program_parameters -->
+
+   <function name="NamedProgramLocalParameters4fvEXT">
+      <param name="program" type="GLuint" />
+      <param name="target" type="GLenum" />
+      <param name="index" type="GLuint" />
+      <param name="count" type="GLsizei" />
+      <param name="params" type="const GLfloat*" />
+   </function>
+
 </category>
 </OpenGLAPI>
index 938acbc0191ddde406fd1fedda3a57b023a6785a..f4ad5da6f3eafb07c4dd792a7b8fa50bc5e9a1f1 100644 (file)
@@ -1592,6 +1592,7 @@ offsets = {
     "MultiTexParameterIuivEXT": 1556,
     "GetMultiTexParameterIivEXT": 1557,
     "GetMultiTexParameterIuivEXT": 1558,
+    "NamedProgramLocalParameters4fvEXT": 1559,
 }
 
 functions = [
index 062052b50619b8f6ca5e333d0a8be37855b2a8dd..ac7aa49213ebdb994e3fba8e68a78f5c4231131e 100644 (file)
@@ -680,32 +680,28 @@ _mesa_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint ind
 }
 
 
-void GLAPIENTRY
-_mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
-                                  const GLfloat *params)
+static void
+program_local_parameters4fv(struct gl_program* prog, GLuint index, GLsizei count,
+                            const GLfloat *params, const char* caller)
 {
    GET_CURRENT_CONTEXT(ctx);
    GLfloat *dest;
-   struct gl_program* prog = get_current_program(ctx, target, "glProgramLocalParameters4fv");
-   if (!prog) {
-      return;
-   }
-
-   flush_vertices_for_program_constants(ctx, target);
+   flush_vertices_for_program_constants(ctx, prog->Target);
 
    if (count <= 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)");
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", caller);
    }
 
-   if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
-                               prog, target, index, &dest)) {
-      GLuint maxParams = target == GL_FRAGMENT_PROGRAM_ARB ?
+   if (get_local_param_pointer(ctx, caller,
+                               prog, prog->Target, index, &dest)) {
+      GLuint maxParams = prog->Target == GL_FRAGMENT_PROGRAM_ARB ?
          ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams :
          ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
 
       if ((index + count) > maxParams) {
          _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glProgramLocalParameters4fvEXT(index + count)");
+                     "%s(index + count)",
+                     caller);
          return;
       }
 
@@ -714,6 +710,37 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
 }
 
 
+void GLAPIENTRY
+_mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
+                                  const GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_program* prog = get_current_program(ctx, target,
+                                                 "glProgramLocalParameters4fv");
+   if (!prog) {
+      return;
+   }
+
+   program_local_parameters4fv(prog, index, count, params,
+                               "glProgramLocalParameters4fv");
+}
+
+void GLAPIENTRY
+_mesa_NamedProgramLocalParameters4fvEXT(GLuint program, GLenum target, GLuint index,
+                                        GLsizei count, const GLfloat *params)
+{
+   struct gl_program* prog =
+      lookup_or_create_program(program, target,
+                               "glNamedProgramLocalParameters4fvEXT");
+   if (!prog) {
+      return;
+   }
+
+   program_local_parameters4fv(prog, index, count, params,
+                               "glNamedProgramLocalParameters4fvEXT");
+}
+
+
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
                                  GLdouble x, GLdouble y,
index 0a86e9d5e183d1a4a36bf477850b1e7debc269d1..d7fa15ba5709456f8c07d360d6bd7a6aa2930912 100644 (file)
@@ -121,6 +121,9 @@ extern void GLAPIENTRY
 _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
                                   const GLfloat *params);
 
+extern void GLAPIENTRY
+_mesa_NamedProgramLocalParameters4fvEXT(GLuint program, GLenum target, GLuint index,
+                                        GLsizei count, const GLfloat *params);
 
 extern void GLAPIENTRY
 _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index,
index b87f2e298e6849c7c9de6855fdf767b2ec0e78e8..6782e7504d689968cde210018fe39b7b410f3931 100644 (file)
@@ -1151,7 +1151,7 @@ const struct function common_desktop_functions_possible[] = {
    /* GL_EXT_direct_state_access - EXT_gpu_shader4 */
    /* Added glProgramUniform*u*EXT functions are aliases */
    /* GL_EXT_direct_state_access - EXT_gpu_program_parameters */
-   //{ "glNamedProgramLocalParameters4fvEXT", 10, -1 },
+   { "glNamedProgramLocalParameters4fvEXT", 10, -1 },
    /* GL_EXT_direct_state_access - GL 3.0 */
    //{ "glGetFloati_vEXT", 30, -1 },
    //{ "glGetDoublei_vEXT", 30, -1 },