summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-08-08 16:42:37 -0700
committerIan Romanick <ian.d.romanick@intel.com>2013-08-09 15:26:08 -0700
commitcb8e109492a911977fd646343a26169edd4a9aee (patch)
treebaec1a9a23764b5b1d8290d9cd3bc5a8f08e2623 /src
parent4006fc46563cd14e05ffb0a97888d7e8d06b979c (diff)
glsl: Don't allow const on out or inout function parameters
Fixes piglit tests const-inout-parameter.frag and const-out-parameter.frag. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Cc: "9.2" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 58948981480c1fe93a171373c7676761e4d0b41e)
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index be7755d8d07..932e38a6414 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1963,6 +1963,21 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
_mesa_glsl_shader_target_name(state->target));
}
+ /* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
+ *
+ * "However, the const qualifier cannot be used with out or inout."
+ *
+ * The same section of the GLSL 4.40 spec further clarifies this saying:
+ *
+ * "The const qualifier cannot be used with out or inout, or a
+ * compile-time error results."
+ */
+ if (is_parameter && qual->flags.q.constant && qual->flags.q.out) {
+ _mesa_glsl_error(loc, state,
+ "`const' may not be applied to `out' or `inout' "
+ "function parameters");
+ }
+
/* If there is no qualifier that changes the mode of the variable, leave
* the setting alone.
*/