summaryrefslogtreecommitdiff
path: root/ir_variable.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-19 11:10:37 -0700
committerEric Anholt <eric@anholt.net>2010-04-19 11:13:20 -0700
commit71df19f5ef6e78beb5160801f81468184b75447e (patch)
tree3b481c4db98510f0fa0c0b0c8d307621b09fc609 /ir_variable.cpp
parent484606610e36ec7598f7733e9787d888b6a63d64 (diff)
Mark some variables as having usage beyond the shader's scope.
This will be important to optimization passes. We don't want to dead-code eliminate writes to out varyings, or propagate uninitialized values of uniforms.
Diffstat (limited to 'ir_variable.cpp')
-rw-r--r--ir_variable.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/ir_variable.cpp b/ir_variable.cpp
index 76a528ca2b..12992a9b81 100644
--- a/ir_variable.cpp
+++ b/ir_variable.cpp
@@ -38,9 +38,25 @@ add_variable(const char *name, enum ir_variable_mode mode,
ir_variable *var = new ir_variable(type, name);
var->mode = mode;
- if (var->mode != ir_var_out)
+ switch (var->mode) {
+ case ir_var_in:
+ var->shader_in = true;
var->read_only = true;
-
+ break;
+ case ir_var_inout:
+ var->shader_in = true;
+ var->shader_out = true;
+ case ir_var_out:
+ var->shader_out = true;
+ break;
+ case ir_var_uniform:
+ var->shader_in = true;
+ var->read_only = true;
+ break;
+ default:
+ assert(0);
+ break;
+ }
/* Once the variable is created an initialized, add it to the symbol table
* and add the declaration to the IR stream.