mesa/sso: Refactor new function _mesa_bind_pipeline
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 26 Mar 2014 01:19:42 +0000 (18:19 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 2 May 2014 14:16:55 +0000 (07:16 -0700)
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@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/pipelineobj.c
src/mesa/main/pipelineobj.h

index f55251e065dd3a5a6c37ee2f9b5843a413b69510..90c1d005f74304a3070ca4c4be2002819cec45a1 100644 (file)
@@ -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,
index ceaf4f14ce98b02cbcf52e72986b7bc509a563cb..7285a78f1ae1727eebdd20cc7911307a58075132 100644 (file)
@@ -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);