Commit 9efc73f
committed
VULKAN: Fix shader module lifetime bugs in SDR pipeline creation
Fixes startup crash on Windows Vulkan introduced by 8fa8418.
Two bugs in the SDR pipeline creation path when HDR is supported:
1. SDR display pipelines 0-3 were created after the alpha_blend
fragment shader module had already been destroyed. The
alpha_blend_sdr pipeline was created, then the fragment
shader module was immediately destroyed (line 3692 in the
original patch). The subsequent display pipeline loop
(pipelines_sdr[0..3]) still referenced that destroyed module
through the pipe struct, producing an invalid VkShaderModule
handle passed to vkCreateGraphicsPipelines.
Fix: keep both the vertex and fragment shader modules alive
through the display 0-3 loop, then destroy both afterward.
2. After the SDR menu shader loop (pipelines_sdr[6+]), an extra
vkDestroyShaderModule call destroyed shader_stages[0].module
which had already been destroyed in the loop's last iteration
at line 3782. Double-free on a VkShaderModule handle.
Fix: remove the spurious destroy after the loop.
Both bugs only manifest when VK_CTX_FLAG_HDR_SUPPORT is set
(Windows with HDR-capable displays, or any platform where the
Vulkan driver reports HDR swapchain support). Non-HDR paths
are unaffected because the entire SDR pipeline block is guarded
by the HDR support check.1 parent 8fa8418 commit 9efc73f
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3689 | 3689 | | |
3690 | 3690 | | |
3691 | 3691 | | |
3692 | | - | |
3693 | 3692 | | |
3694 | | - | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
3695 | 3697 | | |
3696 | 3698 | | |
3697 | 3699 | | |
| |||
3702 | 3704 | | |
3703 | 3705 | | |
3704 | 3706 | | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
3705 | 3711 | | |
3706 | 3712 | | |
3707 | 3713 | | |
| |||
3782 | 3788 | | |
3783 | 3789 | | |
3784 | 3790 | | |
3785 | | - | |
3786 | | - | |
3787 | 3791 | | |
3788 | 3792 | | |
3789 | 3793 | | |
| |||
0 commit comments