fix(agc): view 4_4_4_4 textures as B4G4R4A4, which every Vulkan device can sample #3208

Merged
adriadam10 merged 1 commit from upstream-pr/3208 into main 2026-10-11 01:20:57 +00:00
adriadam10 commented 2026-10-11 01:14:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T01:14:07Z.


What

agc_driver_image_packed16_load has failed on every Linux CI run of main since #2386 (main run 38097151664):

AGC graphics: 4_4_4_4_UNORM image_load X Y Z W: texel 0 component 0 is 0x00000000, expected 0x3f800000

Cause: #2386 views the guest 4_4_4_4 format as VK_FORMAT_R4G4B4A4_UNORM_PACK16. That format has no required support in Vulkan, and CI's lavapipe (Mesa 25.2.8, LLVM 20) has none at all. Under the validation layer, the image view fails VUID-VkImageViewCreateInfo-None-02273 ("The format features of the resultant image view must contain at least one bit"), and the upload fails VUID-vkCmdCopyBufferToImage-dstImage-01997. RADV supports the format, so the test passed locally.

Fix: use VK_FORMAT_B4G4R4A4_UNORM_PACK16, the 4-bit format Vulkan requires every device to support for sampling. The swizzle reads the same bits as before: guest X from bits 0-3 (A), Y from 4-7 (R), Z from 8-11 (G), W from 12-15 (B). It's still the low-bits-first order #2386 measured on gfx1035.

The unit test's channel table and the TechnicalDebt line now name the new format.

Tested

Linux (CachyOS), GCC 16, Release.

Driver Before After
CI's lavapipe (Mesa 25.2.8 packages from the CI step), with /dev/udmabuf denied as on CI fails agc_driver_image_packed16_load passes, 0 validation errors
RADV passes passes
  • agc_driver_graphics_tests (the TextureComponentChannel unit table) passes.
  • Negative checks:
    • the old A,B,G,R swizzle on the new format fails both the RADV execution test and the unit table;
    • the old format fails the lavapipe execution test.
  • tools/check_conventions.py passes.
  • Not run on NVIDIA. B4G4R4A4 sampling is required there too.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4815702018 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3208). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T01:14:07Z. --- ### What `agc_driver_image_packed16_load` has failed on every Linux CI run of `main` since #2386 (main run 38097151664): ``` AGC graphics: 4_4_4_4_UNORM image_load X Y Z W: texel 0 component 0 is 0x00000000, expected 0x3f800000 ``` **Cause:** #2386 views the guest `4_4_4_4` format as `VK_FORMAT_R4G4B4A4_UNORM_PACK16`. That format has no required support in Vulkan, and CI's lavapipe (Mesa 25.2.8, LLVM 20) has none at all. Under the validation layer, the image view fails `VUID-VkImageViewCreateInfo-None-02273` ("The format features of the resultant image view must contain at least one bit"), and the upload fails `VUID-vkCmdCopyBufferToImage-dstImage-01997`. RADV supports the format, so the test passed locally. **Fix:** use `VK_FORMAT_B4G4R4A4_UNORM_PACK16`, the 4-bit format Vulkan requires every device to support for sampling. The swizzle reads the same bits as before: guest X from bits 0-3 (A), Y from 4-7 (R), Z from 8-11 (G), W from 12-15 (B). It's still the low-bits-first order #2386 measured on gfx1035. The unit test's channel table and the TechnicalDebt line now name the new format. ### Tested Linux (CachyOS), GCC 16, Release. | Driver | Before | After | |---|---|---| | CI's lavapipe (Mesa 25.2.8 packages from the CI step), with `/dev/udmabuf` denied as on CI | fails | `agc_driver_image_packed16_load` passes, 0 validation errors | | RADV | passes | passes | - `agc_driver_graphics_tests` (the `TextureComponentChannel` unit table) passes. - Negative checks: - the old `A,B,G,R` swizzle on the new format fails both the RADV execution test and the unit table; - the old format fails the lavapipe execution test. - `tools/check_conventions.py` passes. - Not run on NVIDIA. B4G4R4A4 sampling is required there too. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Silverash-i8 commented 2026-10-11 01:22:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:22:50Z.


Windows run on the two GPUs the PR didn't cover: Windows 11, WinLibs GCC 15.2.0 r7, Release, head bbe26912.

Device agc_driver_image_packed16_load agc_driver_graphics texture_format_lookup
RTX 5060 Laptop (NVIDIA) pass pass pass
Arrow Lake iGPU (Intel, ANYPS5_GPU=Intel) pass pass pass

The texture log confirms the new view is what ran: guest format 136 is created as vk=3 (VK_FORMAT_B4G4R4A4_UNORM_PACK16) on both. On main 06da1176 this test also passed on both GPUs in my last full runs, so the old R4G4B4A4 view is supported by these two drivers, and nothing regresses with the change.

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104156113 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3208#issuecomment-6104156113). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T01:22:50Z. --- Windows run on the two GPUs the PR didn't cover: Windows 11, WinLibs GCC 15.2.0 r7, Release, head `bbe26912`. | Device | `agc_driver_image_packed16_load` | `agc_driver_graphics` | `texture_format_lookup` | |---|---|---|---| | RTX 5060 Laptop (NVIDIA) | pass | pass | pass | | Arrow Lake iGPU (Intel, `ANYPS5_GPU=Intel`) | pass | pass | pass | The texture log confirms the new view is what ran: guest format 136 is created as `vk=3` (`VK_FORMAT_B4G4R4A4_UNORM_PACK16`) on both. On `main` 06da1176 this test also passed on both GPUs in my last full runs, so the old R4G4B4A4 view is supported by these two drivers, and nothing regresses with the change. AI-assisted (Claude Code); I ran this on my machine.
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!3208
No description provided.