[Mesa-dev] [PATCH 3/7] mesa: add KHR_no_error support for glActiveShaderProgram()

Timothy Arceri tarceri at itsqueeze.com
Thu May 4 01:19:50 UTC 2017


---
 src/mapi/glapi/gen/ARB_separate_shader_objects.xml |  2 +-
 src/mesa/main/pipelineobj.c                        | 18 ++++++++++++++++++
 src/mesa/main/pipelineobj.h                        |  2 ++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
index 9b17a4e..c3385e9 100644
--- a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
+++ b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
@@ -13,21 +13,21 @@
       <enum   name="TESS_CONTROL_SHADER_BIT"                      value="0x00000008"/>
       <enum   name="TESS_EVALUATION_SHADER_BIT"                   value="0x00000010"/>
       <enum   name="ALL_SHADER_BITS"                              value="0xFFFFFFFF"/>
       <enum   name="PROGRAM_SEPARABLE"                            value="0x8258"/>
 
       <function name="UseProgramStages" es2="3.1" no_error="true">
          <param name="pipeline" type="GLuint" />
          <param name="stages" type="GLbitfield" />
          <param name="program" type="GLuint" />
       </function>
-      <function name="ActiveShaderProgram" es2="3.1">
+      <function name="ActiveShaderProgram" es2="3.1" no_error="true">
          <param name="pipeline" type="GLuint" />
          <param name="program" type="GLuint" />
       </function>
       <function name="CreateShaderProgramv" es2="3.1">
          <param name="type" type="GLenum" />
          <param name="count" type="GLsizei" />
          <param name="strings" type="const GLchar * const *" />
          <return type="GLuint"/>
       </function>
       <function name="BindProgramPipeline" es2="3.1">
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index b6a4332..993fc0a 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -366,20 +366,38 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glUseProgramStages(program wasn't linked with the "
                      "PROGRAM_SEPARABLE flag)");
          return;
       }
    }
 
    use_program_stages(ctx, shProg, stages, pipe);
 }
 
+void GLAPIENTRY
+_mesa_ActiveShaderProgram_no_error(GLuint pipeline, GLuint program)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_shader_program *shProg = NULL;
+   struct gl_pipeline_object *pipe = _mesa_lookup_pipeline_object(ctx, pipeline);
+
+   if (program)
+      shProg = _mesa_lookup_shader_program(ctx, program);
+
+   /* Object is created by any Pipeline call but glGenProgramPipelines,
+    * glIsProgramPipeline and GetProgramPipelineInfoLog
+    */
+   pipe->EverBound = GL_TRUE;
+
+   _mesa_reference_shader_program(ctx, &pipe->ActiveProgram, shProg);
+}
+
 /**
  * Use the named shader program for subsequent glUniform calls (if pipeline
  * bound)
  */
 void GLAPIENTRY
 _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_shader_program *shProg = NULL;
    struct gl_pipeline_object *pipe = _mesa_lookup_pipeline_object(ctx, pipeline);
diff --git a/src/mesa/main/pipelineobj.h b/src/mesa/main/pipelineobj.h
index 048a4c7..54aa409 100644
--- a/src/mesa/main/pipelineobj.h
+++ b/src/mesa/main/pipelineobj.h
@@ -70,20 +70,22 @@ extern GLboolean
 _mesa_validate_program_pipeline(struct gl_context * ctx,
                                 struct gl_pipeline_object *pipe);
 
 
 void GLAPIENTRY
 _mesa_UseProgramStages_no_error(GLuint pipeline, GLbitfield stages,
                                 GLuint prog);
 extern void GLAPIENTRY
 _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
 
+void GLAPIENTRY
+_mesa_ActiveShaderProgram_no_error(GLuint pipeline, GLuint program);
 extern void GLAPIENTRY
 _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program);
 
 extern void GLAPIENTRY
 _mesa_BindProgramPipeline(GLuint pipeline);
 
 extern void GLAPIENTRY
 _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
 
 extern void GLAPIENTRY
-- 
2.9.3



More information about the mesa-dev mailing list