summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-04 20:33:57 -0700
committerEric Anholt <[email protected]>2010-08-04 20:52:33 -0700
commit046bef235744e891e4a48076e1a3ff9a61a63092 (patch)
tree1ddd953a9e7ec14e1726d16011985910e372742a /src/glsl/ast_to_hir.cpp
parenta08f27940ac72538ce0b264917207111d629f097 (diff)
glsl2: Remove the shader_in/shader_out tracking separate from var->mode.
I introduced this for ir_dead_code to distinguish function parameter outvals from varying outputs. Only, since ast_to_hir's current_function is unset when setting up function parameters (they're needed for making the function signature in the first place), all function parameter outvals were marked as shader outputs anyway. This meant that an inlined function's cloned outval was marked as a shader output and couldn't be dead-code eliminated. Instead, since ir_dead_code doesn't even look at function parameters, just use var->mode. The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from 725 instructions to 636.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 14c528075bb..292c7be6217 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1510,31 +1510,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
else if (qual->uniform)
var->mode = ir_var_uniform;
- if (qual->uniform)
- var->shader_in = true;
-
- /* Any 'in' or 'inout' variables at global scope must be marked as being
- * shader inputs. Likewise, any 'out' or 'inout' variables at global scope
- * must be marked as being shader outputs.
- */
- if (state->current_function == NULL) {
- switch (var->mode) {
- case ir_var_in:
- case ir_var_uniform:
- var->shader_in = true;
- break;
- case ir_var_out:
- var->shader_out = true;
- break;
- case ir_var_inout:
- var->shader_in = true;
- var->shader_out = true;
- break;
- default:
- break;
- }
- }
-
if (qual->flat)
var->interpolation = ir_var_flat;
else if (qual->noperspective)
@@ -1702,11 +1677,19 @@ ast_declarator_list::hir(exec_list *instructions,
& loc);
if (this->type->qualifier.invariant) {
- if ((state->target == vertex_shader) && !var->shader_out) {
+ if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
+ var->mode == ir_var_inout)) {
+ /* FINISHME: Note that this doesn't work for invariant on
+ * a function signature outval
+ */
_mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, vertex shader "
"outputs only\n", var->name);
- } else if ((state->target == fragment_shader) && !var->shader_in) {
+ } else if ((state->target == fragment_shader) &&
+ !(var->mode == ir_var_in || var->mode == ir_var_inout)) {
+ /* FINISHME: Note that this doesn't work for invariant on
+ * a function signature inval
+ */
_mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, fragment shader "
"inputs only\n", var->name);