[Mesa-dev] [PATCH 2/6] glsl: correctly validate component layout qualifier for dvec{3, 4}
Andres Gomez
agomez at igalia.com
Mon Feb 11 13:20:08 UTC 2019
On Sat, 2019-02-02 at 10:49 +1100, Timothy Arceri wrote:
> On 2/2/19 5:05 am, Andres Gomez wrote:
> > From page 62 (page 68 of the PDF) of the GLSL 4.50 v.7 spec:
> >
> > " A dvec3 or dvec4 can only be declared without specifying a
> > component."
> >
> > Therefore, using the "component" qualifier with a dvec3 or dvec4
> > should result in a compiling error.
> >
> > Fixes: 94438578d21 ("glsl: validate and store component layout qualifier in GLSL IR")
> > Cc: Timothy Arceri <tarceri at itsqueeze.com>
> > Cc: Kenneth Graunke <kenneth at whitecape.org>
> > Signed-off-by: Andres Gomez <agomez at igalia.com>
> > ---
> > src/compiler/glsl/ast_to_hir.cpp | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> > index 620153e6a34..6d060fd94cd 100644
> > --- a/src/compiler/glsl/ast_to_hir.cpp
> > +++ b/src/compiler/glsl/ast_to_hir.cpp
> > @@ -3698,6 +3698,9 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
> > "cannot be applied to a matrix, a structure, "
> > "a block, or an array containing any of "
> > "these.");
> > + } else if (components > 4 && type->is_64bit()) {
> > + _mesa_glsl_error(loc, state, "component layout qualifier "
> > + "cannot be applied to dvec3 nor dvec4.");
>
> maybe:
>
> "cannot be applied to dvec%u", components / 2)
I'll update this locally.
>
> Otherwise:
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
> > } else if (qual_component != 0 &&
> > (qual_component + components - 1) > 3) {
> > _mesa_glsl_error(loc, state, "component overflow (%u > 3)",
> >
--
Br,
Andres
More information about the mesa-dev
mailing list