glsl_to_nir: set nir_loop::do_while

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40349>
This commit is contained in:
Daniel Schürmann 2026-03-11 11:36:23 +01:00 committed by Marge Bot
parent 42663165a2
commit a9a2edfbb6
4 changed files with 8 additions and 1 deletions

View file

@ -7415,8 +7415,10 @@ ast_iteration_statement::hir(ir_exec_list *instructions,
state->symbols->pop_scope();
}
if (mode == ast_do_while)
if (mode == ast_do_while) {
condition_to_hir(&stmt->continue_instructions, state);
stmt->do_while = true;
}
if (mode != ast_do_while)
state->symbols->pop_scope();

View file

@ -790,6 +790,7 @@ void
nir_visitor::visit(ir_loop *ir)
{
nir_loop *loop = nir_push_loop(&b);
loop->do_while = ir->do_while;
nir_loop_add_continue_construct(loop);
visit_exec_list(&ir->body_instructions, this);
nir_push_continue(&b, loop);

View file

@ -1468,6 +1468,8 @@ public:
ir_exec_list body_instructions;
/** List of ir_instruction that make up the continue construct. */
ir_exec_list continue_instructions;
/** Whether the loop is in do-while form. */
bool do_while;
};

View file

@ -144,6 +144,8 @@ ir_loop::clone(linear_ctx *linalloc, struct hash_table *ht) const
new_loop->continue_instructions.push_tail(ir->clone(linalloc, ht));
}
new_loop->do_while = this->do_while;
return new_loop;
}