summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 14fa38c3cd..3766a24697 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -651,6 +651,8 @@ new_var(slang_assemble_ctx *A, slang_operation *oper, slang_atom name)
if (!var)
return NULL;
+ assert(var->declared);
+
assert(!oper->var || oper->var == var);
n = new_node0(IR_VAR);
@@ -924,7 +926,6 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
}
-
/**
* Produce inline code for a call to an assembly instruction.
* This is typically used to compile a call to a built-in function like this:
@@ -1196,6 +1197,16 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
}
}
+ /* Now add copies of the function's local vars to the new variable scope */
+ for (i = totalArgs; i < fun->parameters->num_variables; i++) {
+ slang_variable *p = fun->parameters->variables[i];
+ slang_variable *pCopy = slang_variable_scope_grow(inlined->locals);
+ pCopy->type = p->type;
+ pCopy->a_name = p->a_name;
+ pCopy->array_len = p->array_len;
+ }
+
+
/* New epilog statements:
* 1. Create end of function label to jump to from return statements.
* 2. Copy the 'out' parameter vars
@@ -2059,6 +2070,8 @@ static slang_ir_node *
_slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
{
slang_ir_node *n;
+ /*assert(!var->declared);*/
+ var->declared = GL_TRUE;
assert(!is_sampler_type(&var->type));
n = new_node0(IR_VAR_DECL);
if (n) {
@@ -3140,6 +3153,8 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
if (store)
var->aux = store; /* save var's storage info */
+ var->declared = GL_TRUE;
+
return success;
}