[Mesa-dev] [PATCH 5/7] glsl: Forbid use of image qualifiers in declarations of type other than image.

Francisco Jerez currojerez at riseup.net
Sat Jan 31 12:54:27 PST 2015


---
 src/glsl/ast_to_hir.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 783384e..1cfba39 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2399,6 +2399,14 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
 
          var->data.image_format = GL_NONE;
       }
+   } else if (qual->flags.q.read_only ||
+              qual->flags.q.write_only ||
+              qual->flags.q.coherent ||
+              qual->flags.q._volatile ||
+              qual->flags.q.restrict_flag ||
+              qual->flags.q.explicit_image_format) {
+      _mesa_glsl_error(loc, state, "memory qualifiers may only be applied to "
+                       "images");
    }
 }
 
@@ -2821,8 +2829,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
       validate_matrix_layout_for_type(state, loc, var->type, var);
    }
 
-   if (var->type->contains_image())
-      apply_image_qualifier_to_variable(qual, var, state, loc);
+   apply_image_qualifier_to_variable(qual, var, state, loc);
 }
 
 /**
-- 
2.1.3



More information about the mesa-dev mailing list