Skip to content

fix(agc): sample formats that FORCE_DEGAMMA leaves unchanged without it - #8069

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:fix/force-degamma-unchanged-formats
Oct 21, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:fix/force-degamma-unchanged-formats

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

A sampler with FORCE_DEGAMMA (S# word 0 bit 20) makes main refuse every texture that is not sRGB and has no sRGB view, for example a 32-bit float texture:

a texture of guest format 22, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding, which is not implemented

On an RX 6700 XT the bit changes only 8-bit-per-channel formats. I measured it through the hardware oracle's HIP path (scripts and tables): a 64x1 linear texture, each lane reads its own texel at its centre (point) and halfway to the next one (bilinear), with two random fills, so 512 component values per format and mode:

  • UNORM 8, 8_8 and 8_8_8_8 with the bit read bit for bit as 8_SRGB, 8_8_SRGB and 8_8_8_8_SRGB, as main already samples them (through an sRGB view);
  • SNORM 8, 8_8 and 8_8_8_8 with the bit read bit for bit as those sRGB formats over the same bytes;
  • every other format I measured samples bit for bit the same with and without the bit, point and bilinear: 16, 16_16 and 16_16_16_16 UNORM, SNORM and FLOAT (guest formats 7, 8, 13, 23, 24, 29, 65, 66, 71), 32, 32_32 and 32_32_32_32 FLOAT (22, 64, 77), 10_11_11 FLOAT (36), 2_10_10_10 UNORM (50), 5_9_9_9 FLOAT (132), 5_6_5, 1_5_5_5 and 4_4_4_4 UNORM (133, 134, 136), and BC4, BC5 and BC6H, unsigned and signed (175 to 180). The sRGB formats 128 to 130 do too.

ForcesDegammaOn now leaves the formats of the last item to their plain view, as if the bit were clear. SNORM 8, 8_8 and 8_8_8_8 (they would need an sRGB view of an SNORM image) and formats I did not measure still throw. The FORCE_DEGAMMA debt entry is cut to what is still open.

Tested

Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on main 585075cb7. The runs use VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan-ValidationLayers vulkan-sdk-1.4.363.0, built locally), ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and ctest -V, with the implicit overlay layers on this PC switched off (VK_LOADER_LAYERS_DISABLE=~implicit~); no log reports the layer as not found.

  • agc_driver_image_sample_force_degamma no longer expects guest format 22 (32_FLOAT) to be refused. It now requires a point sample of 32_FLOAT and of BC4 UNORM through a FORCE_DEGAMMA sampler to equal, bit for bit, the sample without it, and it expects 8_8_8_8_SNORM (guest format 57) to be refused instead.
  • agc_driver_graphics checks the list: IgnoresForcedDegamma holds for 7, 13, 22, 36, 50, 77, 132, 133, 175 and 179, and not for 1, 2, 14, 15, 56, 57, 128, 130, 169, 171, 173 and 181 (8-bit UNORM, SNORM and sRGB formats, and BC1, BC2, BC3 and BC7 UNORM).
  • With this change both pass 3 of 3, with no VUID- errors.
  • With only the Sampler.cpp line reverted, agc_driver_image_sample_force_degamma fails: a texture of guest format 22, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding, which is not implemented. No VUID- errors.
  • main 8c9161eac with its own version of both tests: they pass, with no VUID- errors.
  • python tools/check_conventions.py --base origin/main with this title and body passes. python tools/pr_overlap.py --branch fix/force-degamma-unchanged-formats lists feat(agc): read sampler border colours from the border colour table #6804, which adds a debt entry on the line above the FORCE_DEGAMMA entry, and fix(agc): give a block-copied BC texture an sRGB view for FORCE_DEGAMMA samplers #7799 (its pushed head no longer touches the debt file); the rest are pull requests that conflict with main and share only the debt file, plus fix(shader): emulate sRGB sampling when unsupported #5371, which edits the same test file for its R8 and RG8 sRGB fallback.
  • @wachi35676 ran this head merged into main 9127ea36d on an NVIDIA RTX 5070 Ti (driver 617.42) and an AMD Radeon iGPU (RDNA2, 1002:13c0, AMD proprietary driver 2026.04.17), Windows 11 Home 26300, ANYPS5_REQUIRE_VULKAN=1: agc_driver_image_sample_force_degamma, agc_driver_graphics and the other related tests, 16 in all, pass on both, and with Sampler.cpp back to main agc_driver_image_sample_force_degamma fails on both with the message above. On WSL Ubuntu 24.04 with llvmpipe (Mesa 25.2.8), with this and six other PRs merged, 61 of the 62 related tests pass; the other fails on a WSL write-watch limit.
  • Not run: the full suite on this head; titles (no report of this refusal names one of these formats); the console's gfx1013. The hardware result for these formats is the RX 6700 XT measurement above only.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, Windows 11 26200; by @wachi35676: NVIDIA RTX 5070 Ti, driver 617.42, and AMD Radeon iGPU (RDNA2, 1002:13c0), AMD proprietary driver 2026.04.17, Windows 11 Home 26300; llvmpipe (Mesa 25.2.8), WSL Ubuntu 24.04
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleForceDegamma.cpp
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5499 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6146 docs/dev/debt/libSceAgcDriver.md
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6636 docs/dev/debt/libSceAgcDriver.md
PR 6683 docs/dev/debt/libSceAgcDriver.md
PR 6804 core/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 6926 docs/dev/debt/libSceAgcDriver.md
PR 6946 docs/dev/debt/libSceAgcDriver.md
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6977 core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7446 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7800 docs/dev/debt/libSceAgcDriver.md
PR 8564 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md

@wachi35676

Copy link
Copy Markdown
Contributor

NVIDIA and AMD iGPU runs of eeb1c4f03. The PR's runs were on an RX 6700 XT only.

Windows 11 Home 26300, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main 9127ea36d with this head merged. GPUs: RTX 5070 Ti (NVIDIA 617.42) and the AMD Radeon iGPU (RDNA2, 1002:13c0, AMD proprietary driver 2026.04.17, ANYPS5_GPU=AMD). ANYPS5_REQUIRE_VULKAN=1, ctest -j4, failures rerun serially (there were none).

AI-assisted: yes (Claude Code); results above were run on this machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants