feat(agc): render into XOR-swizzled color targets with a pipe/bank XOR, and into SW_4KB_S_X/D_X #1735

Merged
TheAggie merged 2 commits from upstream-pr/1735 into main 2026-10-10 08:49:43 +00:00
TheAggie commented 2026-10-08 17:52:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-08T17:52:13Z.


What

This is the color-target half of #1734, which it builds on. Its first commit is that PR's and drops out once it merges. It has two parts.

Pipe/bank XOR. Mesa ORs the pipe/bank XOR into CB_COLOR_BASE (cb_color_base |= tile_swizzle in ac_set_mutable_cb_surface_fields, src/amd/common/ac_descriptors.c). DecodeColorBuffer passed the unaligned address to GuestMemory::CheckRange with the block alignment, which threw null or misaligned address. Under RADV on the PS5, ccleste (PPSA59322) dropped its off-screen render passes this way.

  • For XOR modes, DecodeColorBuffer splits the base into the block-aligned address/surfaceAddress and ColorTarget::pipeBankXor. The new field is placed at the end of the struct, because tests initialize it positionally.
  • ColorTargetLayout takes the XOR and applies it to the in-block offset, as addrlib does, for the CPU paths in ColorTargetTransfer. It rejects an XOR for non-XOR modes, values that are not whole 256-byte units, and values beyond the block.
  • The two SW_64KB_R_X detile and retile dispatches in Draw.cpp pass it to the detiler.
  • SurfaceForTarget copies it into the resident surface. A texture that samples the target then finds the same image through SurfaceKey, and the draw key includes it.

SW_4KB_S_X and SW_4KB_D_X. DecodeColorTileMode accepted only linear, SW_4KB_S, SW_64KB_S and SW_64KB_R_X. RADV renders small surfaces in SW_4KB_D_X. ccleste's three such draws failed earlier, at the FMASK check (ATTRIB3 0x0da58000: COLOR_SW_MODE 0x16, FMASK_SW_MODE 0x14).

  • Both 4 KiB XOR modes decode and become ColorTileMode::S4KBX/D4KBX, mapping to the texture modes the detiler already handles. Resident targets take the existing storage-image path.
  • ColorTargetLayout builds their block tables from the same kTextureSwizzleEquations entries as SW_64KB_R_X. Its 4 KiB alignment is used for CheckRange. The XOR split uses the 4 KiB mask.
  • The FMASK check also accepts FMASK_SW_MODE == COLOR_SW_MODE & ~3. Mesa sets this for every color surface without FMASK (ac_surface.c: "CMASK fast clear uses these even if FMASK isn't allocated. FMASK only supports the Z swizzle modes, whose numbers are multiples of 4"). The existing 0 and 0x18 stay accepted; 0x18 is what a logged AGC descriptor uses with SW_4KB_S.

Tests:

  • agc_driver_graphics (ColorTargetLayout):
    • With XOR 0x5600, SW_64KB_R_X offsets equal the unswizzled ones XORed inside each block, across two blocks.
    • Tile and detile round trips are exact.
    • Invalid XORs are rejected.
    • A 2x2 transfer with XOR 0x3200 writes the pixels at 0x3200/0x3210 and reads them back.
    • ccleste's ATTRIB3, its S_X twin and a D_X target without FMASK decode. An FMASK mode that matches neither rule is rejected.
    • For both 4 KiB XOR modes, offsets follow the swizzle equation plus XOR 0xa00, the block geometry is 32x32, round trips are exact, and an XOR of a whole block is rejected.
  • agc_driver_graphics (ColorPipeBankXorTests): DecodeState splits SW_64KB_R_X bases with XOR 0, 0x5600 and 0xff00, and SW_4KB_D_X bases with 0, 0xa00 and 0xf00.

There is no GPU draw test of the XOR'd color paths. The detile shader they use is covered by the GPU test in #1734.

Tested

Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.

  • The full suite (459 tests) passes on this branch. It was run from the generated CTestTestfile.cmake commands because antivirus blocks ctest.exe on this machine.
  • ccleste renders its title screen and plays with this and #1734 applied, along with the other changes it needs. That testing was on a local branch with all of them, and RADV_DEBUG=nonggc set.

Not tested on AMD, Intel or Linux.

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: #1734
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4790750834 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-08T17:52:13Z. --- ### What This is the color-target half of #1734, which it builds on. Its first commit is that PR's and drops out once it merges. It has two parts. **Pipe/bank XOR.** Mesa ORs the pipe/bank XOR into `CB_COLOR_BASE` (`cb_color_base |= tile_swizzle` in `ac_set_mutable_cb_surface_fields`, `src/amd/common/ac_descriptors.c`). `DecodeColorBuffer` passed the unaligned address to `GuestMemory::CheckRange` with the block alignment, which threw `null or misaligned address`. Under RADV on the PS5, ccleste (PPSA59322) dropped its off-screen render passes this way. - For XOR modes, `DecodeColorBuffer` splits the base into the block-aligned `address`/`surfaceAddress` and `ColorTarget::pipeBankXor`. The new field is placed at the end of the struct, because tests initialize it positionally. - `ColorTargetLayout` takes the XOR and applies it to the in-block offset, as addrlib does, for the CPU paths in `ColorTargetTransfer`. It rejects an XOR for non-XOR modes, values that are not whole 256-byte units, and values beyond the block. - The two `SW_64KB_R_X` detile and retile dispatches in `Draw.cpp` pass it to the detiler. - `SurfaceForTarget` copies it into the resident surface. A texture that samples the target then finds the same image through `SurfaceKey`, and the draw key includes it. **`SW_4KB_S_X` and `SW_4KB_D_X`.** `DecodeColorTileMode` accepted only linear, `SW_4KB_S`, `SW_64KB_S` and `SW_64KB_R_X`. RADV renders small surfaces in `SW_4KB_D_X`. ccleste's three such draws failed earlier, at the FMASK check (`ATTRIB3` 0x0da58000: `COLOR_SW_MODE` 0x16, `FMASK_SW_MODE` 0x14). - Both 4 KiB XOR modes decode and become `ColorTileMode::S4KBX`/`D4KBX`, mapping to the texture modes the detiler already handles. Resident targets take the existing storage-image path. - `ColorTargetLayout` builds their block tables from the same `kTextureSwizzleEquations` entries as `SW_64KB_R_X`. Its 4 KiB alignment is used for `CheckRange`. The XOR split uses the 4 KiB mask. - The FMASK check also accepts `FMASK_SW_MODE == COLOR_SW_MODE & ~3`. Mesa sets this for every color surface without FMASK (`ac_surface.c`: "CMASK fast clear uses these even if FMASK isn't allocated. FMASK only supports the Z swizzle modes, whose numbers are multiples of 4"). The existing 0 and 0x18 stay accepted; 0x18 is what a logged AGC descriptor uses with `SW_4KB_S`. **Tests:** - `agc_driver_graphics` (`ColorTargetLayout`): - With XOR 0x5600, `SW_64KB_R_X` offsets equal the unswizzled ones XORed inside each block, across two blocks. - Tile and detile round trips are exact. - Invalid XORs are rejected. - A 2x2 transfer with XOR 0x3200 writes the pixels at 0x3200/0x3210 and reads them back. - ccleste's `ATTRIB3`, its `S_X` twin and a `D_X` target without FMASK decode. An FMASK mode that matches neither rule is rejected. - For both 4 KiB XOR modes, offsets follow the swizzle equation plus XOR 0xa00, the block geometry is 32x32, round trips are exact, and an XOR of a whole block is rejected. - `agc_driver_graphics` (`ColorPipeBankXorTests`): `DecodeState` splits `SW_64KB_R_X` bases with XOR 0, 0x5600 and 0xff00, and `SW_4KB_D_X` bases with 0, 0xa00 and 0xf00. There is no GPU draw test of the XOR'd color paths. The detile shader they use is covered by the GPU test in #1734. ### Tested Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti. - The full suite (459 tests) passes on this branch. It was run from the generated `CTestTestfile.cmake` commands because antivirus blocks `ctest.exe` on this machine. - ccleste renders its title screen and plays with this and #1734 applied, along with the other changes it needs. That testing was on a local branch with all of them, and `RADV_DEBUG=nonggc` set. Not tested on AMD, Intel or Linux. ### 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: #1734 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
johnmaia commented 2026-10-08 18:59:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-08T18:59:07Z.


Linux run, since the description lists AMD and Linux as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head c2b22c44, merged onto main 6b56175a.

Full ctest: 479 of 480 pass. The one failure is agc_driver_image_pipe_bank_xor, which comes from #1734's commit. I explained the cause and a one-line fix (OOB_SELECT 3 in the test's buffer descriptor) on #1734. With that change applied to this branch's version of the test, it passes on the RX 7600 and on llvmpipe.

agc_driver_graphics, which has this PR's ColorTargetLayout and ColorPipeBankXorTests cases, passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6066955771 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#issuecomment-6066955771). Originally posted by [johnmaia](https://github.com/johnmaia) on 2026-10-08T18:59:07Z. --- Linux run, since the description lists AMD and Linux as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head `c2b22c44`, merged onto main `6b56175a`. Full ctest: 479 of 480 pass. The one failure is `agc_driver_image_pipe_bank_xor`, which comes from #1734's commit. I explained the cause and a one-line fix (`OOB_SELECT` 3 in the test's buffer descriptor) [on #1734](https://github.com/boykopovar/AnyPS5/pull/1734#issuecomment-6066955295). With that change applied to this branch's version of the test, it passes on the RX 7600 and on llvmpipe. `agc_driver_graphics`, which has this PR's `ColorTargetLayout` and `ColorPipeBankXorTests` cases, passes.
TheAggie commented 2026-10-08 19:43:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-08T19:43:19Z.


Rebased onto the updated #1734, whose test had built its buffer V#s with OOB_SELECT 0 and stride 0 (out of bounds on GFX10, which AnyPS5 honours since #639) and caused the red Linux CI here. The full suite (478 tests) passes on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067712982 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#issuecomment-6067712982). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-08T19:43:19Z. --- Rebased onto the updated #1734, whose test had built its buffer V#s with `OOB_SELECT` 0 and stride 0 (out of bounds on GFX10, which AnyPS5 honours since #639) and caused the red Linux CI here. The full suite (478 tests) passes on current `main`.
adriadam10 commented 2026-10-10 05:58:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T05:58:09Z.

Review: CHANGES_REQUESTED


Reviewed on top of #1734; the delta looks right (XOR split in DecodeColorBuffer, ColorTargetLayout XOR validation, detile/retile only on the RenderTarget GPU path, FMASK rule). Build and agc_driver_graphics pass on my side.

  • This PR contains #1734's commit and conflicts with main in Graphics/include/State.hpp (ColorTarget, new pipeBankXor field next to a recent change). It can't land before #1734.
  • Once #1734 merges, please rebase onto main (the first commit drops out), rerun agc_driver_graphics and the new XOR tests, and I'll look at it again.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5477875872 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#pullrequestreview-5477875872). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T05:58:09Z. **Review:** CHANGES_REQUESTED --- Reviewed on top of #1734; the delta looks right (XOR split in `DecodeColorBuffer`, `ColorTargetLayout` XOR validation, detile/retile only on the `RenderTarget` GPU path, FMASK rule). Build and `agc_driver_graphics` pass on my side. - This PR contains #1734's commit and conflicts with `main` in `Graphics/include/State.hpp` (`ColorTarget`, new `pipeBankXor` field next to a recent change). It can't land before #1734. - Once #1734 merges, please rebase onto `main` (the first commit drops out), rerun `agc_driver_graphics` and the new XOR tests, and I'll look at it again.
TheAggie commented 2026-10-10 06:46:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T06:46:26Z.


@adriadam10 #1734 is merged, so I rebased this onto main ecd3dbadb. #1734's commit dropped out, leaving this PR's two commits (the SW_64KB_R_X pipe/bank XOR split and SW_4KB_S_X/D_X). One conflict on the way: DecodeColorTileMode, where main had added 1D color targets. The resolution keeps main's rule that 1D targets can't use a standard swizzle, alongside the new modes and the FMASK rule.

Windows 11 (MinGW-w64 GCC 15.2, NVIDIA GeForce RTX 5070 Ti): agc_driver_graphics (which holds the color-target layout and XOR decode tests) passes. Full suite: 512 of 515 pass, 1 skipped. The two failures, agc_driver_prepared_shaders_debug_failure and agc_driver_f32_arithmetic_nan, fail the same way on clean main ecd3dbadb on this machine. tools/check_conventions.py passes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094791601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#issuecomment-6094791601). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-10T06:46:26Z. --- @adriadam10 #1734 is merged, so I rebased this onto `main` ecd3dbadb. #1734's commit dropped out, leaving this PR's two commits (the SW_64KB_R_X pipe/bank XOR split and SW_4KB_S_X/D_X). One conflict on the way: `DecodeColorTileMode`, where `main` had added 1D color targets. The resolution keeps `main`'s rule that 1D targets can't use a standard swizzle, alongside the new modes and the FMASK rule. Windows 11 (MinGW-w64 GCC 15.2, NVIDIA GeForce RTX 5070 Ti): `agc_driver_graphics` (which holds the color-target layout and XOR decode tests) passes. Full suite: 512 of 515 pass, 1 skipped. The two failures, `agc_driver_prepared_shaders_debug_failure` and `agc_driver_f32_arithmetic_nan`, fail the same way on clean `main` ecd3dbadb on this machine. `tools/check_conventions.py` passes. AI-assisted (Claude Code).
github-actions[bot] commented 2026-10-10 08:37:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T08:37:42Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2169 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L58
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095747258 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#issuecomment-6095747258). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T08:37:42Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2169 | `core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp` [L58](https://github.com/boykopovar/AnyPS5/blob/8f442a7554c79fff2252061171dbe259a1c8842e/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L58) | | |
adriadam10 commented 2026-10-10 08:49:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:49:40Z.

Review: APPROVED


Checked the XOR split in DecodeColorBuffer, the ColorTargetLayout validation, the detile/retile dispatches (only RenderTarget goes through the GPU tiling path, so the fixed kR64KBX is right) and the FMASK rule. Build and agc_driver_graphics pass on Linux (RADV host) on top of current main; the new tests fail to build without the change. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5478370894 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#pullrequestreview-5478370894). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T08:49:40Z. **Review:** APPROVED --- Checked the XOR split in `DecodeColorBuffer`, the `ColorTargetLayout` validation, the detile/retile dispatches (only `RenderTarget` goes through the GPU tiling path, so the fixed `kR64KBX` is right) and the FMASK rule. Build and `agc_driver_graphics` pass on Linux (RADV host) on top of current `main`; the new tests fail to build without the change. Merging.
Amoenus commented 2026-10-11 11:05:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T11:05:09Z.


Independent AMD-source validation: XOR input/test coverage discrepancy (main74981fa, 2026-10-11)

While validating the separate missing D64KBX mode in #2970, I compared unmodified main74981fabe1c0fc56b561914beb027ddc9b07d358 ColorTargetLayout against compiled, unmodified AMD PAL addrlib c5e80007. This exposes a source/model mismatch for some XOR inputs accepted by this PR's tests; it is not a measured PS5 defect or a claim that valid, driver-generated XOR values are broken.

Windows 11, Winlibs GCC15.2.0r7, standalone production-source CPU probe. Addrlib configuration is synthetic GFX10.1 non-RB+, family0x8f/revision0x82, GB_ADDR_CONFIG0x00100044,16pipes/256-byte interleave, matching the table model under investigation, not measured console registers. Directly linked main's ColorTargetLayout.cpp/header (Git blobs b4deb5dd/8c492a1a); no D64 changes in this control.

Minimal independent reproduction: SW_64KB_R_X,2D,color/texture,noMetadata,1x1,1slice/1mip/1sample/1fragment; bpp=8/16/32/64/128. Compare ColorTargetLayout(1,1,RenderTarget,bpp/8,code<<8).Offset(0,0) with Addr2ComputeSurfaceAddrFromCoord using the same geometry and pipeBankXor=code. Test codes0,0x0f,0x10,0x20,0x30,0x40,0x56,0xcf,0xff. 45 comparisons,25 discrepancies, identical across5 runs.

API XOR code AnyPS5 byte offset AMD-source byte offset
0x10 0x1000 0
0x20 0x2000 0
0x30 0x3000 0
0x56 0x5600 0x4600
0xff 0xff00 0xcf00

These results hold at the origin for all five element sizes. The other tested codes match. AMD HwlComputeSurfaceAddrFromCoordTiled masks the code with pipeMask|bankMask before shifting8bits. Here pipeMask=0x0f; ColumnBits=2; two bank bits start at bit6, yielding code mask0xcf / byte mask0xcf00. AnyPS5 applies every accepted256-byte-aligned bit. Existing fixtures0x5600/0x3200 therefore assert behavior that differs from this independent source configuration; roundtrip or CPU/GPU checks that share the same XOR assumptions cannot settle that semantics question.

I also checked the cited Mesa bridge at pinned 418c4cfa ac_surface.c: Addr2ComputePipeBankXor output becomes surf->tile_swizzle; ac_descriptors.c ORs that into the256-byte color base for GFX9+. AMD's generator leaves the two column bits unset in this configuration. This supports using generated legal codes in the tests; it does not establish how PS5 should handle arbitrary reserved raw CB_BASE bits. Masking, rejecting, or preserving those bits needs that distinction resolved before changing DecodeColorBuffer generally.

Limits: no console measurement; no title observed invoking those non-pipe/bank bits. A broader R_X coordinate sweep also diverges beyond these origin differences and remains under investigation; I am not attributing its aggregate failures solely to this mask. Suggested follow-up: add independent source-expected offsets/legal generated values, then separately settle unsupported raw bits and any coordinate-table differences. Keeping this on the existing PR to avoid a premature duplicate issue. No PR created; all experimental work remains fork-only. AI-assisted validation/report: Codex.

The broader sweep is now resolved into a different, confirmed source-model gap, tracked in new issue3475. With only legal codes0/0x0f/0x40/0xcf, unchanged main gives 95,156 differences/536,940 comparisons,5/5 repeatable, confined to64/128bpp R_X surfaces spanning blocks. For example33x65/64bpp/(0,64)/zero XOR: AnyPS5=0x10000,AMD=0x10800. ColorTargetLayout drops higher-coordinate XOR contributions by evaluating per-block coordinates. Changing only the external R_X probe's production offset path to use full x/y in the existing equation, with no XOR masking/table/geometry changes, gives zero differences across the same sweep5/5. The new issue includes the128bpp example and suggested correction. This separates the coordinate defect from the arbitrary-column-bit question above; no console/title/render claim. It is not a runtime-tested or committed correction yet.

The separate D64 mapping proposal now uses legal test values and ten fixed independent AMD-source offsets; fork3034273, no PR. Current-base CPU/GPU D64 groups pass5repeats before and after the full suite. Full833:822 pass,5 skip,6 failures (Windows unwind and flat_apertures0/2/3/4/5); those failures remain reported on their existing issues. AI-assisted validation/report: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108358021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1735#issuecomment-6108358021). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-11T11:05:09Z. --- ### Independent AMD-source validation: XOR input/test coverage discrepancy (main74981fa, 2026-10-11) While validating the separate missing D64KBX mode in #2970, I compared **unmodified main74981fabe1c0fc56b561914beb027ddc9b07d358** ColorTargetLayout against compiled, unmodified [AMD PAL addrlib c5e80007](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/imported/addrlib/src/gfx10/gfx10addrlib.cpp). This exposes a source/model mismatch for some XOR inputs accepted by this PR's tests; it is **not a measured PS5 defect or a claim that valid, driver-generated XOR values are broken**. Windows 11, Winlibs GCC15.2.0r7, standalone production-source CPU probe. Addrlib configuration is **synthetic GFX10.1 non-RB+, family0x8f/revision0x82, GB_ADDR_CONFIG0x00100044,16pipes/256-byte interleave**, matching the table model under investigation, not measured console registers. Directly linked main's ColorTargetLayout.cpp/header (Git blobs b4deb5dd/8c492a1a); no D64 changes in this control. **Minimal independent reproduction:** SW_64KB_R_X,2D,color/texture,noMetadata,1x1,1slice/1mip/1sample/1fragment; bpp=8/16/32/64/128. Compare ColorTargetLayout(1,1,RenderTarget,bpp/8,code<<8).Offset(0,0) with Addr2ComputeSurfaceAddrFromCoord using the same geometry and pipeBankXor=code. Test codes0,0x0f,0x10,0x20,0x30,0x40,0x56,0xcf,0xff. **45 comparisons,25 discrepancies, identical across5 runs.** | API XOR code | AnyPS5 byte offset | AMD-source byte offset | |---|---:|---:| |0x10|0x1000|0| |0x20|0x2000|0| |0x30|0x3000|0| |0x56|0x5600|0x4600| |0xff|0xff00|0xcf00| These results hold at the origin for all five element sizes. The other tested codes match. AMD HwlComputeSurfaceAddrFromCoordTiled masks the code with pipeMask|bankMask before shifting8bits. Here pipeMask=0x0f; ColumnBits=2; two bank bits start at bit6, yielding **code mask0xcf / byte mask0xcf00**. AnyPS5 applies every accepted256-byte-aligned bit. Existing fixtures0x5600/0x3200 therefore assert behavior that differs from this independent source configuration; roundtrip or CPU/GPU checks that share the same XOR assumptions cannot settle that semantics question. I also checked the cited Mesa bridge at pinned [418c4cfa ac_surface.c](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/418c4cfa6708a0e0b1175e72fb8fd27d3ca1615a/src/amd/common/ac_surface.c): Addr2ComputePipeBankXor output becomes surf->tile_swizzle; [ac_descriptors.c](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/418c4cfa6708a0e0b1175e72fb8fd27d3ca1615a/src/amd/common/ac_descriptors.c) ORs that into the256-byte color base for GFX9+. AMD's generator leaves the two column bits unset in this configuration. This supports using **generated legal codes** in the tests; it does not establish how PS5 should handle arbitrary reserved raw CB_BASE bits. Masking, rejecting, or preserving those bits needs that distinction resolved before changing DecodeColorBuffer generally. Limits: no console measurement; no title observed invoking those non-pipe/bank bits. A broader R_X coordinate sweep also diverges beyond these origin differences and remains under investigation; I am **not attributing its aggregate failures solely to this mask**. Suggested follow-up: add independent source-expected offsets/legal generated values, then separately settle unsupported raw bits and any coordinate-table differences. Keeping this on the existing PR to avoid a premature duplicate issue. No PR created; all experimental work remains fork-only. AI-assisted validation/report: Codex. ### Broader legal-value discrepancy isolated and tracked separately (2026-10-11) The broader sweep is now resolved into a **different, confirmed source-model gap**, tracked in new [issue3475](https://github.com/boykopovar/AnyPS5/issues/3475). With only legal codes0/0x0f/0x40/0xcf, unchanged main gives **95,156 differences/536,940 comparisons,5/5 repeatable**, confined to64/128bpp R_X surfaces spanning blocks. For example33x65/64bpp/(0,64)/zero XOR: AnyPS5=0x10000,AMD=0x10800. ColorTargetLayout drops higher-coordinate XOR contributions by evaluating per-block coordinates. Changing **only the external R_X probe's production offset path to use full x/y in the existing equation**, with no XOR masking/table/geometry changes, gives **zero differences across the same sweep5/5**. The new issue includes the128bpp example and suggested correction. This separates the coordinate defect from the arbitrary-column-bit question above; no console/title/render claim. It is not a runtime-tested or committed correction yet. The separate D64 mapping proposal now uses legal test values and ten fixed independent AMD-source offsets; [fork3034273](https://github.com/Amoenus/AnyPS5/commit/3034273d87c652fc00dc9851f7c378f0fc148ff6), no PR. Current-base CPU/GPU D64 groups pass5repeats before and after the full suite. Full833:822 pass,5 skip,6 failures (Windows unwind and flat_apertures0/2/3/4/5); those failures remain reported on their existing issues. AI-assisted validation/report: Codex.
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!1735
No description provided.