Force sRGB Vulkan swapchain on macOS to fix washed out colors

This commit is contained in:
Cameron Gutman
2026-06-23 19:19:56 -05:00
parent faa39875b6
commit 06bd8a730b
+13 -1
View File
@@ -897,7 +897,19 @@ void PlVkRenderer::renderFrame(AVFrame *frame)
if (!pl_color_space_equal(&mappedFrame.color, &m_LastColorspace)) {
m_LastColorspace = mappedFrame.color;
SDL_assert(pl_color_space_equal(&mappedFrame.color, &m_LastColorspace));
pl_swapchain_colorspace_hint(m_Swapchain, &mappedFrame.color);
#ifdef Q_OS_DARWIN
// There is a gamma mismatch on macOS between what libplacebo thinks BT.709
// should use and what the Metal layer actually displays. Use sRGB for the
// swapchain when the incoming frames are BT.709 as a workaround.
if (pl_color_space_equal(&mappedFrame.color, &pl_color_space_bt709)) {
pl_swapchain_colorspace_hint(m_Swapchain, &pl_color_space_srgb);
}
else
#endif
{
pl_swapchain_colorspace_hint(m_Swapchain, &mappedFrame.color);
}
}
// Reserve enough space to avoid allocating under the overlay lock