[Mesa-dev] [PATCH 04/21] mesa/sso: Refactor new function _mesa_bind_pipeline

Ian Romanick idr at freedesktop.org
Tue Apr 29 17:52:07 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Pull most of the guts out of _mesa_BindPipeline into a new utility
function that can be use elsewhere (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
---
 src/mesa/main/pipelineobj.c | 13 ++++++++++---
 src/mesa/main/pipelineobj.h |  4 ++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index f55251e..90c1d00 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -412,8 +412,15 @@ _mesa_BindProgramPipeline(GLuint pipeline)
       newObj->EverBound = GL_TRUE;
    }
 
+   _mesa_bind_pipeline(ctx, newObj);
+}
+
+void
+_mesa_bind_pipeline(struct gl_context *ctx,
+                    struct gl_pipeline_object *pipe)
+{
    /* First bind the Pipeline to pipeline binding point */
-   _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, newObj);
+   _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, pipe);
 
    /* Section 2.11.3 (Program Objects) of the OpenGL 4.1 spec says:
     *
@@ -424,11 +431,11 @@ _mesa_BindProgramPipeline(GLuint pipeline)
     *     considered current."
     */
    if (&ctx->Shader != ctx->_Shader) {
-      if (pipeline) {
+      if (pipe != NULL) {
          /* Bound the pipeline to the current program and
           * restore the pipeline state
           */
-         _mesa_reference_pipeline_object(ctx, &ctx->_Shader, newObj);
+         _mesa_reference_pipeline_object(ctx, &ctx->_Shader, pipe);
       } else {
          /* Unbind the pipeline */
          _mesa_reference_pipeline_object(ctx, &ctx->_Shader,
diff --git a/src/mesa/main/pipelineobj.h b/src/mesa/main/pipelineobj.h
index ceaf4f1..7285a78 100644
--- a/src/mesa/main/pipelineobj.h
+++ b/src/mesa/main/pipelineobj.h
@@ -59,6 +59,10 @@ _mesa_reference_pipeline_object(struct gl_context *ctx,
       _mesa_reference_pipeline_object_(ctx, ptr, obj);
 }
 
+extern void
+_mesa_bind_pipeline(struct gl_context *ctx,
+                    struct gl_pipeline_object *pipe);
+
 extern GLboolean
 _mesa_validate_program_pipeline(struct gl_context * ctx, struct gl_pipeline_object *pipe, GLboolean IsBound);
 
-- 
1.8.1.4



More information about the mesa-dev mailing list