diff options
author | Kenneth Graunke <[email protected]> | 2013-07-17 18:11:55 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-07-18 16:57:24 -0700 |
commit | bfcec4618a00621ae6ff13963e3ac82507168b4e (patch) | |
tree | 952af600168ae3e7e4f6ab03f2af1a5990aadf50 /src/glsl | |
parent | f25d94084ce3225e803c07672c359a4e553b0e08 (diff) |
glsl: Handle the binding qualifier for UBO variables.
layout(binding = N) is equivalent to calling glUniformBlockBinding(_,N).
This currently only handles the GLSL 1.40 case - no interface names, no
arrays of uniform blocks. This is okay since we don't yet support GLSL
1.50, and don't expose ARB_shading_language_420pack in ES 3.0.
v2: Move into the other function; use binding, not constant_value.
Signed-off-by: Kenneth Graunke <[email protected]>
Acked-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/link_uniform_initializers.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp index 1b7609a4725..3f667104759 100644 --- a/src/glsl/link_uniform_initializers.cpp +++ b/src/glsl/link_uniform_initializers.cpp @@ -116,6 +116,16 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog, } } } + } else if (storage->block_index != -1) { + /* This is a field of a UBO. val is the binding index. */ + for (int i = 0; i < MESA_SHADER_TYPES; i++) { + int stage_index = prog->UniformBlockStageIndex[i][storage->block_index]; + + if (stage_index != -1) { + struct gl_shader *sh = prog->_LinkedShaders[i]; + sh->UniformBlocks[stage_index].Binding = binding; + } + } } storage->initialized = true; |