radv/rt: Pre-initialize instance address

It's not disallowed by spec to load instance-related data in case of a
miss where no instance was ever visited. Such loads make no sense, so we
can return garbage, but it mustn't hang the GPU. Initialize the instance
addresses to the TLAS base to make sure we always have valid memory to load from.

Partially fixes GPU hangs in RTX Remix games.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24971>
This commit is contained in:
Friedrich Vock
2023-08-31 15:34:58 +02:00
committed by Marge Bot
parent 9b87912f62
commit 728f6c0b70
@@ -356,6 +356,10 @@ lower_rq_initialize(nir_builder *b, nir_def *index, nir_intrinsic_instr *instr,
nir_def *accel_struct = instr->src[1].ssa;
/* Make sure that instance data loads don't hang in case of a miss by setting a valid initial address. */
rq_store_var(b, index, vars->closest.instance_addr, accel_struct, 1);
rq_store_var(b, index, vars->candidate.instance_addr, accel_struct, 1);
nir_def *bvh_offset = nir_build_load_global(
b, 1, 32, nir_iadd_imm(b, accel_struct, offsetof(struct radv_accel_struct_header, bvh_offset)),
.access = ACCESS_NON_WRITEABLE);