[Mesa-dev] [PATCH 09/11] glsl: Propagate UBO binding qualifier into UBO member variables.
Kenneth Graunke
kenneth at whitecape.org
Wed Jul 17 18:24:09 PDT 2013
Without an instance name, there is no ir_variable representing the
actual uniform block declaration. When the linker goes to set uniform
initializers, it only sees the members as ir_variables; never the block.
So, unfortunately, the members need to know about the binding.
There has to be a better way to do this.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/ast_to_hir.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f438b6d..bd6c636 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4387,6 +4387,12 @@ ast_interface_block::hir(exec_list *instructions,
var_mode);
var->interface_type = block_type;
+ /* Propagate the "binding" keyword into this UBO's fields;
+ * the UBO declaration itself doesn't get an ir_variable unless it
+ * has an instance name. This is ugly.
+ */
+ var->constant_value = new(state) ir_constant(this->layout.binding);
+
state->symbols->add_variable(var);
instructions->push_tail(var);
}
--
1.8.3.2
More information about the mesa-dev
mailing list