Mesa (staging/19.0): glsl: correctly validate component layout qualifier for dvec{3,4}

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 19 17:59:40 UTC 2019


Module: Mesa
Branch: staging/19.0
Commit: 1b4712719e3ad3433576f84afacb36891aa1a88e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b4712719e3ad3433576f84afacb36891aa1a88e

Author: Andres Gomez <agomez at igalia.com>
Date:   Thu Dec 20 03:09:57 2018 +0200

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 at itsqueeze.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Andres Gomez <agomez at igalia.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
(cherry picked from commit a96093136bddfe17661f1de54228fe4b5618ba8a)

---

 src/compiler/glsl/ast_to_hir.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 620153e6a34..ebb460962ff 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3698,6 +3698,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)",




More information about the mesa-commit mailing list