Skip to content

fix(agc): retain offchip LDS enable during shader fusion - #6653

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-fusion-offchip-lds
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-fusion-offchip-lds

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

GS shader-half fusion rejects Cocoon (PPSA08766, bring-up #6651) when the front half requests SPI_SHADER_PGM_RSRC2_GS.OC_LDS_EN and the back half does not:

sceAgcGetFusedShaderSize_0080: front half requires hardware state the back half does not enable

The observed resource words are front 0x70004, back 0xab0020; the unmatched bit is 0x40000. Bit 18 is OC_LDS_EN in AMD's GFX10 register definitions.

Preserve this enable when either half requests it, yielding 0xaf0004 for that pair. User SGPR allocation still comes from the front half, other state remains with the back half, and other unmatched hardware requirements still throw. The technical debt entry records that this merge is inferred from retaining the halves' requirements; console fusion output has not been measured.

This is a later startup stop reached with graphics changes; unmodified main stops Cocoon earlier on geometry output assembly. This PR does not make Cocoon boot or claim a performance gain. The native sequence and full integration stack are recorded in #6651.

Tested

Arch Linux 7.2.9, GCC 16.2.1, Release, Ryzen 9 7950X, Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1.

  • Built agc_shader_fusion_tests on current main 5d9dcc42d plus only this commit (522696d1c), with the pinned submodules. ctest -R '^agc_shader_fusion$' --output-on-failure passes without skipping.

  • Added all four combinations of front/back OC_LDS_EN, checking the size query and fusion output, plus the exact Cocoon resource pair. Existing rejection of another unmatched hardware-state bit remains tested.

  • Negative control on that same main-based tree: restoring only MergeRsrc2 to main's implementation makes the new test fail with the hardware-state refusal; restoring this change passes.

  • Native Cocoon on the experimental stack in Cocoon (PPSA08766) #6651: without this change, the size query aborts on the resource pair above. With this change, startup passes it and aborts at VGT_SHADER_STAGES_EN=0x2135: combined tessellation and geometry is unsupported by the reference path. Still no visible menu or gameplay. Other graphics changes are needed to reach this call; their necessity was not ablated individually.

  • Current-main integration recheck: main 2626e5ee7e57df6e952a93a997a8b9fc79d80c08 plus refreshed feat(agc): rasterize geometry points with their point size #6801/feat(agc): draw point lists on the vertex path with their point size #6639 reaches the fusion refusal. Adding only this PR's commit gives local integration 943ab33635869df874f30110a8b4e3e44bed8400: agc_shader_fusion, agc_driver_mesh and request_serializer all pass on RX 6650 XT / RADV Mesa 26.2.4, with Vulkan required and no skips. Native Cocoon then reaches the later VGT_SHADER_STAGES_EN=0x2135 combined tessellation/geometry refusal after 24.09 s, with a fresh writable cache and no input. The game PID is gone and the kernel setting restored. No gameplay/rendering/performance claim; this is an integration result, not a standalone-main title run.

The device-backed fusion test verifies metadata/layout and registration; it does not establish rendered correctness of the title. Windows/macOS and other GPUs were not tested locally.

Contributor-reported Windows validation by Neithennn: head 522696d1c merged onto main f51724078, Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 driver 617.42, Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Full build and agc_shader_fusion pass; full ctest -j8 reports 1398/1398 for both this PR and unchanged main. No title run. These results were reported by the contributor, whose testing was AI-assisted with Claude Code; they were not reproduced locally.

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; no silent stub added
  • No notes, investigation files or images added to the repository
  • No new third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA08766 Cocoon (PPSA08766) #6651 (later shader-fusion stop; additional graphics work required)
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Arch Linux 7.2.9; device-backed fusion regression, no title rendering claim; NVIDIA GeForce RTX 4080, driver 617.42, Windows 11 Pro 26200 (contributor-reported by Neithennn)
  • AI-assisted: yes

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same result on NVIDIA and lavapipe.

Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. Head 522696d1c merged into main 5d9dcc42d (clean merge), -j1 --timeout 30.

  • Tests only (ShaderFusion.cpp restored from main): agc_shader_fusion fails on both devices with sceAgcGetFusedShaderSize_0080: front half requires hardware state the back half does not enable.
  • With the fix: agc_shader_fusion passes 3/3 on the RTX 3070 and 3/3 on lavapipe, with no skip.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@JJenkx

JJenkx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Manually reviewed the comparisons the bot could not perform: #5877 at 28b726e18 changes interpolant-mapping call-site evidence; #5889 at d6465ccff changes the initialization ABI/debt; #6447 at 1547b5dfc only removes the old sceAgcUpdateInterpolantMapping_0100 stub from ShaderFusion.cpp, alongside unrelated debt updates. None changes MergeRsrc2 or implements the OC_LDS_EN propagation here.

These are shared-file edits, not prerequisites of this fix. Depends on: none remains accurate. This branch is mergeable against current main 5d9dcc42d; any later debt conflict will be resolved during rebase with the documented debt-split workflow.

AI-assisted: yes.

@Neithennn

Copy link
Copy Markdown
Contributor

Windows NVIDIA run, since the description lists RADV only.

Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Head 522696d1c merged onto main f51724078; full build succeeds.

  • agc_shader_fusion: passes.
  • Full ctest -j 8: 1398/1398. Unchanged main on the same machine: 1398/1398.

No title run.

AI-assisted: yes (runs done with Claude Code).

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit bda28c6 into boykopovar:main Oct 19, 2026
11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff against the description: OC_LDS_EN (bit 18) is kept when either half requests it, user SGPRs still come from the front half, other unmatched state still throws. The new test covers all four front/back combinations plus the reported Cocoon pair (0xaf0004), and fails on main at the size query. The debt entry states the merge is inferred, not measured. Third-party NVIDIA/lavapipe and Windows runs match. Merging through the queue.

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

Labels

agc libSceAgc* docs unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants