radv/rt: Remove nir_intrinsic_execute_callable instrs in monolithic mode

It's allowed to place OpExecuteCallableKHR in a SPIR-V, even if the RT
pipeline doesn't contain any callable shaders. Unreal hits this case and
crashes. We can assume the intrinsic never gets executed, so we can
simply remove it.

Cc: mesa-stable
(cherry picked from commit 0c02a7e8e8)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32730>
This commit is contained in:
Friedrich Vock 2024-12-12 18:03:17 +01:00 committed by Dylan Baker
parent fa6e9e6587
commit 8135a7614d
2 changed files with 7 additions and 2 deletions

View file

@ -334,7 +334,7 @@
"description": "radv/rt: Remove nir_intrinsic_execute_callable instrs in monolithic mode",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1772,7 +1772,12 @@ lower_rt_instruction_monolithic(nir_builder *b, nir_instr *instr, void *data)
switch (intr->intrinsic) {
case nir_intrinsic_execute_callable:
unreachable("nir_intrinsic_execute_callable");
/* It's allowed to place OpExecuteCallableKHR in a SPIR-V, even if the RT pipeline doesn't contain
* any callable shaders. However, it's impossible to execute the instruction in a valid way, so just remove any
* nir_intrinsic_execute_callable we encounter.
*/
nir_instr_remove(instr);
return true;
case nir_intrinsic_trace_ray: {
vars->payload_offset = nir_src_as_uint(intr->src[10]);