graphics: convert HDR10 video-out output to SDR #2003
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2003
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2003/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Xx-LiDAF-xX on GitHub · 2026-10-30 19:39 UTC · original
Xx-LiDAF-xX:fix/hdr10-to-sdr-presentation→main· +243 −32 · 6 files · 1 commits · merged 2026-10-31 03:26 UTCProblem
With
--hdr, games see HDR support throughsceVideoOutGetDeviceCapabilityand start submitting BT.2100 PQ video-out buffers. But the swapchain only becomes an HDR10 swapchain when the surface advertises aVK_COLOR_SPACE_HDR10_ST2084_EXTformat; when HDR is disabled in the OS, or the display is SDR, it stays an 8-bit sRGB swapchain and the PQ pixels were blitted to it unchanged. The image is washed out and desaturated, and the code only printed a warning saying that HDR-to-SDR conversion was not implemented. Only the SDR -> HDR10 direction existed.Fix
gpu_video_out_overlay.frag: addHdr10ToSdr()- the ST 2084 PQ EOTF, a BT.2087 Rec.2020 -> Rec.709 matrix scaled to the 203 cd/m^2 BT.2408 HDR reference white, an extended Reinhard highlight roll-off above a 0.75 knee, and sRGB encoding. Also addLinearToSrgb()for linear float SDR sources, and anIS_OVERLAYflag so only overlay layers are alpha-blended while the source pass runs opaque.swapchain.cpp: split presentation into a non-blended source pipeline and the existing blended overlay pipeline. The source is drawn through the shader whenever its HDR-ness or format does not match the swapchain, instead of being blitted, with the color-attachment barriers that path needs.videoOut.cpp: drop the now-obsolete "HDR-to-SDR conversion is not implemented" warning.SdrToHdr10()is untouched, including its existing 250-nit white point, so the SDR -> HDR10 path is unchanged.Testing
Windows / Vulkan,
PPSA01411:--hdrwith an HDR10 surface available: still takes theHDR10 (PQ)passthrough path.HDR10 surface unavailable; using SDR output, the shader conversion path runs, output looks correct, and no validation errors are reported.@coderabbitai[bot] on GitHub · 2026-10-30 19:43 UTC · original
No actionable comments were generated in the recent review.
de6e2f55-06d6-4e2d-b390-6bf62bc42cb1Reviewing files that changed from the base of the PR and between
4919fdb6e6and ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72.src/graphics/host_gpu/shaders/gpu_video_out_overlay.fragsrc/graphics/presentation/videoOut.cppsrc/graphics/presentation/window/swapchain.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
The shader adds HDR10-to-SDR and linear-to-sRGB conversions, with flag-based handling for source color space, target mode, and overlay alpha. Swapchain presentation adds separate source and overlay pipelines. It selects shader rendering or transfer blitting for source frames, composites overlays, and transitions the image to presentation. The HDR-without-support warning is removed.
Suggested reviewers:
nmzik,pcniado,shadowbeat070Priority:
Normal
Change: Bug fix
Merge Risk:
Minimal · up to
ea3cbThis change converts HDR10 video-out frames to SDR when the swapchain cannot present HDR, which fixes the washed-out output. No merge-blocking risk was found in the supplied context.
Pre-merge checks:
5
Full details: Title check
Explanation
The title "graphics: convert HDR10 video-out output to SDR" matches the main change: the PR adds an HDR10/PQ-to-SDR conversion path in the video-out shader and swapchain presentation, and removes the obsolete warning. It is specific and concise, and a teammate scanning history would understand the primary change.
Full details: Description check
Explanation
The description states the problem (PQ video-out buffers presented unchanged on an SDR swapchain, producing washed-out output) and the fix (a Hdr10ToSdr shader function, a split swapchain source/overlay pipeline, and removal of the warning). It also includes testing details. It is directly related to the changeset.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 2 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.