Skip to content

Commit f38f216

Browse files
committed
VULKAN/HDR: Fix crash when statistics overlay is shown over HDR + custom shader
When HDR is enabled and the active shader chain doesn't emit HDR natively, vulkan_frame() routes overlay-style content (menu, on-screen messages, widgets, software overlays) through an offscreen SDR buffer, then composites it back over the HDR swapchain image. The gating condition for that detour listed every overlay source except the statistics overlay. The result: with HDR on, a non-HDR-emitting shader chain loaded, and the statistics overlay enabled (with no menu/message/widget visible), the main render pass was ended after the HDR composite but never re-begun. The subsequent font_driver_render_msg() call for the stat text recorded draw commands against a command buffer with no active render pass. Most desktop Vulkan drivers tolerate this with a validation error; MoltenVK on macOS dereferences a null subpass in MVKCommandEncoder::getSubpass() during vkCmdDrawIndexed encoding and crashes with SIGSEGV. The HDR-native shaders under slang_shaders/hdr were unaffected because they avoid the offscreen-buffer detour entirely (use_offscreen_buffer stays false when the chain emits HDR10 or HDR16). Add statistics_show to both gating conditions so the begin-redirect and the matching post-blit composite stay balanced.
1 parent a38a638 commit f38f216

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

gfx/drivers/vulkan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6744,6 +6744,7 @@ static bool vulkan_frame(void *data, const void *frame,
67446744
if ((vk->context->flags & VK_CTX_FLAG_HDR_ENABLE) &&
67456745
((vk->flags & VK_FLAG_MENU_ENABLE) || (vk->flags & VK_FLAG_OVERLAY_ENABLE)
67466746
|| message_visible
6747+
|| statistics_show
67476748
#ifdef HAVE_GFX_WIDGETS
67486749
|| widgets_visible
67496750
#endif
@@ -6858,6 +6859,7 @@ static bool vulkan_frame(void *data, const void *frame,
68586859
if ((vk->context->flags & VK_CTX_FLAG_HDR_ENABLE) &&
68596860
((vk->flags & VK_FLAG_MENU_ENABLE) || (vk->flags & VK_FLAG_OVERLAY_ENABLE)
68606861
|| message_visible
6862+
|| statistics_show
68616863
#ifdef HAVE_GFX_WIDGETS
68626864
|| widgets_visible
68636865
#endif

0 commit comments

Comments
 (0)