summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-08-19 11:23:25 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-19 11:23:25 -0600
commitc4cf2513e60a90a5b3a6238684a6b51e1f501864 (patch)
tree7203ab7e98f2ccd9a352e98d1cf4826fab571b92 /src/mesa
parent3e1706f720b211f27a4aa88af2141db0c793adbb (diff)
mesa: glsl: limit function matching through casting
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index f96c655759..e5a2c61d4f 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -1980,6 +1980,12 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
fun = _slang_locate_struct_constructor(A, name);
}
+ /*
+ * At this point, some heuristics are used to try to find a function
+ * that matches the calling signature by means of casting or "unrolling"
+ * of constructors.
+ */
+
if (!fun && _slang_is_vec_mat_type(name)) {
/* Next, if this call looks like a vec() or mat() constructor call,
* try "unwinding" the args to satisfy a constructor.
@@ -1995,7 +2001,7 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
}
}
- if (!fun) {
+ if (!fun && _slang_is_vec_mat_type(name)) {
/* Next, try casting args to the types of the formal parameters */
int numArgs = oper->num_children;
fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs);
@@ -2008,6 +2014,13 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
assert(fun);
}
+ if (!fun) {
+ slang_info_log_error(A->log,
+ "Function '%s' not found (check argument types)",
+ name);
+ return NULL;
+ }
+
n = _slang_gen_function_call(A, fun, oper, dest);
if (n && !n->Store && !dest