diff options
author | Chris Forbes <[email protected]> | 2014-05-18 12:03:54 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-07-26 16:46:03 +1200 |
commit | c59802d3a147956d4f33586bb6221cd236987ee2 (patch) | |
tree | a9fdae7c0c72c44387962d18ea7d180cf47fb94f /src/glsl | |
parent | 9c90a633786ab8e204c118ec92015eb3ae194349 (diff) |
glsl: Convert uniform_block in lower_ubo_reference to ir_rvalue.
Previously this was a block index with special semantics for -1.
With ARB_gpu_shader5, this need not be a compile-time constant, so
allow any rvalue here and convert the -1 to a NULL pointer.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/lower_ubo_reference.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp index 90e65bd0ea0..9729ea071b3 100644 --- a/src/glsl/lower_ubo_reference.cpp +++ b/src/glsl/lower_ubo_reference.cpp @@ -57,7 +57,7 @@ public: void *mem_ctx; struct gl_shader *shader; struct gl_uniform_buffer_variable *ubo_var; - unsigned uniform_block; + ir_rvalue *uniform_block; bool progress; }; @@ -135,10 +135,10 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) interface_field_name(mem_ctx, (char *) var->get_interface_type()->name, deref); - this->uniform_block = -1; + this->uniform_block = NULL; for (unsigned i = 0; i < shader->NumUniformBlocks; i++) { if (strcmp(field_name, shader->UniformBlocks[i].Name) == 0) { - this->uniform_block = i; + this->uniform_block = new(mem_ctx) ir_constant(i); struct gl_uniform_block *block = &shader->UniformBlocks[i]; @@ -149,7 +149,7 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) } } - assert(this->uniform_block != (unsigned) -1); + assert(this->uniform_block); ir_rvalue *offset = new(mem_ctx) ir_constant(0u); unsigned const_offset = 0; @@ -267,11 +267,12 @@ ir_expression * lower_ubo_reference_visitor::ubo_load(const glsl_type *type, ir_rvalue *offset) { + ir_rvalue *block_ref = this->uniform_block->clone(mem_ctx, NULL); return new(mem_ctx) ir_expression(ir_binop_ubo_load, - type, - new(mem_ctx) ir_constant(this->uniform_block), - offset); + type, + block_ref, + offset); } |