Skip to content

Commit

Permalink
glsl: correctly validate component layout qualifier for dvec{3,4}
Browse files Browse the repository at this point in the history
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.

v2: enhance the error message (Timothy).

Fixes: 9443857 ("glsl: validate and store component layout qualifier in GLSL IR")
Cc: Timothy Arceri <[email protected]>
Cc: Kenneth Graunke <[email protected]>
Signed-off-by: Andres Gomez <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
  • Loading branch information
tanty committed Mar 19, 2019
1 parent cbfe31c commit a960931
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/glsl/ast_to_hir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3696,6 +3696,10 @@ 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 dvec%u.",
components / 2);
} else if (qual_component != 0 &&
(qual_component + components - 1) > 3) {
_mesa_glsl_error(loc, state, "component overflow (%u > 3)",
Expand Down

0 comments on commit a960931

Please sign in to comment.