aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-17 21:03:03 +1000
committerTimothy Arceri <[email protected]>2017-08-22 13:32:21 +1000
commit3c9ed70d928461eb4968b982ce444c79a734f2b2 (patch)
tree7a667517c4f1596cb063e8782d0d46aad3eecc6d
parent36431cf9796517b4e08b930aecc5ec66e5ec432e (diff)
mesa/st: simplify some UBO index logic
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f4f3092fe02..9688400ed4f 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2161,7 +2161,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
ir_constant *const_uniform_block = ir->operands[0]->as_constant();
ir_constant *const_offset_ir = ir->operands[1]->as_constant();
unsigned const_offset = const_offset_ir ? const_offset_ir->value.u[0] : 0;
- unsigned const_block = const_uniform_block ? const_uniform_block->value.u[0] + 1 : 0;
+ unsigned const_block = const_uniform_block ? const_uniform_block->value.u[0] + 1 : 1;
st_src_reg index_reg = get_temp(glsl_type::uint_type);
st_src_reg cbuf;
@@ -2171,6 +2171,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
cbuf.reladdr = NULL;
cbuf.negate = 0;
cbuf.abs = 0;
+ cbuf.index2D = const_block;
assert(ir->type->is_vector() || ir->type->is_scalar());
@@ -2217,13 +2218,11 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
if (const_uniform_block) {
/* Constant constant buffer */
cbuf.reladdr2 = NULL;
- cbuf.index2D = const_block;
cbuf.has_index2 = true;
}
else {
/* Relative/variable constant buffer */
cbuf.reladdr2 = ralloc(mem_ctx, st_src_reg);
- cbuf.index2D = 1;
memcpy(cbuf.reladdr2, &op[0], sizeof(st_src_reg));
cbuf.has_index2 = true;
}