diff options
author | Brian Paul <[email protected]> | 2008-11-26 09:35:26 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-11-26 09:35:26 -0700 |
commit | 001b1cbb0dacf76dd09cda56840c30226abd3534 (patch) | |
tree | 1ab5cc5c79137dc721abac1567c0d8161b9abb7b /src/mesa | |
parent | aa40de5c6f7f70844d4a4c726456cceaee9f0e4d (diff) |
mesa: add missing type check for function calls
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 15 |
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 8d2655ec517..8abb642a728 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 |