summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-01-09 16:40:20 -0800
committerEric Anholt <eric@anholt.net>2012-01-10 16:44:16 -0800
commit916e206ef0cbcc5fa6c4026135e92079e1d73ec2 (patch)
tree3b0a0842708e01a504e515111cb7062999d4b6c3 /src/glsl
parentbe4e46b21a60cfdc826bf89d1078df54966115b1 (diff)
glsl: Add error checking for applying interpolation qualifiers to other vars.
Fixes piglit glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast_to_hir.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 1aebca40fac..cde7052b051 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2010,6 +2010,29 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
else
var->interpolation = INTERP_QUALIFIER_NONE;
+ if (var->interpolation != INTERP_QUALIFIER_NONE &&
+ !(state->target == vertex_shader && var->mode == ir_var_out) &&
+ !(state->target == fragment_shader && var->mode == ir_var_in)) {
+ const char *qual_string = NULL;
+ switch (var->interpolation) {
+ case INTERP_QUALIFIER_FLAT:
+ qual_string = "flat";
+ break;
+ case INTERP_QUALIFIER_NOPERSPECTIVE:
+ qual_string = "noperspective";
+ break;
+ case INTERP_QUALIFIER_SMOOTH:
+ qual_string = "smooth";
+ break;
+ }
+
+ _mesa_glsl_error(loc, state,
+ "interpolation qualifier `%s' can only be applied to "
+ "vertex shader outputs and fragment shader inputs.",
+ qual_string);
+
+ }
+
var->pixel_center_integer = qual->flags.q.pixel_center_integer;
var->origin_upper_left = qual->flags.q.origin_upper_left;
if ((qual->flags.q.origin_upper_left || qual->flags.q.pixel_center_integer)