[Mesa-dev] [PATCH 34/42] mesa: add shader_storage_block_binding() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jun 27 11:20:37 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/uniforms.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index a71e0695b05..28f530c4f68 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -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);
 }
 
 /**
-- 
2.13.2



More information about the mesa-dev mailing list