Mesa (master): glsl: Skip "unsized arrays aren't allowed" check for TCS/ TES/GS vars.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Sep 19 21:59:27 UTC 2016


Module: Mesa
Branch: master
Commit: 04026b43c89c6fdb794650f8c80e356707cc6d69
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=04026b43c89c6fdb794650f8c80e356707cc6d69

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Sep 15 02:10:23 2016 -0700

glsl: Skip "unsized arrays aren't allowed" check for TCS/TES/GS vars.

Fixes ESEXT-CTS.draw_elements_base_vertex_tests.AEP_shader_stages and
ESEXT-CTS.texture_cube_map_array.texture_size_tesselation_con_sh.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/compiler/glsl/ast_to_hir.cpp | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 0a23195..9de8454 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -5127,7 +5127,33 @@ ast_declarator_list::hir(exec_list *instructions,
          const glsl_type *const t = (earlier == NULL)
             ? var->type : earlier->type;
 
-         if (t->is_unsized_array())
+         /* Skip the unsized array check for TCS/TES/GS inputs & TCS outputs.
+          *
+          * The GL_OES_tessellation_shader spec says about inputs:
+          *
+          *    "Declaring an array size is optional. If no size is specified,
+          *     it will be taken from the implementation-dependent maximum
+          *     patch size (gl_MaxPatchVertices)."
+          *
+          * and about TCS outputs:
+          *
+          *    "If no size is specified, it will be taken from output patch
+          *     size declared in the shader."
+          *
+          * The GL_OES_geometry_shader spec says:
+          *
+          *    "All geometry shader input unsized array declarations will be
+          *     sized by an earlier input primitive layout qualifier, when
+          *     present, as per the following table."
+          */
+         const bool implicitly_sized =
+            (var->data.mode == ir_var_shader_in &&
+             state->stage >= MESA_SHADER_TESS_CTRL &&
+             state->stage <= MESA_SHADER_GEOMETRY) ||
+            (var->data.mode == ir_var_shader_out &&
+             state->stage == MESA_SHADER_TESS_CTRL);
+
+         if (t->is_unsized_array() && !implicitly_sized)
             /* Section 10.17 of the GLSL ES 1.00 specification states that
              * unsized array declarations have been removed from the language.
              * Arrays that are sized using an initializer are still explicitly




More information about the mesa-commit mailing list