From a9ad04825290d9d6f624d37c1a9f9dc7a31ef64a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 14 Jun 2026 18:58:22 -0500 Subject: [PATCH] Fix HDR rendering in libplacebo on macOS --- app/streaming/video/ffmpeg-renderers/plvk.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/plvk.cpp b/app/streaming/video/ffmpeg-renderers/plvk.cpp index 530adefb..15c15929 100644 --- a/app/streaming/video/ffmpeg-renderers/plvk.cpp +++ b/app/streaming/video/ffmpeg-renderers/plvk.cpp @@ -607,6 +607,16 @@ bool PlVkRenderer::initialize(PDECODER_PARAMETERS params) #ifdef Q_OS_DARWIN m_MetalTextureFactory = std::make_unique(m_Vulkan); + + // Set an initial wide colorspace hint to ensure that MoltenVK sets wantsExtendedDynamicRangeContent + // before we request the first drawable. If we don't do this, our Metal layer ends up stuck in SDR + // mode even if we later change the colorspace to VK_COLOR_SPACE_HDR10_ST2084_EXT. + if (params->videoFormat & VIDEO_FORMAT_MASK_10BIT) { + pl_color_space wideColorspace = {}; + wideColorspace.primaries = PL_COLOR_PRIM_BT_709; + wideColorspace.transfer = PL_COLOR_TRC_SCRGB; + pl_swapchain_colorspace_hint(m_Swapchain, &wideColorspace); + } #endif return true;