Skip to content

Commit

Permalink
radv/rt: Remove nir_intrinsic_execute_callable instrs in monolithic mode
Browse files Browse the repository at this point in the history
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
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32613>
(cherry picked from commit 0c02a7e)
  • Loading branch information
pixelcluster authored and hakzsam committed Dec 13, 2024
1 parent f55f336 commit 4f92f8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pick_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,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
Expand Down
7 changes: 6 additions & 1 deletion src/amd/vulkan/nir/radv_nir_rt_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit 4f92f8f

Please sign in to comment.