fix(agc): repeat a texture format's channels for the components it lacks #22654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22654"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-18T00:26:43Z.
What
When a T# destination select names a channel the texture format lacks (for example
dst_sel_w = Won an 8_UNORM texture), the sampled-image view mapped it to that channel of the Vulkan view, which Vulkan fills with 0 (colour) or 1 (alpha). On RDNA2 the hardware instead repeats the format's channels: a missing component reads channel (index mod channel count).TextureComponentChannelnow maps such a select to that channel for the one-channel 8, 16 and 32-bit formats (R8, R16, R32 and their SNORM, SCALED, UINT, SINT, SFLOAT and sRGB variants) and the two-channel R8G8, R16G16 and R32G32 formats, when the texture is sampled through a view of its own layout. Converted formats (thoseremapGuestFormatsamples through a 32-bit view and decodes in the shader, including 11_11_10_FLOAT), constant selects (0, 1), the explicitly mapped packed formats (43, 133-137) and every other format are unchanged.Hardware measurement
tools/hw-oracleon an RX 6650 XT (gfx1032, RDNA2, Linux 7.2.14, hsa-rocr 10.1, clang 23.1.5; wave32, IEEE off, DX10 clamp on, denormals preserved, round to nearest even, FP16 overflow off). A 1x1 texel with bytes (40, 120, 200, 255, then zeros), identity selects (0xfac), point sampler,image_sample_lz, result registers preset to0x11111111,0x22222222,0x33333333,0x44444444:and with dmask 0xf: 8_UINT (5), 16_UNORM (7), 16_FLOAT (13) and 32_FLOAT (22) return (x, x, x, x); 16_16_UNORM (23) and 16_16_FLOAT (29) return (x, y, x, y); 11_11_10_FLOAT (36) returns (x, y, z, x) (measured, but left unchanged here because it is a converted format). Every preset was overwritten, so the hardware writes the repeated value rather than leaving the register. This is an RDNA2 measurement, not PS5 evidence; the PS5's gfx1013 is the same generation.
Tested
Linux 7.2.14, Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.7), GCC 16.2.1, Release,
ANYPS5_ENABLE_SPIRV_TOOLS=OFF.agc_driver_graphics(tests/TextureFormat.cpp): identity selects on 8_UNORM and 32_FLOAT map to (R, R, R, R), on 8_8_UNORM and 16_16_FLOAT to (R, G, R, G), 8_8_8_8_UNORM is unchanged, the constant selects are unchanged, and the converted format 36 keeps all four selects. Passes, as doesagc_driver_graphics_maps_fallback.agc_driver_image_repeated_channels: draws a 1x1 texel (40, 120, 200, 255) with identity selects; 8_UNORM draws (40, 40, 40, 40), 8_8_UNORM (40, 120, 40, 120), 8_8_8_8_UNORM (40, 120, 200, 255). Without the change the first case fails withcomponent 1 is 0, expected 40.Independent validation reported by domx4q on RTX 4090, NVIDIA 620.70.06: 3/3 focused tests passed; the new repeated-channel fixture failed in both negative-control runs with main’s TextureFormat.cpp. Khronos validation was loaded for the GPU cases; no VUID errors were reported. These are contributor-reported results.
Additional GPU qualification (independent Intel report): Intel Arc B390, ANV Mesa 26.2.7, Linux 7.2.10; head
72deec3de9on main8c254da48b. The graphics fixture andagc_driver_image_repeated_channelspass (2/2), with actual validation-layer 1.4.341 insertion and no VUIDs reported. The same new fixtures on main fail and detect the targeted bug. These are peer-reported results, not tests run on this machine.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
Bug Fixes
Tests
Documentation
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:37:10Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
5fda2a2bb979385c86a8fb96651beb336c4175e7from the prepared diff and source context. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
R32G32formats.Not verified
No build, test, or console run was performed. Author reports for the RX 6650 XT hardware oracle, tests, and title regression checks were not independently verified. Read all changed files and their added lines:
core/libs/prx/libSceAgcDriver/Graphics/src/TextureFormat.cpp,core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp,core/libs/prx/libSceAgcDriver/tests/execution/ImageRepeatedChannels.cpp, anddocs/dev/debt/changes/fix-agc-repeat-missing-texture-channels.md.files.jsonwas unavailable; the review-folder listing showed all four changed files included, and no changed files were excluded.To get this to a good state
Nothing is required. Optional: expand the unit-test matrix to cover more channel-count and numeric-format variants.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T02:16:44Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
72deec3de98aec432ab0319b894a2ee2e2e0b9c6. Read the prepared description, commits, diff, manifest, all four changed files, and theViewComponentscaller. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Builds, tests, runtime behavior, PS5 hardware behavior, and the full contents of
files.jsonwere not verified. The author reports successful driver and execution tests and an RX 6650 XT measurement; these were not run as part of this review.files.jsoncould not be read from the prepared review artifacts. Files read:core/libs/prx/libSceAgcDriver/Graphics/src/TextureFormat.cpp,core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp,core/libs/prx/libSceAgcDriver/tests/execution/ImageRepeatedChannels.cpp, anddocs/dev/debt/changes/fix-agc-repeat-missing-texture-channels.md. The manifest marks all four files as reviewed and included; no excluded changed files were listed in the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T21:19:42Z.
Review: COMMENTED
Actionable comments posted: 1
9d26f35a-0a9b-42e4-b355-3a3b43d5ae1eReviewing files that changed from the base of the PR and between
8734e4179bande0dcd92c7e.core/libs/prx/libSceAgcDriver/Graphics/src/TextureFormat.cppcore/libs/prx/libSceAgcDriver/tests/TextureFormat.cppcore/libs/prx/libSceAgcDriver/tests/execution/ImageRepeatedChannels.cppcore/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppdocs/dev/debt/changes/fix-agc-repeat-missing-texture-channels.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T21:25:55Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the reviewed changes are supported by targeted tests and reported hardware measurements, with no verified blocking defects.
What I ran
Reviewed head
e0dcd92c7e08728ee8a73a810430d60885ed9442. Read the prepared diff and all five changed files, then inspected the format lookup, conversion predicate, and view mapping callers. No tests or builds were run during this review; results described in the PR description are author or peer reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or builds were run here. Hardware behavior on PS5 was not verified; the description identifies its measurement as RDNA2 RX 6650 XT evidence, with NVIDIA and Intel results reported by contributors. The review bundle listed five changed files as
included; all five were read. No files were excluded by rule in the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:01:48Z.
Review: COMMENTED
Correction to my earlier review. CMake discovers
ImageRepeatedChannels.cppthrough the execution-test glob. I withdraw the registration request.The discovered
agc_driver_image_repeated_channelsfixture passed on Linux/lavapipe. In the paired run,agc_driver_gcn_scalar_buffer_basepassed andagc_driver_image_tablehit its 30-second limit on both main at9d362fb088fcand this head. Both runs loaded Khronos validation 1.4.369 with Vulkan required and the shader cache disabled. No missing-layer warnings or VUIDs appeared.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.