diff options
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 15 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 1 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 3 |
3 files changed, 17 insertions, 2 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 diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index efae4e98fb..457a6b92c1 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1391,7 +1391,6 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O, RETURN0; break; case OP_METHOD: - printf("******* begin OP_METHOD\n"); op->type = SLANG_OPER_METHOD; op->a_obj = parse_identifier(C); if (op->a_obj == SLANG_ATOM_NULL) diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index f31e9b4e6c..e3cb252a3d 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1324,7 +1324,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) _slang_is_temp(emitInfo->vt, n->Children[1]->Store) && (inst->DstReg.File == n->Children[1]->Store->File) && (inst->DstReg.Index == n->Children[1]->Store->Index) && - !n->Children[0]->Store->IsIndirect) { + !n->Children[0]->Store->IsIndirect && + n->Children[0]->Store->Size <= 4) { /* Peephole optimization: * The Right-Hand-Side has its results in a temporary place. * Modify the RHS (and the prev instruction) to store its results |