From 3c9ed70d928461eb4968b982ce444c79a734f2b2 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 17 Aug 2017 21:03:03 +1000 Subject: [PATCH] mesa/st: simplify some UBO index logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 ++--- 1 file 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; } -- 2.30.2