diff options
author | Kenneth Graunke <[email protected]> | 2011-01-12 15:37:37 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-01-31 11:10:59 -0800 |
commit | 819d57fce94b20fa0d34da6f037f0a53c4a5bdc2 (patch) | |
tree | ea4c12c2a582e0f4a4119b4ace0bfecc5245d14b /src/glsl/ir.cpp | |
parent | c5a27b5939427bdc95c926b450ed3de1ff4baafb (diff) |
glsl: Introduce a new "const_in" variable mode.
This annotation is for an "in" function parameter for which it is only legal
to pass constant expressions. The only known example of this, currently,
is the textureOffset functions.
This should never be used for globals.
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r-- | src/glsl/ir.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index cc508e2a424..fc356ba5275 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1379,6 +1379,21 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type) } +static bool +modes_match(unsigned a, unsigned b) +{ + if (a == b) + return true; + + /* Accept "in" vs. "const in" */ + if ((a == ir_var_const_in && b == ir_var_in) || + (b == ir_var_const_in && a == ir_var_in)) + return true; + + return false; +} + + const char * ir_function_signature::qualifiers_match(exec_list *params) { @@ -1391,7 +1406,7 @@ ir_function_signature::qualifiers_match(exec_list *params) ir_variable *b = (ir_variable *)iter_b.get(); if (a->read_only != b->read_only || - a->mode != b->mode || + !modes_match(a->mode, b->mode) || a->interpolation != b->interpolation || a->centroid != b->centroid) { |