glsl: Forbid use of image qualifiers in declarations of type other than image.
authorFrancisco Jerez <currojerez@riseup.net>
Sat, 31 Jan 2015 20:07:47 +0000 (22:07 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 4 May 2015 14:44:16 +0000 (17:44 +0300)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/ast_to_hir.cpp

index da063d5606b609a3feb56c3a17980802438b017b..fa05c6565bcae43c2ee6e93e6b0588a9802ba861 100644 (file)
@@ -2369,6 +2369,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");
    }
 }
 
@@ -2793,8 +2801,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);
 }
 
 /**