graphics: convert HDR10 video-out output to SDR #2003

Manually merged
github merged 1 commit from gh-pr/2003/head into gh-pr/2003/base 2026-11-26 10:11:01 +00:00
Owner

@⁠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 UTC

Problem

With --hdr, games see HDR support through sceVideoOutGetDeviceCapability and start submitting BT.2100 PQ video-out buffers. But the swapchain only becomes an HDR10 swapchain when the surface advertises a VK_COLOR_SPACE_HDR10_ST2084_EXT format; 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: add Hdr10ToSdr() - 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 add LinearToSrgb() for linear float SDR sources, and an IS_OVERLAY flag 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:

  • SDR output, 60 s run: unchanged presentation, no validation errors.
  • --hdr with an HDR10 surface available: still takes the HDR10 (PQ) passthrough path.
  • PQ source on an SDR swapchain: verified by temporarily forcing the video-out capability to report HDR while the swapchain falls back to SDR. Presentation logs HDR10 surface unavailable; using SDR output, the shader conversion path runs, output looks correct, and no validation errors are reported.
**@⁠Xx-LiDAF-xX** on GitHub · 2026-10-30 19:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2003) `Xx-LiDAF-xX:fix/hdr10-to-sdr-presentation` → `main` · +243 −32 · 6 files · 1 commits · merged 2026-10-31 03:26 UTC ## Problem With `--hdr`, games see HDR support through `sceVideoOutGetDeviceCapability` and start submitting BT.2100 PQ video-out buffers. But the swapchain only becomes an HDR10 swapchain when the surface advertises a `VK_COLOR_SPACE_HDR10_ST2084_EXT` format; 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`: add `Hdr10ToSdr()` - 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 add `LinearToSrgb()` for linear float SDR sources, and an `IS_OVERLAY` flag 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`: - SDR output, 60 s run: unchanged presentation, no validation errors. - `--hdr` with an HDR10 surface available: still takes the `HDR10 (PQ)` passthrough path. - PQ source on an SDR swapchain: verified by temporarily forcing the video-out capability to report HDR while the swapchain falls back to SDR. Presentation logs `HDR10 surface unavailable; using SDR output`, the shader conversion path runs, output looks correct, and no validation errors are reported.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:10:59 +00:00
github manually merged commit dccd036adb into gh-pr/2003/base 2026-11-26 10:11:01 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-30 19:43 UTC · original

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4919fdb6e6 and ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72.

Files selected for processing: 3
  • src/graphics/host_gpu/shaders/gpu_video_out_overlay.frag
  • src/graphics/presentation/videoOut.cpp
  • src/graphics/presentation/window/swapchain.cpp

Included 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, shadowbeat070

Priority: Normal

Change: Bug fix

Merge Risk: Minimal · up to ea3cb

This 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: Passed 5
Check name Status Explanation
Title check Passed 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 …
Description check Passed 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/overl…
Docstring Coverage Passed 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. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-30 19:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2003#issuecomment-6532022774) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2003?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/4919fdb6e6e28f46f1f5df8cf931a7a0823cb93f/.coderabbit.yaml>) - **Commit**: [4919fdb](<https://github.com/KytyPS5/KytyPS5/commit/4919fdb6e6e28f46f1f5df8cf931a7a0823cb93f>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `de6e2f55-06d6-4e2d-b390-6bf62bc42cb1` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 4919fdb6e6e28f46f1f5df8cf931a7a0823cb93f and ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary> <dl> <dd> * `src/graphics/host_gpu/shaders/gpu_video_out_overlay.frag` * `src/graphics/presentation/videoOut.cpp` * `src/graphics/presentation/window/swapchain.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> 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`, `shadowbeat070` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <strong>Priority: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/priority-normal-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Normal</strong> <!-- change_assessment_commit:"ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>ea3cb</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `ea3cb` --> <!-- final_review_risk_coverage:{"sourceCommitId":"ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72","coveredCommitId":"ea3cb06baa5cf6e50e2d7bdf0bc84049382e6e72","kind":"reviewed"} --> This 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. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 5</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | 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 … | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | 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/overl… | | Docstring Coverage | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | 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. Documentat… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> **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. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> **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. </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **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.) </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2003)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.