diff options
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 93b6d9f854..cf3569c3b0 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1107,12 +1107,18 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, else { /* non-assembly function */ inlined = slang_inline_function_call(A, fun, oper, dest); - if (inlined) { + if (inlined && _slang_find_node_type(inlined, SLANG_OPER_RETURN)) { + /* This inlined function has one or more 'return' statements. + * So, we can't truly inline this function because we need to + * implement 'return' with RET (and CAL). + * XXX check if there's one 'return' and if it's the very last + * statement in the function - we can optimize that case. + */ assert(inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE || inlined->type == SLANG_OPER_SEQUENCE); inlined->type = SLANG_OPER_INLINED_CALL; inlined->fun = fun; - inlined->label = _slang_label_new((char*) fun->header.a_name); + inlined->label = _slang_label_new_unique((char*) fun->header.a_name); } } |