mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 08:20:12 +01:00
glsl: Fix depth unbalancing problem in if-statement flattening
Previously, if max_depth were 1, the following code would see the
first if-statement (correctly) not get flattened, but the second
if-statement would (incorrectly) get flattened:
void main()
{
if (a)
gl_Position = vec4(0);
if (b)
gl_Position = vec4(1);
}
This is because the visit_leave(ir_if*) method would not decrement the
depth before returning on the first if-statement.
NOTE: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
c191c87c81
commit
d2c6cef18a
1 changed files with 1 additions and 3 deletions
|
|
@ -149,11 +149,9 @@ ir_visitor_status
|
|||
ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir)
|
||||
{
|
||||
/* Only flatten when beyond the GPU's maximum supported nesting depth. */
|
||||
if (this->depth <= this->max_depth)
|
||||
if (this->depth-- <= this->max_depth)
|
||||
return visit_continue;
|
||||
|
||||
this->depth--;
|
||||
|
||||
bool found_control_flow = false;
|
||||
ir_variable *cond_var;
|
||||
ir_assignment *assign;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue