brw/rt: Commit hit even if we are skipping closest hit shader

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 <sagar.ghuge@intel.com>
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41709>
This commit is contained in:
Sagar Ghuge 2026-05-20 10:17:48 -07:00 committed by Marge Bot
parent 17f7e7f96b
commit 7f1defa5ef

View file

@ -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);
}