mesa: add uniform_block_binding() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 26 Jun 2017 13:05:02 +0000 (15:05 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 28 Jun 2017 08:25:13 +0000 (10:25 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/uniforms.c

index 71acb288864ac1ba06fc33eeef17afdec5c17c1e..ef57866d6dcfee3d32f3c452050a69c09b1fc78e 100644 (file)
@@ -1085,6 +1085,21 @@ _mesa_GetUniformIndices(GLuint program,
    }
 }
 
+static void
+uniform_block_binding(struct gl_context *ctx, struct gl_shader_program *shProg,
+                      GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+   if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
+       uniformBlockBinding) {
+
+      FLUSH_VERTICES(ctx, 0);
+      ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
+
+      shProg->data->UniformBlocks[uniformBlockIndex].Binding =
+         uniformBlockBinding;
+   }
+}
+
 void GLAPIENTRY
 _mesa_UniformBlockBinding(GLuint program,
                          GLuint uniformBlockIndex,
@@ -1117,15 +1132,7 @@ _mesa_UniformBlockBinding(GLuint program,
       return;
    }
 
-   if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
-       uniformBlockBinding) {
-
-      FLUSH_VERTICES(ctx, 0);
-      ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
-
-      shProg->data->UniformBlocks[uniformBlockIndex].Binding =
-         uniformBlockBinding;
-   }
+   uniform_block_binding(ctx, shProg, uniformBlockIndex, uniformBlockBinding);
 }
 
 void GLAPIENTRY