From: Jose Maria Casanova Crespo Date: Fri, 17 Feb 2017 13:06:46 +0000 (+0100) Subject: glsl: link error if unsized array not-last in ssbo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=429f112a1124ace20052f0ea52de691edbfddf03;p=mesa.git glsl: link error if unsized array not-last in ssbo If an unsized declared array is not the last in an SSBO and an implicit size can not be defined on linking time, the linker should raise an error instead of reaching an assertion on GL. This reverts part of commit 3da08e166415a745139c1127040a24e8a45dc553 getting back to the behavior of commit 5b2675093e863a52b610f112884ae12d42513770 The original patch was correct for GLES that should produce a compile-time error but the linker error is still necessary in desktop GL. Fixes the following piglit tests: tests/spec/arb_shader_storage_buffer_object/non_integral_size_array_member.shader_test tests/spec/arb_shader_storage_buffer_object/unsized_array_member.shader_test Reviewed-by: Dave Airlie Reviewed-by: Iago Toral Quiroga Signed-off-by: Jose Maria Casanova Crespo --- diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp index ba01269c078..839fd07fa4b 100644 --- a/src/compiler/glsl/link_uniform_blocks.cpp +++ b/src/compiler/glsl/link_uniform_blocks.cpp @@ -146,7 +146,13 @@ private: */ const glsl_type *type_for_size = type; if (type->is_unsized_array()) { - assert(last_field); + if (!last_field) { + linker_error(prog, "unsized array `%s' definition: " + "only last member of a shader storage block " + "can be defined as unsized array", + name); + } + type_for_size = type->without_array(); }