[Mesa-dev] [PATCH 2/2] glsl: remove duplicate validation

Alejandro Piñeiro apinheiro at igalia.com
Wed Apr 26 06:37:06 UTC 2017


On 26/04/17 05:56, Timothy Arceri wrote:
> Varying types have already been validated in
> apply_type_qualifier_to_variable() by this point.

After taking a look, it is not so evident (at least to me) that the
opaque condition is being tested. In any case, the patch makes sense, so
again, assuming no test regression:
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>

> ---
>  src/compiler/glsl/ast_to_hir.cpp | 15 ---------------
>  1 file changed, 15 deletions(-)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index 0ae87cb..ef6f6cc 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -5028,35 +5028,20 @@ ast_declarator_list::hir(exec_list *instructions,
>              }
>           } else if (state->stage == MESA_SHADER_TESS_CTRL ||
>                      state->stage == MESA_SHADER_TESS_EVAL) {
>              handle_tess_shader_input_decl(state, loc, var);
>           }
>        } else if (var->data.mode == ir_var_shader_out) {
>           const glsl_type *check_type = var->type->without_array();
>  
>           /* From section 4.3.6 (Output variables) of the GLSL 4.40 spec:
>            *
> -          *     It is a compile-time error to declare a vertex, tessellation
> -          *     evaluation, tessellation control, or geometry shader output
> -          *     that contains any of the following:
> -          *
> -          *     * A Boolean type (bool, bvec2 ...)
> -          *     * An opaque type
> -          */
> -         if (check_type->is_boolean() || check_type->contains_opaque())
> -            _mesa_glsl_error(&loc, state,
> -                             "%s shader output cannot have type %s",
> -                             _mesa_shader_stage_to_string(state->stage),
> -                             check_type->name);
> -
> -         /* From section 4.3.6 (Output variables) of the GLSL 4.40 spec:
> -          *
>            *     It is a compile-time error to declare a fragment shader output
>            *     that contains any of the following:
>            *
>            *     * A Boolean type (bool, bvec2 ...)
>            *     * A double-precision scalar or vector (double, dvec2 ...)
>            *     * An opaque type
>            *     * Any matrix type
>            *     * A structure
>            */
>           if (state->stage == MESA_SHADER_FRAGMENT) {



More information about the mesa-dev mailing list