mesa: add shader_storage_block_binding() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 26 Jun 2017 13:31:28 +0000 (15:31 +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 a71e0695b0544222c2ad218ac10d052db2d9a417..28f530c4f68e94fd1f3bd227fc5bc57f4b666450 100644 (file)
@@ -1145,6 +1145,23 @@ _mesa_UniformBlockBinding(GLuint program,
    uniform_block_binding(ctx, shProg, uniformBlockIndex, uniformBlockBinding);
 }
 
+static void
+shader_storage_block_binding(struct gl_context *ctx,
+                             struct gl_shader_program *shProg,
+                             GLuint shaderStorageBlockIndex,
+                             GLuint shaderStorageBlockBinding)
+{
+   if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
+       shaderStorageBlockBinding) {
+
+      FLUSH_VERTICES(ctx, 0);
+      ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
+
+      shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
+         shaderStorageBlockBinding;
+   }
+}
+
 void GLAPIENTRY
 _mesa_ShaderStorageBlockBinding(GLuint program,
                                GLuint shaderStorageBlockIndex,
@@ -1179,15 +1196,8 @@ _mesa_ShaderStorageBlockBinding(GLuint program,
       return;
    }
 
-   if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
-       shaderStorageBlockBinding) {
-
-      FLUSH_VERTICES(ctx, 0);
-      ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
-
-      shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
-         shaderStorageBlockBinding;
-   }
+   shader_storage_block_binding(ctx, shProg, shaderStorageBlockIndex,
+                                shaderStorageBlockBinding);
 }
 
 /**