Commit d250194
committed
VULKAN: Build display pipelines against swapchain render pass
Fixes #18761
All display-related Vulkan pipelines (font, alpha_blend, menu
shaders including ribbon/snow/bokeh) were being built against
vk->sdr_render_pass, which always uses VK_FORMAT_B8G8R8A8_UNORM.
On the non-HDR rendering path (the common case on Linux KMS,
Wayland, X11, and most platforms), the active render pass at
draw time is vk->render_pass, which uses the actual swapchain
format -- vk->context->swapchain_format. When the swapchain
format happens to be B8G8R8A8_UNORM, the pipeline/render-pass
formats match and everything works.
But on some platforms (particularly KMS on certain GPUs), the
swapchain format is VK_FORMAT_R8G8B8A8_UNORM instead. In that
case:
- Pipeline built for: B8G8R8A8_UNORM (via sdr_render_pass)
- Active render pass: R8G8B8A8_UNORM (via render_pass)
This is a render pass compatibility violation per Vulkan spec
(VUID-vkCmdDraw-renderPass-02684). The result is driver-
dependent: RADV on AMD typically segfaults, NVIDIA may silently
produce wrong output, Intel may report a validation error.
The crash manifests as a segfault when any menu shader pipeline
is active (ribbon, simple ribbon, snow, bokeh, snowflake) and
the user navigates the XMB Quick Menu -- any draw that uses the
menu pipeline triggers the incompatible render pass.
Fix: build all display pipelines against vk->render_pass
(the swapchain render pass) instead of vk->sdr_render_pass.
This ensures the pipelines match the active render pass on
the non-HDR path regardless of swapchain format.
Two changes:
1. Line 3372: Initial pipe.renderPass assignment changed from
vk->sdr_render_pass to vk->render_pass. This affects the
font pipeline, alpha_blend pipeline, and display pipelines
0-3.
2. After the #ifdef VULKAN_HDR_SWAPCHAIN block (which
temporarily changes pipe.renderPass to readback_render_pass
and sdr_render_pass for HDR-specific pipelines), restore
pipe.renderPass to vk->render_pass before building the menu
shader pipelines (indices 6+). Without this, HDR builds
would leave pipe.renderPass pointing at sdr_render_pass,
defeating the fix.
Impact on HDR: the HDR compositing path renders menu content
into an offscreen B8G8R8A8 buffer using sdr_render_pass
(line 6523). When the swapchain format differs from B8G8R8A8,
the menu pipelines built against render_pass would be
incompatible with sdr_render_pass in this path. However:
- HDR display pipelines (indices 4-5) are built separately
against render_pass at line 3470, which is correct.
- The HDR menu compositing path uses the standard alpha_blend
pipeline for the menu texture overlay (line 6563), which
now matches render_pass.
- The HDR offscreen compositing step at line 6523 is a
separate render pass instance that doesn't use the menu
shader pipelines (ribbon/snow/bokeh are drawn earlier in
the frame).
No behavioural change when swapchain format is B8G8R8A8_UNORM
(the common case on X11/Wayland with NVIDIA and Intel), because
both render passes have the same format and are therefore
compatible.1 parent b762cd1 commit d250194
1 file changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3369 | 3369 | | |
3370 | 3370 | | |
3371 | 3371 | | |
3372 | | - | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
3373 | 3399 | | |
3374 | 3400 | | |
3375 | 3401 | | |
| |||
3478 | 3504 | | |
3479 | 3505 | | |
3480 | 3506 | | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
3481 | 3513 | | |
3482 | 3514 | | |
3483 | 3515 | | |
| |||
0 commit comments