[Mesa-stable] [PATCH] glsl: make sure UBO arrays are sized in ES

Timothy Arceri timothy.arceri at collabora.com
Tue Jun 14 01:35:46 UTC 2016


This check was removed in 5b2675093e86 add it back in.

https://bugs.freedesktop.org/show_bug.cgi?id=96349
---
 src/compiler/glsl/ast_to_hir.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 3d34ecf..551d004 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -7597,6 +7597,20 @@ ast_interface_block::hir(exec_list *instructions,
                if (is_unsized_array_last_element(var)) {
                   var->data.from_ssbo_unsized_array = true;
                }
+            } else {
+               /* From GLSL ES 3.10 spec, section 4.1.9 "Arrays":
+                *
+                * "If an array is declared as the last member of a shader storage
+                * block and the size is not specified at compile-time, it is
+                * sized at run-time. In all other cases, arrays are sized only
+                * at compile-time."
+                */
+               if (state->es_shader) {
+                  _mesa_glsl_error(&loc, state, "unsized array `%s' "
+                                   "definition: only last member of a shader "
+                                   "storage block can be defined as unsized "
+                                   "array", fields[i].name);
+               }
             }
          }
 
-- 
2.5.5



More information about the mesa-stable mailing list