diff options
-rw-r--r-- | ast_to_hir.cpp | 9 | ||||
-rw-r--r-- | ir.h | 6 | ||||
-rw-r--r-- | ir_variable.cpp | 20 |
3 files changed, 33 insertions, 2 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 83dac584b2..316bcf7d71 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1446,6 +1446,15 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, else var->mode = ir_var_auto; + if (qual->uniform) + var->shader_in = true; + if (qual->varying) { + if (qual->in) + var->shader_in = true; + if (qual->out) + var->shader_out = true; + } + if (qual->flat) var->interpolation = ir_var_flat; else if (qual->noperspective) @@ -151,6 +151,12 @@ public: unsigned read_only:1; unsigned centroid:1; unsigned invariant:1; + /** If the variable is initialized outside of the scope of the shader */ + unsigned shader_in:1; + /** + * If the variable value is later used outside of the scope of the shader. + */ + unsigned shader_out:1; unsigned mode:3; unsigned interpolation:2; 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. |