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.
This commit is contained in:
Eric Anholt
2010-04-19 11:10:37 -07:00
parent 484606610e
commit 71df19f5ef
3 changed files with 33 additions and 2 deletions
+18 -2
View File
@@ -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.