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

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


---
 src/mapi/glapi/gen/ARB_separate_shader_objects.xml |  2 +-
 src/mesa/main/pipelineobj.c                        | 26 ++++++++++++++++++++++
 src/mesa/main/pipelineobj.h                        |  2 ++
 3 files changed, 29 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 c3385e9..54c1be3 100644
--- a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
+++ b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
@@ -23,21 +23,21 @@
       <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">
+      <function name="BindProgramPipeline" es2="3.1" no_error="true">
          <param name="pipeline" type="GLuint" />
       </function>
       <function name="DeleteProgramPipelines" es2="3.1">
          <param name="n" type="GLsizei" />
          <param name="pipelines" type="const GLuint *" />
       </function>
       <function name="GenProgramPipelines" es2="3.1">
          <param name="n" type="GLsizei" />
          <param name="pipelines" type="GLuint *" />
       </function>
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 993fc0a..f7c911f 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -424,20 +424,46 @@ _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program)
 
    if ((shProg != NULL) && !shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
             "glActiveShaderProgram(program %u not linked)", shProg->Name);
       return;
    }
 
    _mesa_reference_shader_program(ctx, &pipe->ActiveProgram, shProg);
 }
 
+void GLAPIENTRY
+_mesa_BindProgramPipeline_no_error(GLuint pipeline)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_pipeline_object *newObj = NULL;
+
+   /* Rebinding the same pipeline object: no change.
+    */
+   if (ctx->_Shader->Name == pipeline)
+      return;
+
+   /* Get pointer to new pipeline object (newObj)
+    */
+   if (pipeline) {
+      /* non-default pipeline object */
+      newObj = _mesa_lookup_pipeline_object(ctx, pipeline);
+
+      /* Object is created by any Pipeline call but glGenProgramPipelines,
+       * glIsProgramPipeline and GetProgramPipelineInfoLog
+       */
+      newObj->EverBound = GL_TRUE;
+   }
+
+   _mesa_bind_pipeline(ctx, newObj);
+}
+
 /**
  * Make program of the pipeline current
  */
 void GLAPIENTRY
 _mesa_BindProgramPipeline(GLuint pipeline)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_pipeline_object *newObj = NULL;
 
    if (MESA_VERBOSE & VERBOSE_API)
diff --git a/src/mesa/main/pipelineobj.h b/src/mesa/main/pipelineobj.h
index 54aa409..1bf6b71 100644
--- a/src/mesa/main/pipelineobj.h
+++ b/src/mesa/main/pipelineobj.h
@@ -75,20 +75,22 @@ 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);
 
+void GLAPIENTRY
+_mesa_BindProgramPipeline_no_error(GLuint pipeline);
 extern void GLAPIENTRY
 _mesa_BindProgramPipeline(GLuint pipeline);
 
 extern void GLAPIENTRY
 _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
 
 extern void GLAPIENTRY
 _mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines);
 
 void GLAPIENTRY
-- 
2.9.3



More information about the mesa-dev mailing list