aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-10-10 11:44:03 +0200
committerNicolai Hähnle <[email protected]>2016-10-13 15:41:29 +0200
commit1d7685e52ca64f6fcc66b8816b5adb8513b4ae18 (patch)
treeecf406cbb7f65d0cd65e04a08c954a53991cb759 /src/mesa/state_tracker/st_glsl_to_tgsi.cpp
parentb234e377650c8280d56060ff38c55af9d7772ee4 (diff)
st/glsl_to_tgsi: fix textureGatherOffset with indirectly loaded offsets
Cc: [email protected] Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_glsl_to_tgsi.cpp')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 33c1f877b69..be0aa2ea471 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -560,6 +560,7 @@ public:
unsigned *index,
st_src_reg *indirect,
unsigned *location);
+ st_src_reg canonicalize_gather_offset(st_src_reg offset);
bool try_emit_mad(ir_expression *ir,
int mul_operand);
@@ -3970,6 +3971,20 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
}
}
+st_src_reg
+glsl_to_tgsi_visitor::canonicalize_gather_offset(st_src_reg offset)
+{
+ if (offset.reladdr || offset.reladdr2) {
+ st_src_reg tmp = get_temp(glsl_type::ivec2_type);
+ st_dst_reg tmp_dst = st_dst_reg(tmp);
+ tmp_dst.writemask = WRITEMASK_XY;
+ emit_asm(NULL, TGSI_OPCODE_MOV, tmp_dst, offset);
+ return tmp;
+ }
+
+ return offset;
+}
+
void
glsl_to_tgsi_visitor::visit(ir_texture *ir)
{
@@ -4095,9 +4110,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
offset[i].index += i * type_size(elt_type);
offset[i].type = elt_type->base_type;
offset[i].swizzle = swizzle_for_size(elt_type->vector_elements);
+ offset[i] = canonicalize_gather_offset(offset[i]);
}
} else {
- offset[0] = this->result;
+ offset[0] = canonicalize_gather_offset(this->result);
}
}
break;