diff options
author | Nicolai Hähnle <[email protected]> | 2016-10-13 12:36:42 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-10-17 19:09:42 +0200 |
commit | 1dd99a15a4e0ffeabe0d50cbb402045e8e34d875 (patch) | |
tree | 6cd88e54feb44fb9f17269eb43af32b2ec5e8842 /src/mesa/state_tracker | |
parent | 9d6f82320c8a7f0df10f0b7868d966be907e6b21 (diff) |
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: [email protected]
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 15 |
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 a7ea19fb239..682c0347ddf 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -552,7 +552,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, @@ -3254,7 +3255,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), @@ -3585,7 +3586,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) { image.reladdr = ralloc(mem_ctx, st_src_reg); *image.reladdr = reladdr; @@ -3967,7 +3968,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; @@ -3992,7 +3994,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; } @@ -4246,7 +4249,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); |