diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index a5739cf2648..bc46e92a7a1 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -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(); diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 4100602d8c4..ef891296bd7 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -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); diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index eab911f9925..701386ab886 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -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; }; diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index a50481b9553..b52b1635c8a 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -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; }