[Mesa-dev] [PATCH v2] glsl: disallow implicit conversions in ESSL shaders

Kenneth Graunke kenneth at whitecape.org
Wed Jan 27 23:51:42 PST 2016


On Wednesday, January 27, 2016 5:18:29 PM PST Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> 
> OK, ran piglit on all of this and noticed the issue with state == NULL in
> can_implicitly_convert_to. With that fixed, the only piglit regression is
> 
> spec/arb_blend_func_extended/arb_blend_func_extended-fbo-extended-blend-
pattern_gles3: pass fail
> 
> Which is precisely the piglit that spurred this whole discussion.
> 
> (Piglit run was tests/quick.py on i965/hsw + gbm.)
> 
>  src/compiler/glsl/ast_to_hir.cpp | 4 ++++
>  src/compiler/glsl_types.cpp      | 7 +++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/
ast_to_hir.cpp
> index dfd3196..3fca18a 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -291,6 +291,10 @@ apply_implicit_conversion(const glsl_type *to, 
ir_rvalue * &from,
>     if (!state->is_version(120, 0))
>        return false;
>  
> +   /* ESSL does not allow implicit conversions */
> +   if (state->es_shader)
> +      return false;
> +
>     /* From page 27 (page 33 of the PDF) of the GLSL 1.50 spec:
>      *
>      *    "There are no implicit array or structure conversions. For
> diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
> index 17ebf07..ef6c3c6 100644
> --- a/src/compiler/glsl_types.cpp
> +++ b/src/compiler/glsl_types.cpp
> @@ -1139,6 +1139,13 @@ glsl_type::can_implicitly_convert_to(const glsl_type 
*desired,
>     if (this == desired)
>        return true;
>  
> +   /* ESSL does not allow implicit conversions. If there is no state, we're
> +    * doing intra-stage function linking where these checks have already 
been
> +    * done.
> +    */
> +   if (state && state->es_shader)
> +      return false;
> +
>     /* There is no conversion among matrix types. */
>     if (this->matrix_columns > 1 || desired->matrix_columns > 1)
>        return false;
> 

Amazing!  It definitely doesn't have implicit conversions, and never
has...I checked both GLSL ES 1.00 and 3.20.  I'm also surprised we
didn't catch this sooner.  It seems like the sort of thing that
conformance tests would love to catch...

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20160127/8805604a/attachment-0001.sig>


More information about the mesa-dev mailing list