[PR #3152] [MERGED] HDR: screenshots get an HDR10 copy, as a PNG tagged BT.2020 with PQ #4824

Closed
opened 2026-11-03 05:08:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3152
Author: @senjinthedragon
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: hdr-screenshot


📝 Commits (4)

  • c7b02f8 HDR: screenshots get an HDR10 copy, as a PNG tagged BT.2020 with PQ
  • 9c18b4e HDR: the log says where the HDR screenshot went
  • c075240 Merge remote-tracking branch 'origin/main' into hdr-screenshot
  • 0e4f8e2 Merge main into hdr-screenshot (HDR tiers, black level, UI brightness, world icons)

📊 Changes

3 files changed (+212 additions, -58 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+98 -20)
📝 crates/horizon-client-render/src/gfx/hdr.rs (+113 -37)
📝 docs/graphics.md (+1 -1)

📄 Description

🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin.

What and why

Follows #2021, part of #1441. With HDR on, F2 saved only the SDR frame, so there was no way to keep or show what
HDR output actually looks like. Now it also writes an HDR10 copy beside vanilla's screenshot:

  • screenshots/2026-10-28_12.00.00.png: vanilla's screenshot, written exactly as before (the SDR frame the HDR
    pass starts from).
  • screenshots/2026-10-28_12.00.00-hdr.png: what HDR output sends to the display, as a 16-bit PNG tagged BT.2020
    with PQ.

How:

  • The HDR pass is drawn once more, into a 10-bit PQ target of its own (Hdr::capture, Rgb10a2Unorm) with
    its own parameter buffer. An scRGB swapchain gets an HDR10 file too, and the frame on screen is unaffected.
  • The file is tagged with PNG's third-edition cICP chunk (9, 16, 0, 1: BT.2020, PQ, RGB, full range), plus
    cLLI with the peak and paper white, the same values as the swapchain's HDR metadata. The png crate in the
    tree (0.18) writes both as raw chunks before the image data, so there's no new dependency.
  • Each 10-bit value is expanded with its top bits repeated below (c << 6 | c >> 4): 0 stays 0, 1023 becomes
    65535, and every step survives.
  • The readback is shared with the SDR writer (read_frame). An HDR file that fails is logged, and vanilla's
    screenshot and its chat message stay as they are.

Size: at 3440×1440, the HDR file was 6.7 MB beside a 4.0 MB SDR one.

How viewers show it, checked on KDE Plasma (Wayland), HDR10:

  • Chromium: correct, in HDR.
  • GIMP, Dolphin's preview: washed-out grey. They don't read cICP and take the PQ values as sRGB.
  • FireDragon (Firefox): very dark. It reads the tag but has no HDR output on Linux.

That's why the SDR file stays the one to share. An ICC profile as a fallback for programs that read ICC but not
cICP (GIMP) would be a possible follow-up. JPEG XL would give smaller files and even animation, but there's no
encoder yet that fits: the pure-Rust one is AGPL, the permissive one can't signal PQ, and the rest wrap libjxl.

Conflicts with #2705 and #3145 in gfx/hdr.rs (the HDR parameters move into one function here). Whichever lands
later, I'll rebase.

Vanilla reference

Screenshot.grab is unchanged: same file, same name, same chat message. The -hdr.png is Horizon-only and written
only while HDR output is on.

Self-check

pr_ready (tools/pr_ready.py --quick on ffc4e28bf47e, against origin/main at b6c936f82, 52 s)

Check Result
Scope ✅ 3 files, +209 −58
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 398 passed (34 s)
rustfmt ✅ (8 s)
clippy ✅
tests: horizon-client ✅ 1262 passed (8 s)
doc tests ✅ 0 passed (2 s)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

An HDR file can't be shown in this page as HDR; GitHub would show it washed out.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3152 **Author:** [@senjinthedragon](https://github.com/senjinthedragon) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hdr-screenshot` --- ### 📝 Commits (4) - [`c7b02f8`](https://github.com/horizon-rust/horizon/commit/c7b02f8568faa8ff7d7307519f56bda8db88a718) HDR: screenshots get an HDR10 copy, as a PNG tagged BT.2020 with PQ - [`9c18b4e`](https://github.com/horizon-rust/horizon/commit/9c18b4e524e5ff1de9d742a91e6fa4ab3518dfb8) HDR: the log says where the HDR screenshot went - [`c075240`](https://github.com/horizon-rust/horizon/commit/c075240fa3271853efb32b70e392944c3b27eb8b) Merge remote-tracking branch 'origin/main' into hdr-screenshot - [`0e4f8e2`](https://github.com/horizon-rust/horizon/commit/0e4f8e27990715dd9be7c25edd78bd594093a37b) Merge main into hdr-screenshot (HDR tiers, black level, UI brightness, world icons) ### 📊 Changes **3 files changed** (+212 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+98 -20) 📝 `crates/horizon-client-render/src/gfx/hdr.rs` (+113 -37) 📝 `docs/graphics.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin. ## What and why Follows #2021, part of #1441. With HDR on, F2 saved only the SDR frame, so there was no way to keep or show what HDR output actually looks like. Now it also writes an HDR10 copy beside vanilla's screenshot: - `screenshots/2026-10-28_12.00.00.png`: vanilla's screenshot, written exactly as before (the SDR frame the HDR pass starts from). - `screenshots/2026-10-28_12.00.00-hdr.png`: what HDR output sends to the display, as a 16-bit PNG tagged BT.2020 with PQ. How: - **The HDR pass is drawn once more**, into a 10-bit PQ target of its own (`Hdr::capture`, `Rgb10a2Unorm`) with its own parameter buffer. An scRGB swapchain gets an HDR10 file too, and the frame on screen is unaffected. - **The file is tagged** with PNG's third-edition `cICP` chunk (9, 16, 0, 1: BT.2020, PQ, RGB, full range), plus `cLLI` with the peak and paper white, the same values as the swapchain's HDR metadata. The `png` crate in the tree (0.18) writes both as raw chunks before the image data, so there's no new dependency. - **Each 10-bit value is expanded with its top bits repeated below** (`c << 6 | c >> 4`): 0 stays 0, 1023 becomes 65535, and every step survives. - **The readback is shared** with the SDR writer (`read_frame`). An HDR file that fails is logged, and vanilla's screenshot and its chat message stay as they are. Size: at 3440×1440, the HDR file was 6.7 MB beside a 4.0 MB SDR one. How viewers show it, checked on KDE Plasma (Wayland), HDR10: - **Chromium:** correct, in HDR. - **GIMP, Dolphin's preview:** washed-out grey. They don't read `cICP` and take the PQ values as sRGB. - **FireDragon (Firefox):** very dark. It reads the tag but has no HDR output on Linux. That's why the SDR file stays the one to share. An ICC profile as a fallback for programs that read ICC but not `cICP` (GIMP) would be a possible follow-up. JPEG XL would give smaller files and even animation, but there's no encoder yet that fits: the pure-Rust one is AGPL, the permissive one can't signal PQ, and the rest wrap libjxl. Conflicts with #2705 and #3145 in `gfx/hdr.rs` (the HDR parameters move into one function here). Whichever lands later, I'll rebase. ## Vanilla reference `Screenshot.grab` is unchanged: same file, same name, same chat message. The `-hdr.png` is Horizon-only and written only while HDR output is on. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on ffc4e28bf47e, against origin/main at b6c936f82, 52 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +209 −58 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 398 passed (34 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ | | tests: horizon-client | ✅ 1262 passed (8 s) | | doc tests | ✅ 0 passed (2 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots An HDR file can't be shown in this page as HDR; GitHub would show it washed out. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4824
No description provided.