[Mesa-dev] [PATCH] glsl/ast: don't allow subroutine uniform comparisons

Alejandro Piñeiro apinheiro at igalia.com
Tue Jun 7 11:07:16 UTC 2016


On 07/06/16 07:20, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This fixes:
> GL45-CTS.shader_subroutine.subroutines_cannot_be_assigned_float_int_values_or_be_compared
>
> though I'm not 100% sure why this is illegal from the spec,

Reading a little the spec, I also didn't find any explicit reference on
the spec. Having said so ...
> but it makes us pass the test, and I really can't see a use case for this.

... yes, I agree with this.

>
> Signged-off-by: Dave Airlie <airlied at redhat.com>

typo here: Signed-off-by

> ---
>  src/compiler/glsl/ast_to_hir.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index b7192b2..fbd3256 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -1484,6 +1484,12 @@ ast_expression::do_hir(exec_list *instructions,
>                           "operand of type 'void' or a right operand of type "
>                           "'void'", (this->oper == ast_equal) ? "==" : "!=");
>           error_emitted = true;
> +      } else if (op[0]->type->is_subroutine() || op[1]->type->is_subroutine()) {
> +         _mesa_glsl_error(& loc, state, "`%s':  wrong operand types: "
> +                         "no operation `%1$s' exists that takes a left-hand "
> +                         "operand of type 'subroutine' or a right operand of type "
> +                         "'subroutine'", (this->oper == ast_equal) ? "==" : "!=");
> +         error_emitted = true;
>        } else if ((!apply_implicit_conversion(op[0]->type, op[1], state)
>             && !apply_implicit_conversion(op[1]->type, op[0], state))
>            || (op[0]->type != op[1]->type)) {

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>



More information about the mesa-dev mailing list