summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-03-24 12:11:01 +1100
committerTimothy Arceri <[email protected]>2016-03-26 09:26:30 +1100
commit8683d54d2be82519c31e087e17dd936d13fa9d07 (patch)
tree434fd99512a25b6cd37ad616870619e646e10291 /src/mesa/main/uniforms.c
parenta8e5edaadfd5df6a473566ff55978aca27a37679 (diff)
glsl: reduce buffer block duplication
This reduces some of the craziness required for handling buffer blocks. The problem is each shader stage holds its own information about a block in memory, we were copying that information to a program wide list but the per stage information remained meaning when a binding was updated we needed to update all versions of it. This changes the per stage blocks to instead point to a single version of the block information in the program list. Acked-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index b1968b3f795..7dcbdccf442 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -1018,26 +1018,11 @@ _mesa_UniformBlockBinding(GLuint program,
if (shProg->UniformBlocks[uniformBlockIndex]->Binding !=
uniformBlockBinding) {
- int i;
FLUSH_VERTICES(ctx, 0);
ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
- const int interface_block_index =
- shProg->UboInterfaceBlockIndex[uniformBlockIndex];
-
- shProg->BufferInterfaceBlocks[interface_block_index].Binding =
- uniformBlockBinding;
-
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- int stage_index =
- shProg->InterfaceBlockStageIndex[i][interface_block_index];
-
- if (stage_index != -1) {
- struct gl_shader *sh = shProg->_LinkedShaders[i];
- sh->BufferInterfaceBlocks[stage_index].Binding = uniformBlockBinding;
- }
- }
+ shProg->UniformBlocks[uniformBlockIndex]->Binding = uniformBlockBinding;
}
}
@@ -1076,26 +1061,12 @@ _mesa_ShaderStorageBlockBinding(GLuint program,
if (shProg->ShaderStorageBlocks[shaderStorageBlockIndex]->Binding !=
shaderStorageBlockBinding) {
- int i;
FLUSH_VERTICES(ctx, 0);
ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
- const int interface_block_index =
- shProg->SsboInterfaceBlockIndex[shaderStorageBlockIndex];
-
- shProg->BufferInterfaceBlocks[interface_block_index].Binding =
+ shProg->ShaderStorageBlocks[shaderStorageBlockIndex]->Binding =
shaderStorageBlockBinding;
-
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- int stage_index =
- shProg->InterfaceBlockStageIndex[i][interface_block_index];
-
- if (stage_index != -1) {
- struct gl_shader *sh = shProg->_LinkedShaders[i];
- sh->BufferInterfaceBlocks[stage_index].Binding = shaderStorageBlockBinding;
- }
- }
}
}