glsl: Drop resize-to-MaxPatchVertices hack.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 11 Feb 2017 07:02:56 +0000 (23:02 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 13 Feb 2017 05:09:25 +0000 (21:09 -0800)
TCS and TES inputs without an array size are implicitly sized to
gl_MaxPatchVertices.  But TCS outputs are apparently not:

   "If no size is specified, it will be taken from the output patch size
    (gl_VerticesOut) declared in the shader."

Fixes dEQP-GLES31.functional.program_interface_query.program_output.
array_size.separable_tess_ctrl.var.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/ir.h
src/compiler/glsl/linker.cpp
src/compiler/glsl/lower_named_interface_blocks.cpp

index ee47b654bfbb3e339c7b483dd9757a67a8d144fe..b90ad97b1de4d3b59fdbc9740fc95082150305c5 100644 (file)
@@ -4404,8 +4404,6 @@ handle_tess_ctrl_shader_output_decl(struct _mesa_glsl_parse_state *state,
    if (var->data.patch)
       return;
 
-   var->data.tess_varying_implicit_sized_array = var->type->is_unsized_array();
-
    validate_layout_qualifier_vertex_count(state, loc, var, num_vertices,
                                           &state->tcs_output_size,
                                           "tessellation control shader output");
@@ -4442,7 +4440,6 @@ handle_tess_shader_input_decl(struct _mesa_glsl_parse_state *state,
    if (var->type->is_unsized_array()) {
       var->type = glsl_type::get_array_instance(var->type->fields.array,
             state->Const.MaxPatchVertices);
-      var->data.tess_varying_implicit_sized_array = true;
    } else if (var->type->length != state->Const.MaxPatchVertices) {
       _mesa_glsl_error(&loc, state,
                        "per-vertex tessellation shader input arrays must be "
index 4317c54d4986f0d15c08226f3668f30395402ff0..3544161105eb8484212cb2507881078892f0161a 100644 (file)
@@ -843,12 +843,6 @@ public:
 
       unsigned implicit_sized_array:1;
 
-      /**
-       * Is this a non-patch TCS output / TES input array that was implicitly
-       * sized to gl_MaxPatchVertices?
-       */
-      unsigned tess_varying_implicit_sized_array:1;
-
       /**
        * Whether this is a fragment shader output implicitly initialized with
        * the previous contents of the specified render target at the
index 4c7bf282ce10a2f6387326a91fdf434d1863c3c7..b3c7d2c14569855788f8963aadf42f966fda4c0a 100644 (file)
@@ -3709,17 +3709,6 @@ create_shader_variable(struct gl_shader_program *shProg,
    return out;
 }
 
-static const glsl_type *
-resize_to_max_patch_vertices(const struct gl_context *ctx,
-                             const glsl_type *type)
-{
-   if (!type)
-      return NULL;
-
-   return glsl_type::get_array_instance(type->fields.array,
-                                        ctx->Const.MaxPatchVertices);
-}
-
 static bool
 add_shader_variable(const struct gl_context *ctx,
                     struct gl_shader_program *shProg,
@@ -3733,27 +3722,6 @@ add_shader_variable(const struct gl_context *ctx,
    const glsl_type *interface_type = var->get_interface_type();
 
    if (outermost_struct_type == NULL) {
-      /* Unsized (non-patch) TCS output/TES input arrays are implicitly
-       * sized to gl_MaxPatchVertices.  Internally, we shrink them to a
-       * smaller size.
-       *
-       * This can cause trouble with SSO programs.  Since the TCS declares
-       * the number of output vertices, we can always shrink TCS output
-       * arrays.  However, the TES might not be linked with a TCS, in
-       * which case it won't know the size of the patch.  In other words,
-       * the TCS and TES may disagree on the (smaller) array sizes.  This
-       * can result in the resource names differing across stages, causing
-       * SSO validation failures and other cascading issues.
-       *
-       * Expanding the array size to the full gl_MaxPatchVertices fixes
-       * these issues.  It's also what program interface queries expect,
-       * as that is the official size of the array.
-       */
-      if (var->data.tess_varying_implicit_sized_array) {
-         type = resize_to_max_patch_vertices(ctx, type);
-         interface_type = resize_to_max_patch_vertices(ctx, interface_type);
-      }
-
       if (var->data.from_named_ifc_block) {
          const char *interface_name = interface_type->name;
 
index 53ef638c9c42e5aff582a1e8289100e1fa4e70fe..a00e60dd7711c0dbc9937f70cf8f03b65ec17f7e 100644 (file)
@@ -193,8 +193,6 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
             new_var->data.patch = iface_t->fields.structure[i].patch;
             new_var->data.stream = var->data.stream;
             new_var->data.how_declared = var->data.how_declared;
-            new_var->data.tess_varying_implicit_sized_array =
-               var->data.tess_varying_implicit_sized_array;
             new_var->data.from_named_ifc_block = 1;
 
             new_var->init_interface_type(var->type);