summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2018-12-20 03:09:57 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2019-03-25 16:15:02 +0000
commitdb517e336c82721acb01d5a2b8580b345533e2b5 (patch)
tree9bd799a3e3f95a88031eef825986fa521994d8a0
parentf9160aa98b529de77133780a508afd1ce91f0072 (diff)
downloadmesa-db517e336c82721acb01d5a2b8580b345533e2b5.tar.gz
glsl: correctly validate component layout qualifier for dvec{3,4}
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: 94438578d21 ("glsl: validate and store component layout qualifier in GLSL IR") Cc: Timothy Arceri <tarceri@itsqueeze.com> Cc: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (cherry picked from commit a96093136bddfe17661f1de54228fe4b5618ba8a)
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index f4bd8c17db3..2f089d791c6 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3699,6 +3699,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)",