[Mesa-dev] [PATCH 1/3] st/glsl_to_tgsi: fix indirect access to 64-bit integer

Nicolai Hähnle nhaehnle at gmail.com
Tue Oct 10 12:11:13 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Make sure we actually allocate two adjacent TGSI temporaries. The
current code fails e.g. when an arithmetic operation has two
operands with indirect accesses.

I will send out a new piglit test
(arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test)

Cc: mesa-stable at lists.freedesktop.org
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e01268bbbea..168719b33c9 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1262,21 +1262,21 @@ void
 glsl_to_tgsi_visitor::reladdr_to_temp(ir_instruction *ir,
                                       st_src_reg *reg, int *num_reladdr)
 {
    if (!reg->reladdr && !reg->reladdr2)
       return;
 
    if (reg->reladdr) emit_arl(ir, address_reg, *reg->reladdr);
    if (reg->reladdr2) emit_arl(ir, address_reg2, *reg->reladdr2);
 
    if (*num_reladdr != 1) {
-      st_src_reg temp = get_temp(reg->type == GLSL_TYPE_DOUBLE ? glsl_type::dvec4_type : glsl_type::vec4_type);
+      st_src_reg temp = get_temp(glsl_type::get_instance(reg->type, 4, 1));
 
       emit_asm(ir, TGSI_OPCODE_MOV, st_dst_reg(temp), *reg);
       *reg = temp;
    }
 
    (*num_reladdr)--;
 }
 
 void
 glsl_to_tgsi_visitor::visit(ir_expression *ir)
-- 
2.11.0



More information about the mesa-dev mailing list