From 7f1defa5efd5b7a12361633b2b3a6af65f1bc376 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Wed, 20 May 2026 10:17:48 -0700 Subject: [PATCH] brw/rt: Commit hit even if we are skipping closest hit shader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not about the memory traffic but updating the Tmax value/distance so that on next intersection, we would be comparing the updated Tmax value/distance instead of original distance. Signed-off-by: Sagar Ghuge Reviewed-by: Iván Briano Part-of: --- src/intel/compiler/brw/brw_nir_rt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/intel/compiler/brw/brw_nir_rt.c b/src/intel/compiler/brw/brw_nir_rt.c index 43da59f2438..1c94b65ad5b 100644 --- a/src/intel/compiler/brw/brw_nir_rt.c +++ b/src/intel/compiler/brw/brw_nir_rt.c @@ -207,13 +207,13 @@ build_terminate_ray(nir_builder *b) { nir_def *skip_closest_hit = nir_test_mask(b, nir_load_ray_flags(b), BRW_RT_RAY_FLAG_SKIP_CLOSEST_HIT_SHADER); + + brw_nir_rt_commit_hit(b); nir_push_if(b, skip_closest_hit); { /* The shader that calls traceRay() is unable to access any ray hit * information except for that which is explicitly written into the ray - * payload by shaders invoked during the trace. If there's no closest- - * hit shader, then accepting the hit has no observable effect; it's - * just extra memory traffic for no reason. + * payload by shaders invoked during the trace. */ brw_nir_btd_return(b); nir_jump(b, nir_jump_halt); @@ -230,7 +230,6 @@ build_terminate_ray(nir_builder *b) nir_iadd_imm(b, nir_load_shader_record_ptr(b), -BRW_RT_SBT_HANDLE_SIZE); - brw_nir_rt_commit_hit(b); brw_nir_btd_spawn(b, closest_hit); nir_jump(b, nir_jump_halt); }