radv: fix a GPU hang with PS epilogs and secondary command buffers

If the secondary changes the fragment output state and if the same
PS epilog used before ExecuteCommands() is re-bind immediately after
that call, the PS epilog state wouldn't be re-emitted.

Apply the same change for VS prologs, although the logic is slightly
different and the bug shouldn't occur. The whole logic of secondaries
should be completely rewritten because it's definitely not robust.

This fixes a GPU hang in Where Winds Meet, see
https://github.com/doitsujin/dxvk/issues/5436.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 1a00587c44)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
Samuel Pitoiset 2026-03-04 15:14:23 +01:00 committed by Eric Engestrom
parent 2b6e7f0be2
commit f858d2238e
2 changed files with 4 additions and 1 deletions

View file

@ -1414,7 +1414,7 @@
"description": "radv: fix a GPU hang with PS epilogs and secondary command buffers",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -9780,6 +9780,9 @@ radv_CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCou
primary->state.emitted_compute_pipeline = secondary->state.emitted_compute_pipeline;
primary->state.emitted_rt_pipeline = secondary->state.emitted_rt_pipeline;
primary->state.ps_epilog = secondary->state.ps_epilog;
primary->state.emitted_vs_prolog = secondary->state.emitted_vs_prolog;
if (secondary->state.last_ia_multi_vgt_param) {
primary->state.last_ia_multi_vgt_param = secondary->state.last_ia_multi_vgt_param;
}