diff options
author | Eric Anholt <[email protected]> | 2010-07-20 16:03:46 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-07-20 16:21:07 -0700 |
commit | 325a49701fbee14a99a02c69872a1d7577a633cf (patch) | |
tree | 20b2db15cdddc9606d79cd5dd0297fb5a6a6d7f9 | |
parent | 2927c81ed10c0dc617f734c00376d0582ac3c061 (diff) |
glsl2: Fix handling of out values in function inlining.
The parameters[i] is our inlined variables representing the
parameters, so they are always ir_var_auto. Walk the signature params
in handling "out" values like we do for "in" values to find the mode.
Fixes (with the previous 2 commits):
glsl1-function call with in, out params
glsl1-function call with inout params
-rw-r--r-- | src/glsl/ir_function_inlining.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 8c545aaa6b7..a3f7089cdc8 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -169,21 +169,24 @@ ir_call::generate_inline(ir_instruction *next_ir) */ i = 0; param_iter = this->actual_parameters.iterator(); + sig_param_iter = this->callee->parameters.iterator(); for (i = 0; i < num_parameters; i++) { ir_instruction *const param = (ir_instruction *) param_iter.get(); + const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); /* Move our param variable into the actual param if it's an 'out' type. */ - if (parameters[i]->mode == ir_var_out || - parameters[i]->mode == ir_var_inout) { + if (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout) { ir_assignment *assign; - assign = new(ctx) ir_assignment(param->as_rvalue(), + assign = new(ctx) ir_assignment(param->clone(NULL)->as_rvalue(), new(ctx) ir_dereference_variable(parameters[i]), NULL); next_ir->insert_before(assign); } param_iter.next(); + sig_param_iter.next(); } delete [] parameters; |