summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_validate.cpp
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-05-25 13:31:41 +1000
committerDave Airlie <airlied@redhat.com>2016-05-26 12:42:10 +1000
commit5b2675093e863a52b610f112884ae12d42513770 (patch)
tree065396a166ddf061a56396cca08059d33195fe7b /src/compiler/glsl/ir_validate.cpp
parent4d70fd1bc79a5923505f99494a68bb506f3cde66 (diff)
downloadexternal_mesa3d-5b2675093e863a52b610f112884ae12d42513770.zip
external_mesa3d-5b2675093e863a52b610f112884ae12d42513770.tar.gz
external_mesa3d-5b2675093e863a52b610f112884ae12d42513770.tar.bz2
glsl: handle implicit sized arrays in ssbo
The current code disallows unsized arrays except at the end of an SSBO but it is a bit overzealous in doing so. struct a { int b[]; int f[4]; }; is valid as long as b is implicitly sized within the shader, i.e. it is accessed only by integer indices. I've submitted some piglit tests to test for this. This also has no regressions on piglit on my Haswell. This fixes: GL45-CTS.shader_storage_buffer_object.basic-syntax GL45-CTS.shader_storage_buffer_object.basic-syntaxSSO This patch moves a chunk of the linker code down, so that we don't link the uniform blocks until after we've merged all the variables. The logic went something like: Removing the checks for last ssbo member unsized from the compiler and into the linker, meant doing the check in the link_uniform_blocks code. However to do that the array sizing had to happen first, so we knew that the only unsized arrays were in the last block. But array sizing required the variable to be merged, otherwise you'd get two different array sizes in different version of two variables, and one would get lost when merged. So the solution was to move array sizing up, after variable merging, but before uniform block visiting. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/compiler/glsl/ir_validate.cpp')
-rw-r--r--src/compiler/glsl/ir_validate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 9d05e7e..757f17c 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -743,7 +743,8 @@ ir_validate::visit(ir_variable *ir)
const glsl_struct_field *fields =
ir->get_interface_type()->fields.structure;
for (unsigned i = 0; i < ir->get_interface_type()->length; i++) {
- if (fields[i].type->array_size() > 0) {
+ if (fields[i].type->array_size() > 0 &&
+ !fields[i].implicit_sized_array) {
const int *const max_ifc_array_access =
ir->get_max_ifc_array_access();