summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-11-26 09:35:26 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-11-26 09:35:26 -0700
commit001b1cbb0dacf76dd09cda56840c30226abd3534 (patch)
tree1ab5cc5c79137dc721abac1567c0d8161b9abb7b /src
parentaa40de5c6f7f70844d4a4c726456cceaee9f0e4d (diff)
mesa: add missing type check for function calls
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 8d2655ec51..8abb642a72 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2028,6 +2028,21 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
return NULL;
}
+ /* type checking to be sure function's return type matches 'dest' type */
+ if (dest) {
+ slang_typeinfo t0;
+
+ slang_typeinfo_construct(&t0);
+ _slang_typeof_operation(A, dest, &t0);
+
+ if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) {
+ slang_info_log_error(A->log,
+ "Incompatible type returned by call to '%s'",
+ name);
+ return NULL;
+ }
+ }
+
n = _slang_gen_function_call(A, fun, oper, dest);
if (n && !n->Store && !dest