fix(agc): give block-copied textures an sRGB view #8159

Closed
savvaniss wants to merge 1 commit from upstream-pr/8159 into main
savvaniss commented 2026-10-20 00:54:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-20T00:54:43Z.


What

A texture that is copied block for block from a storage image (Texture::BlockCopyTag) never got an sRGB view. Sampling one through an S# with FORCE_DEGAMMA therefore stopped with "a texture of guest format N, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding". Textures read from guest memory and views of a storage image already have one.

The block-copy image is now created with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT when its format has an sRGB twin (SrgbTwinFormat). It then prepares its sRGB view like the other two constructors do. A format without a twin is unchanged and still throws.

On main this affects BC textures read while their blocks are still pending in a 32x2 or 32x4 uint storage image. The PS4 path of #6977 also block-copies a smaller GCN view of a render target. Trivial Pursuit Live! (CUSA03312) samples such an 8_8_8_8_UNORM view with FORCE_DEGAMMA before its language menu.

Tested

Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release.

  • agc_driver_bc_block_copy gains a case for BC7 and BC1: the pending blocks are sampled through FORCE_DEGAMMA and must match, bit for bit, the same blocks sampled after they are stored. The stored sample must also differ from a sample without the bit. On main's Texture.cpp the new case fails with the error above; with the change it passes.
  • agc_driver_bc_block_copy and agc_driver_image_sample_force_degamma ran on main and on this branch with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (ctest -R ... -V), on both GPUs below. Both pass in all four runs. No log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none contains a VUID- line.
  • Trivial Pursuit Live! (CUSA03312): with this change on top of #6977, the title reaches its language menu and title screen at 60 fps on the RX 9070 XT. Without it, it stops at the error above.
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists many open PRs that touch Texture.cpp. Of those, only #7800 changes the block-copy constructor, and only its memory allocation.

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: CUSA03312 #7198 (Trivial Pursuit Live!, on the PS4 path of #6977)
  • GPUs tested: AMD Radeon RX 9070 XT (driver 32.0.31041.1004) and Intel UHD Graphics 770 (driver 32.0.101.7088), Windows 11 Pro 26300
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4929440612 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8159). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-20T00:54:43Z. --- ### What A texture that is copied block for block from a storage image (`Texture::BlockCopyTag`) never got an sRGB view. Sampling one through an S# with `FORCE_DEGAMMA` therefore stopped with "a texture of guest format N, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding". Textures read from guest memory and views of a storage image already have one. The block-copy image is now created with `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` when its format has an sRGB twin (`SrgbTwinFormat`). It then prepares its sRGB view like the other two constructors do. A format without a twin is unchanged and still throws. On `main` this affects BC textures read while their blocks are still pending in a 32x2 or 32x4 uint storage image. The PS4 path of #6977 also block-copies a smaller GCN view of a render target. Trivial Pursuit Live! (CUSA03312) samples such an `8_8_8_8_UNORM` view with `FORCE_DEGAMMA` before its language menu. ### Tested Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release. - `agc_driver_bc_block_copy` gains a case for BC7 and BC1: the pending blocks are sampled through `FORCE_DEGAMMA` and must match, bit for bit, the same blocks sampled after they are stored. The stored sample must also differ from a sample without the bit. On `main`'s `Texture.cpp` the new case fails with the error above; with the change it passes. - `agc_driver_bc_block_copy` and `agc_driver_image_sample_force_degamma` ran on `main` and on this branch with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (`ctest -R ... -V`), on both GPUs below. Both pass in all four runs. No log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and none contains a `VUID-` line. - **Trivial Pursuit Live! (CUSA03312):** with this change on top of #6977, the title reaches its language menu and title screen at 60 fps on the RX 9070 XT. Without it, it stops at the error above. - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists many open PRs that touch `Texture.cpp`. Of those, only #7800 changes the block-copy constructor, and only its memory allocation. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: CUSA03312 #7198 (Trivial Pursuit Live!, on the PS4 path of #6977) - [x] GPUs tested: AMD Radeon RX 9070 XT (driver 32.0.31041.1004) and Intel UHD Graphics 770 (driver 32.0.101.7088), Windows 11 Pro 26300 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 01:05:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T01:05:38Z.


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 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6187 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6249 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6682 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6718 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6820 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6960 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7048 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7332 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7604 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6280894252 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8159#issuecomment-6280894252). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T01:05:38Z. --- <!-- pr-overlap --> 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 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6187](https://www.github.com/boykopovar/AnyPS5/pull/6187) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6192](https://www.github.com/boykopovar/AnyPS5/pull/6192) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6197](https://www.github.com/boykopovar/AnyPS5/pull/6197) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6202](https://www.github.com/boykopovar/AnyPS5/pull/6202) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6209](https://www.github.com/boykopovar/AnyPS5/pull/6209) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6249](https://www.github.com/boykopovar/AnyPS5/pull/6249) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6682](https://www.github.com/boykopovar/AnyPS5/pull/6682) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6718](https://www.github.com/boykopovar/AnyPS5/pull/6718) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6820](https://www.github.com/boykopovar/AnyPS5/pull/6820) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6960](https://www.github.com/boykopovar/AnyPS5/pull/6960) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6971](https://www.github.com/boykopovar/AnyPS5/pull/6971) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7048](https://www.github.com/boykopovar/AnyPS5/pull/7048) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7085](https://www.github.com/boykopovar/AnyPS5/pull/7085) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7514](https://www.github.com/boykopovar/AnyPS5/pull/7514) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7604](https://www.github.com/boykopovar/AnyPS5/pull/7604) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` |
oneandonlydean commented 2026-10-20 04:48:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T04:48:33Z.


Thanks for this. #7799 makes the same change (the sRGB view for block-copied textures, with the same test) and is a day older, so we'll carry it there. Your test results would be very useful on #7799, please add them there. Closing this one as a duplicate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6283625218 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8159#issuecomment-6283625218). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T04:48:33Z. --- Thanks for this. #7799 makes the same change (the sRGB view for block-copied textures, with the same test) and is a day older, so we'll carry it there. Your test results would be very useful on #7799, please add them there. Closing this one as a duplicate.
savvaniss commented 2026-10-20 12:27:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-20T12:27:51Z.


@oneandonlydean thanks, agreed. I posted the results on #7799, rerun on its current head: https://github.com/boykopovar/AnyPS5/pull/7799#issuecomment-6290825850

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6290830185 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8159#issuecomment-6290830185). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-20T12:27:51Z. --- @oneandonlydean thanks, agreed. I posted the results on #7799, rerun on its current head: https://github.com/boykopovar/AnyPS5/pull/7799#issuecomment-6290825850 AI-assisted: yes (Claude Code)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!8159
No description provided.