summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-13 12:36:42 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-08 16:23:19 +0000
commitc403863348d4678db2d6b798a4d2dd639c01f8f4 (patch)
tree9cef0513b525694a614b53aa2528094eeb6a26a8
parent7c7973606ffdadfad5ed3ec3904bfd21e47f5b04 (diff)
downloadexternal_mesa3d-c403863348d4678db2d6b798a4d2dd639c01f8f4.zip
external_mesa3d-c403863348d4678db2d6b798a4d2dd639c01f8f4.tar.gz
external_mesa3d-c403863348d4678db2d6b798a4d2dd639c01f8f4.tar.bz2
st/glsl_to_tgsi: fix atomic counter addressing
When more than one atomic counter buffer is in use, UniformStorage[n].opaque is set up to contain indices that are contiguous across all used buffers. This appears to be used by i965 via NIR, but for TGSI we do not treat atomic counter buffers as opaque, so using the data in the opaque array is incorrect. Fixes GL45-CTS.compute_shader.resource-atomic-counter. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commit 1dd99a15a4e0ffeabe0d50cbb402045e8e34d875)
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e381561..020494b 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -516,7 +516,8 @@ public:
unsigned *array_size,
unsigned *base,
unsigned *index,
- st_src_reg *reladdr);
+ st_src_reg *reladdr,
+ bool opaque);
void calc_deref_offsets(ir_dereference *head,
ir_dereference *tail,
unsigned *array_elements,
@@ -3151,7 +3152,7 @@ glsl_to_tgsi_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
st_src_reg offset;
unsigned array_size = 0, base = 0, index = 0;
- get_deref_offsets(deref, &array_size, &base, &index, &offset);
+ get_deref_offsets(deref, &array_size, &base, &index, &offset, false);
if (offset.file != PROGRAM_UNDEFINED) {
emit_asm(ir, TGSI_OPCODE_MUL, st_dst_reg(offset),
@@ -3458,7 +3459,7 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir)
st_src_reg image(PROGRAM_IMAGE, 0, GLSL_TYPE_UINT);
get_deref_offsets(img, &sampler_array_size, &sampler_base,
- (unsigned int *)&image.index, &reladdr);
+ (unsigned int *)&image.index, &reladdr, true);
if (reladdr.file != PROGRAM_UNDEFINED) {
emit_arl(ir, sampler_reladdr, reladdr);
image.reladdr = ralloc(mem_ctx, st_src_reg);
@@ -3818,7 +3819,8 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
unsigned *array_size,
unsigned *base,
unsigned *index,
- st_src_reg *reladdr)
+ st_src_reg *reladdr,
+ bool opaque)
{
GLuint shader = _mesa_program_enum_to_shader_stage(this->prog->Target);
unsigned location = 0;
@@ -3843,7 +3845,8 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
*array_size = 1;
}
- if (location != 0xffffffff) {
+ if (opaque) {
+ assert(location != 0xffffffff);
*base += this->shader_program->UniformStorage[location].opaque[shader].index;
*index += this->shader_program->UniformStorage[location].opaque[shader].index;
}
@@ -4097,7 +4100,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
}
get_deref_offsets(ir->sampler, &sampler_array_size, &sampler_base,
- &sampler_index, &reladdr);
+ &sampler_index, &reladdr, true);
if (reladdr.file != PROGRAM_UNDEFINED)
emit_arl(ir, sampler_reladdr, reladdr);