diff options
author | Brian Paul <[email protected]> | 2008-11-26 09:35:26 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-01-06 09:03:23 -0700 |
commit | aeb3caeba5be5897bce4c25b84496a171711952b (patch) | |
tree | b5f4788272c7a6aa096d17fd349a3c4a29e30c5b /src | |
parent | e42ed1ed0bb2c429f94dd10b193cf1b0892870bf (diff) |
mesa: add missing type check for function calls
(cherry picked from commit 001b1cbb0dacf76dd09cda56840c30226abd3534)
Diffstat (limited to 'src')
-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 958f9bd777a..b821122663c 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2025,6 +2025,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 |