From 819d57fce94b20fa0d34da6f037f0a53c4a5bdc2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 12 Jan 2011 15:37:37 -0800 Subject: 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. --- src/glsl/ir.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl/ir.cpp') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index cc508e2a42..fc356ba527 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) { -- cgit v1.2.3