GPU: RGBA8 shader views keep their sRGB or linear format where the host can cast (#578) #644

Open
github-bot wants to merge 1 commit from github-bot/gh-644 into main AGit
Owner

@⁠laptopnotebook on GitHub · 2026-11-25 03:52 UTC · original
laptopnotebook:fix/578-srgb-views → main · +224 −8 · 3 files · 1 commits · open

Fixes #578.

fits in descriptor/host.rs gave a shader view of a typed texture the texture's format whenever the view asked for another format of the same family. For RGBA8 that dropped the sRGB conversion: an sRGB view of a UNORM texture read its texels as linear, and a linear view of an sRGB texture read them converted.

On a host that reports CastingFullyTypedFormatSupported (Options3, queried once and logged like the depth bounds check), an RGBA8 shader view now keeps the sRGB or linear format it asks for. Unordered access views, other format pairs (BGRA8 still has the old shortcut) and hosts without the cast behave as before. This follows the patch @⁠akimfomin proposed in the issue.

inplace::Rig is now pub(crate) so the new test can use its queue; nothing else about it changed.

Validation (Windows 11, NVIDIA):

  • New test descriptor::host::tests::rgba8_views_keep_their_srgb_conversion uploads one 0x80 texel and samples it on the GPU through all four texture/view pairs. The sRGB view of the UNORM texture reads 0.2159 with the change and 0.5020 without it (the test fails then).
  • Under the D3D12 debug layer (diagnostics build, VICTORY_D3D12_DEBUG=1) the four views raise no messages.
  • cargo test --workspace --locked: all pass.
  • A run of the title through the menus into the prologue: no crash or device loss. The new path was not hit there (the capability line was never logged), so this run shows no regression but no visible change either.
  • Clippy currently fails on main in draw.rs (sort_unstable_by_key), indirect.rs (depth_written unused) and resource.rs (placed_filler_twins unused); this PR doesn't touch those.
**@⁠laptopnotebook** on GitHub · 2026-11-25 03:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/644) `laptopnotebook:fix/578-srgb-views` → `main` · +224 −8 · 3 files · 1 commits · open Fixes #578. `fits` in `descriptor/host.rs` gave a shader view of a typed texture the texture's format whenever the view asked for another format of the same family. For RGBA8 that dropped the sRGB conversion: an sRGB view of a UNORM texture read its texels as linear, and a linear view of an sRGB texture read them converted. On a host that reports `CastingFullyTypedFormatSupported` (Options3, queried once and logged like the depth bounds check), an RGBA8 shader view now keeps the sRGB or linear format it asks for. Unordered access views, other format pairs (BGRA8 still has the old shortcut) and hosts without the cast behave as before. This follows the patch @⁠akimfomin proposed in the issue. `inplace::Rig` is now `pub(crate)` so the new test can use its queue; nothing else about it changed. Validation (Windows 11, NVIDIA): - New test `descriptor::host::tests::rgba8_views_keep_their_srgb_conversion` uploads one 0x80 texel and samples it on the GPU through all four texture/view pairs. The sRGB view of the UNORM texture reads 0.2159 with the change and 0.5020 without it (the test fails then). - Under the D3D12 debug layer (diagnostics build, `VICTORY_D3D12_DEBUG=1`) the four views raise no messages. - `cargo test --workspace --locked`: all pass. - A run of the title through the menus into the prologue: no crash or device loss. The new path was not hit there (the capability line was never logged), so this run shows no regression but no visible change either. - Clippy currently fails on `main` in `draw.rs` (`sort_unstable_by_key`), `indirect.rs` (`depth_written` unused) and `resource.rs` (`placed_filler_twins` unused); this PR doesn't touch those.
A shader view of a typed texture in another format of its family was
given the texture's format. For RGBA8 that dropped the sRGB conversion:
an sRGB view of a UNORM texture read its texels as linear, and a linear
view of an sRGB texture read them converted.

On a host that reports CastingFullyTypedFormatSupported (Options3, queried
once and logged), an RGBA8 shader view now keeps the sRGB or linear format
it asks for. Unordered access views, other format pairs and hosts without
the cast are as before. The fix follows the patch proposed in #578.

Test: rgba8_views_keep_their_srgb_conversion samples one 0x80 texel on the
GPU through all four texture/view pairs. Here the sRGB view of
the UNORM texture reads 0.2159 with the change and 0.5020 without it.
Under the D3D12 debug layer the views raise no messages. Inplace's Rig is
pub(crate) so the test can use its queue.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:48:05 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/644/head:github-bot/gh-644'
git switch 'github-bot/gh-644'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-644'
git switch 'github-bot/gh-644'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-644'
git switch 'github-bot/gh-644'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-644'
git switch 'main'
git merge --squash 'github-bot/gh-644'
git switch 'main'
git merge --ff-only 'github-bot/gh-644'
git switch 'main'
git merge 'github-bot/gh-644'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.