glsl: fix an incorrect max_array_access after optimization of ssbo/ubo
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Tue, 5 Mar 2019 15:38:20 +0000 (17:38 +0200)
committerKristian H. Kristensen <hoegsberg@google.com>
Mon, 6 Jan 2020 21:01:19 +0000 (13:01 -0800)
This is needed to fix these tests:
piglit.spec.arb_shader_storage_buffer_object.compiler.unused-array-element_frag
piglit.spec.arb_shader_storage_buffer_object.compiler.unused-array-element_comp

Fixes: 8cf1333b "glsl: link uniform block arrays of arrays"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109532
Reported-By: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Fritz Koenig <frkoenig@google.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/compiler/glsl/link_uniform_blocks.cpp

index 45f1c0fe98d7e7b457c13b14e9141a2ec674298c..715118cf50990c554172eab8255949ba021349a4 100644 (file)
@@ -440,6 +440,7 @@ link_uniform_blocks(void *mem_ctx,
            GLSL_INTERFACE_PACKING_PACKED)) {
          b->type = resize_block_array(b->type, b->array);
          b->var->type = b->type;
+         b->var->data.max_array_access = b->type->length - 1;
       }
 
       block_size.num_active_uniforms = 0;