[Mesa-dev] [PATCH 1/2] glsl/types: disallow implicit conversions before GLSL 1.20
Andres Gomez
agomez at igalia.com
Mon Aug 1 08:45:58 UTC 2016
On Mon, 2016-08-01 at 09:35 +1000, Timothy Arceri wrote:
> On Sun, 2016-07-31 at 18:43 +0300, Andres Gomez wrote:
> > Implicit conversions were added in the GLSL 1.20 spec version.
>
> Does this help fix the CTS test or are you just adding it because you
> noticed it?
It helps preventing a regression because of fixing the CTS test.
The CTS test is fixed because of using "can_implicitly_convert_to" to
check whether a type can be converted following strictly the rules of
Section 4.1.10 “Implicit Conversions.”
However, because of using this function and replacing
"apply_implicit_conversion" with the local "convert_component", a
regression was happening in piglit test:
tests/glslparsertest/glsl2/constructor-25.vert
This patch prevents that regression.
> Also I'd probably just add this to the ES check bellow.
>
> /* GLSL 1.10 and ESSL do 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 || !state->is_version(120, 0)))
> return false;
Right. I was following the same structure than in
"apply_implicit_conversion", but it makes sense to put both together.
I will update the patch.
Thanks!
>
> >
> > Signed-off-by: Andres Gomez <agomez at igalia.com>
> > ---
> > src/compiler/glsl_types.cpp | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/src/compiler/glsl_types.cpp
> > b/src/compiler/glsl_types.cpp
> > index 8a06695..24aec25 100644
> > --- a/src/compiler/glsl_types.cpp
> > +++ b/src/compiler/glsl_types.cpp
> > @@ -1384,6 +1384,10 @@ glsl_type::can_implicitly_convert_to(const
> > glsl_type *desired,
> > if (this == desired)
> > return true;
> >
> > + /* Prior to GLSL 1.20, there are no implicit conversions */
> > + if (state && !state->is_version(120, 0))
> > + return false;
> > +
> > /* 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.
>
--
Andres Gomez
Computer Science Engineer
mailto:agomez at igalia.com
http://blogs.igalia.com/agomez/category/igaliacom/
IGALIA, S.L. http://www.igalia.com
-------------- 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: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160801/2d0d839e/attachment.sig>
More information about the mesa-dev
mailing list