[Mesa-dev] [PATCH 07/13] glsl: Add comments for the point mode layout-id-qualifier validation

Andres Gomez agomez at igalia.com
Mon Nov 14 17:15:08 UTC 2016


The point mode value in an ast_type_qualifier can only be true if the
flag is already set since this layout-id-qualifier can only be or not
be present in a shader.

Hence, it is useless to check for its value if the flag is already
set. However, for coherence and compatibility with future changes we
do check its value.

Added comments explaining this.

Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 src/compiler/glsl/ast_type.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index 064c63b..7c59747 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -315,6 +315,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
       this->ordering = q.ordering;
    }
 
+   /* Point mode can only be true if set but we check anyway in case there are
+    * more options in the future.
+    */
    if (q.flags.q.point_mode) {
       if (this->flags.q.point_mode && this->point_mode != q.point_mode) {
          _mesa_glsl_error(loc, state, "conflicting point mode used");
@@ -581,6 +584,9 @@ ast_type_qualifier::validate_in_qualifier(YYLTYPE *loc,
                        "conflicting ordering specified");
    }
 
+   /* Point mode can only be true if set but we check anyway in case there are
+    * more options in the future.
+    */
    if (state->in_qualifier->flags.q.point_mode && this->flags.q.point_mode
        && state->in_qualifier->point_mode != this->point_mode) {
       r  = false;
-- 
2.9.3



More information about the mesa-dev mailing list