You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VULKAN: Build SDR display pipeline set for HDR offscreen compositing
Follow-up to d250194 (build display pipelines against swapchain
render pass). That commit fixed the KMS crash (#18761) by
building all display/menu pipelines against vk->render_pass
(the swapchain format) instead of vk->sdr_render_pass
(hardcoded B8G8R8A8_UNORM). This was correct for the non-HDR
path but left a gap in the HDR offscreen compositing path.
When HDR is active, the menu is rendered into a B8G8R8A8
offscreen buffer under sdr_render_pass, then composited onto
the HDR swapchain. If the swapchain format differs from
B8G8R8A8 (which is the common HDR case -- the swapchain uses
a wide-gamut format like R16G16B16A16_SFLOAT or
A2B10G10R10_UNORM), the main pipeline set (built against
render_pass) is incompatible with sdr_render_pass. Using
those pipelines in the HDR offscreen render pass would be the
same class of render-pass compatibility violation that d250194
fixed for the non-HDR path.
Fix: when VK_CTX_FLAG_HDR_SUPPORT is set, build a parallel set
of display/menu pipelines against sdr_render_pass. At runtime,
switch to the SDR pipeline variants while rendering into the
HDR offscreen buffer, and switch back when the render pass ends.
New storage:
- vk->pipelines.font_sdr
- vk->pipelines.alpha_blend_sdr
- vk->display.pipelines_sdr[9 * 2]
These are created alongside the existing pipeline set during
vulkan_init_pipelines, using identical shader modules and
pipeline state -- only pipe.renderPass differs. Destroyed
in vulkan_deinit_pipelines.
Runtime switching via VK_FLAG_SDR_PIPELINE (new flag, bit 16):
- Set after vkCmdBeginRenderPass with sdr_render_pass on the
HDR offscreen compositing path
- Cleared before vkCmdEndRenderPass
- Checked in four draw paths:
* gfx_display_vk_draw menu shader case (ribbon/snow/bokeh)
* gfx_display_vk_draw default case (display quads)
* vulkan_raster_font_render_msg (font pipeline)
* vulkan_frame menu texture overlay (alpha_blend pipeline)
Non-HDR builds: all SDR pipeline code is #ifdef
VULKAN_HDR_SWAPCHAIN guarded. Zero impact on builds without
HDR support.
Non-HDR runtime: VK_FLAG_SDR_PIPELINE is never set. All draw
paths use the main pipeline set unconditionally. Zero overhead.
HDR with B8G8R8A8 swapchain (unusual but possible):
render_pass and sdr_render_pass have the same format, so both
pipeline sets are identical. No visual difference, small extra
memory for the duplicate pipelines.
Cost: 18 additional VkPipeline objects + 2 named pipelines when
HDR is supported. One-time creation cost at driver init.
Runtime cost is one flag check per draw call on HDR paths only.
0 commit comments