diff options
author | marha <marha@users.sourceforge.net> | 2012-04-10 10:49:59 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-10 10:49:59 +0200 |
commit | c6f80401dc533b04341afe8d596960d1bc25efce (patch) | |
tree | 2826007946218a8370d2eebc6aa32083618e2bfe /mesalib/src/glsl/loop_analysis.cpp | |
parent | 31706e67674f308e3e7f2a8aaf02f1e0a00fbade (diff) | |
download | vcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.tar.gz vcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.tar.bz2 vcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.zip |
fontconfig mesa xkeyboard-config xserver pixman git update 10 Apr 2012
Diffstat (limited to 'mesalib/src/glsl/loop_analysis.cpp')
-rw-r--r-- | mesalib/src/glsl/loop_analysis.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mesalib/src/glsl/loop_analysis.cpp b/mesalib/src/glsl/loop_analysis.cpp index 9bba6a97c..6a0e4da51 100644 --- a/mesalib/src/glsl/loop_analysis.cpp +++ b/mesalib/src/glsl/loop_analysis.cpp @@ -110,6 +110,8 @@ public: virtual ir_visitor_status visit(ir_loop_jump *); virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_loop *); virtual ir_visitor_status visit_leave(ir_loop *); virtual ir_visitor_status visit_enter(ir_assignment *); @@ -153,6 +155,21 @@ loop_analysis::visit(ir_loop_jump *ir) ir_visitor_status +loop_analysis::visit_enter(ir_call *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. */ + if (this->state.is_empty()) + return visit_continue; + + loop_variable_state *const ls = + (loop_variable_state *) this->state.get_head(); + + ls->contains_calls = true; + return visit_continue_with_parent; +} + + +ir_visitor_status loop_analysis::visit(ir_dereference_variable *ir) { /* If we're not somewhere inside a loop, there's nothing to do. @@ -209,6 +226,17 @@ loop_analysis::visit_leave(ir_loop *ir) loop_variable_state *const ls = (loop_variable_state *) this->state.pop_head(); + /* Function calls may contain side effects. These could alter any of our + * variables in ways that cannot be known, and may even terminate shader + * execution (say, calling discard in the fragment shader). So we can't + * rely on any of our analysis about assignments to variables. + * + * We could perform some conservative analysis (prove there's no statically + * possible assignment, etc.) but it isn't worth it for now; function + * inlining will allow us to unroll loops anyway. + */ + if (ls->contains_calls) + return visit_continue; foreach_list(node, &ir->body_instructions) { /* Skip over declarations at the start of a loop. |