summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_function_inlining.cpp
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-01-11 14:39:32 -0800
committerPaul Berry <[email protected]>2013-01-24 16:30:30 -0800
commit42a29d89fd85c86387f0d119950e243b6de76d79 (patch)
tree9eee8f2d609855dc9c6813aac84f5fdcd6786a54 /src/glsl/opt_function_inlining.cpp
parent7d51ead56e2b97d313c6a0fda22cc930b5c41e9d (diff)
glsl: Eliminate ambiguity between function ins/outs and shader ins/outs
This patch replaces the three ir_variable_mode enums: - ir_var_in - ir_var_out - ir_var_inout with the following five: - ir_var_shader_in - ir_var_shader_out - ir_var_function_in - ir_var_function_out - ir_var_function_inout This eliminates a frustrating ambiguity: it used to be impossible to tell whether an ir_var_{in,out} variable was a shader in/out or a function in/out without seeing where the variable was declared in the IR. This complicated some optimization and lowering passes, and would have become a problem for implementing varying structs. In the lisp-style serialization of GLSL IR to strings performed by ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in", "out", and "inout" for function parameters, to avoid introducing code churn to the src/glsl/builtins/ir/ directory. Note: a couple of comments in the code seemed to indicate that we were planning for a possible future in which geometry shaders could have shader-scope inout variables. Our GLSL grammar rejects shader-scope inout variables, and I've been unable to find any evidence in the GLSL standards documents (or extensions) that this will ever be allowed, so I've eliminated these comments. Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/opt_function_inlining.cpp')
-rw-r--r--src/glsl/opt_function_inlining.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp
index f9f5bd44267..0733d5180d8 100644
--- a/src/glsl/opt_function_inlining.cpp
+++ b/src/glsl/opt_function_inlining.cpp
@@ -144,9 +144,9 @@ ir_call::generate_inline(ir_instruction *next_ir)
}
/* Move the actual param into our param variable if it's an 'in' type. */
- if (parameters[i] && (sig_param->mode == ir_var_in ||
+ if (parameters[i] && (sig_param->mode == ir_var_function_in ||
sig_param->mode == ir_var_const_in ||
- sig_param->mode == ir_var_inout)) {
+ sig_param->mode == ir_var_function_inout)) {
ir_assignment *assign;
assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]),
@@ -202,8 +202,8 @@ ir_call::generate_inline(ir_instruction *next_ir)
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] && (sig_param->mode == ir_var_out ||
- sig_param->mode == ir_var_inout)) {
+ if (parameters[i] && (sig_param->mode == ir_var_function_out ||
+ sig_param->mode == ir_var_function_inout)) {
ir_assignment *assign;
assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(),