aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorAndrii Simiklit <[email protected]>2019-07-17 15:05:49 +0300
committerKristian H. Kristensen <[email protected]>2020-01-06 13:01:19 -0800
commitbe6d51e1e3a2b2165cd21fbdda2527d10f4ce9ff (patch)
tree833424de32a8d925b6ba5f3d9dd4587d64dd00cf /src/compiler
parent4beb0a23088e68693e94599ef36eb41cbcd59289 (diff)
glsl/nir: do not change an element index to have correct block name
When SSBO array is used with packed layout, both IR tree and as a result, NIR tree will be incorrect. In fact, the SSBO dereference indices won't match the array size in some cases like the following: "layout(packed, binding=1) buffer SSBO { vec4 a; } ssbo[3]; out vec4 color; void main() { color = ssbo[2].a; }" After linking the IR and then NIR will have an SSBO array definition with size 1 but dereference still will have index 2 and linked_shader->Program->sh.ShaderStorageBlocks will contain just SSBO with name "SSBO[2]" So this line should be removed at least as a workaround for now to avoid error like: Failed to find the block by name "SSBO[0]" Fixes: 810dde2a "glsl/nir: Add a pass to lower UBO and SSBO access" Signed-off-by: Andrii Simiklit <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/gl_nir_lower_buffers.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/compiler/glsl/gl_nir_lower_buffers.c b/src/compiler/glsl/gl_nir_lower_buffers.c
index 59bb582069a..60ac1417355 100644
--- a/src/compiler/glsl/gl_nir_lower_buffers.c
+++ b/src/compiler/glsl/gl_nir_lower_buffers.c
@@ -49,7 +49,6 @@ get_block_array_index(nir_builder *b, nir_deref_instr *deref,
if (nir_src_is_const(deref->arr.index)) {
unsigned arr_index = nir_src_as_uint(deref->arr.index);
- arr_index = MIN2(arr_index, arr_size - 1);
/* We're walking the deref from the tail so prepend the array index */
block_name = ralloc_asprintf(b->shader, "[%u]%s", arr_index,