From e99b57ae5be6b26d04d64a2b96ec6e1beef1abf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 11 Feb 2026 11:55:26 +0100 Subject: [PATCH] tu/rt: add and lower loop continue construct in traversal shaders We are going to disallow continue statements without loop continue constructs. Reviewed-by: Alyssa Rosenzweig Reviewed-by: Georg Lehmann Reviewed-by: Faith Ekstrand Part-of: --- src/freedreno/vulkan/tu_nir_lower_ray_query.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/freedreno/vulkan/tu_nir_lower_ray_query.cc b/src/freedreno/vulkan/tu_nir_lower_ray_query.cc index 28f27a0e474..97657ba33ed 100644 --- a/src/freedreno/vulkan/tu_nir_lower_ray_query.cc +++ b/src/freedreno/vulkan/tu_nir_lower_ray_query.cc @@ -10,6 +10,7 @@ #include "compiler/spirv/spirv.h" #include "nir_builder.h" +#include "nir_control_flow.h" #include "nir_deref.h" enum rq_intersection_var_index { @@ -560,8 +561,10 @@ build_ray_traversal(nir_builder *b, nir_deref_instr *rq, nir_variable *incomplete = nir_local_variable_create(b->impl, glsl_bool_type(), "incomplete"); nir_store_var(b, incomplete, nir_imm_true(b), 0x1); - nir_push_loop(b); + nir_loop *loop = nir_push_loop(b); { + nir_loop_add_continue_construct(loop); + /* Go up the stack if current_node == VK_BVH_INVALID_NODE */ nir_push_if(b, nir_ieq_imm(b, rq_load(b, rq, current_node), VK_BVH_INVALID_NODE)); { @@ -928,7 +931,7 @@ build_ray_traversal(nir_builder *b, nir_deref_instr *rq, } nir_pop_if(b, NULL); } - nir_pop_loop(b, NULL); + nir_pop_loop(b, loop); return nir_load_var(b, incomplete); } @@ -1035,6 +1038,9 @@ tu_nir_lower_ray_queries(nir_shader *shader) ralloc_free(query_ht); + if (progress) + nir_lower_continue_constructs(shader); + return progress; }