fix(agc): journal the mesh output primitive size #6784

Merged
milescoviello merged 2 commits from upstream-pr/6784 into main 2026-10-16 12:03:21 +00:00
milescoviello commented 2026-10-16 11:39:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T11:39:45Z.


What

main 65d56a297 does not build on Linux with libstdc++ (GCC 13.3 here). PipelineJournal.cpp stops on its own layout guards:

Graphics/src/PipelineJournal.cpp:39:36: error: static assertion failed: ShaderStages changed: update the recipe codec
Graphics/src/PipelineJournal.cpp:40:59: error: static assertion failed: MeshConfiguration changed: update the recipe codec

#5884 added MeshConfiguration::outputPrimitiveSize, and #5875 guards the sizes of the structs its recipe codec encodes. The two merged separately. MeshConfiguration is now 40 bytes, and ShaderStages, which holds an optional one, is 112. The codec also didn't write the new field, so a replayed line-strip geometry pipeline would come back with the default of 3.

How

  • The guards name the new sizes.
  • encodeMesh and decodeMesh write and read outputPrimitiveSize after esgsItemSize.
  • The journal format is now 3. The layout guards only build on Linux with libstdc++, so Windows and macOS builds of main after #5884 wrote journals whose mesh records lack the field, under the new shader-cache source version. Those are now discarded instead of being read with the new codec. MarcZX100 pointed this out.

Tested

Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.

  • agc_pipeline_journal (agc_driver_graphics_tests --pipeline-journal): new case. A recipe for a mesh stage with outputPrimitiveSize 2 must decode with 2. With the guards fixed but the codec as on main, it fails 3 of 3 with the recipe dropped the mesh output primitive size. With this change it passes 3 of 3, as does agc_driver_pipeline_journal.
  • Same test: a journal whose header says format 2 must load no module and no recipe. With the format left at 2 it fails 3 of 3 with a journal in format 2, whose mesh records lack the output primitive size, was loaded. With 3 it passes 3 of 3.
  • On main 65d56a297 the library doesn't compile, so nothing above runs there.
  • With the build fixed, agc_driver_graphics fails here 3 of 3 with ShaderRecompiler::Recompile: VOP2 opcode is not implemented. It passed 3 of 3 on this change at main aff725bf6, before #5804 merged, so it is in a case #5804 added. The request it dumps is a 12-word vertex program whose code words are all zero, the same length as #5804's vertexBdaCode. I haven't found why; that should be a separate fix.

Not checked on Windows, macOS, on AMD or on a console.

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
  • Unblocks: the Linux build of main
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99, Ubuntu 24.04
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4887823845 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-16T11:39:45Z. --- ### What `main` 65d56a297 does not build on Linux with libstdc++ (GCC 13.3 here). `PipelineJournal.cpp` stops on its own layout guards: ``` Graphics/src/PipelineJournal.cpp:39:36: error: static assertion failed: ShaderStages changed: update the recipe codec Graphics/src/PipelineJournal.cpp:40:59: error: static assertion failed: MeshConfiguration changed: update the recipe codec ``` #5884 added `MeshConfiguration::outputPrimitiveSize`, and #5875 guards the sizes of the structs its recipe codec encodes. The two merged separately. `MeshConfiguration` is now 40 bytes, and `ShaderStages`, which holds an optional one, is 112. The codec also didn't write the new field, so a replayed line-strip geometry pipeline would come back with the default of 3. ### How - The guards name the new sizes. - `encodeMesh` and `decodeMesh` write and read `outputPrimitiveSize` after `esgsItemSize`. - The journal format is now 3. The layout guards only build on Linux with libstdc++, so Windows and macOS builds of `main` after #5884 wrote journals whose mesh records lack the field, under the new shader-cache source version. Those are now discarded instead of being read with the new codec. MarcZX100 [pointed this out](https://github.com/boykopovar/AnyPS5/pull/6784#pullrequestreview-5547279545). ### Tested Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99. - `agc_pipeline_journal` (`agc_driver_graphics_tests --pipeline-journal`): new case. A recipe for a mesh stage with `outputPrimitiveSize` 2 must decode with 2. With the guards fixed but the codec as on `main`, it fails 3 of 3 with `the recipe dropped the mesh output primitive size`. With this change it passes 3 of 3, as does `agc_driver_pipeline_journal`. - Same test: a journal whose header says format 2 must load no module and no recipe. With the format left at 2 it fails 3 of 3 with `a journal in format 2, whose mesh records lack the output primitive size, was loaded`. With 3 it passes 3 of 3. - On `main` 65d56a297 the library doesn't compile, so nothing above runs there. - With the build fixed, `agc_driver_graphics` fails here 3 of 3 with `ShaderRecompiler::Recompile: VOP2 opcode is not implemented`. It passed 3 of 3 on this change at `main` aff725bf6, before #5804 merged, so it is in a case #5804 added. The request it dumps is a 12-word vertex program whose code words are all zero, the same length as #5804's `vertexBdaCode`. I haven't found why; that should be a separate fix. Not checked on Windows, macOS, on AMD or on a console. ### 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] Unblocks: the Linux build of `main` - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99, Ubuntu 24.04 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-16 11:41:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T11:41:09Z.

Review: CHANGES_REQUESTED


The journal codec changes, but FileFormat remains 2. A journal written by main after #5884 can already carry the new ShaderDiskCache::SourceVersion() (the recompiler source hash includes the new mesh field) while still using the old encodeMesh layout. PipelineJournal.cpp is not part of that source-version hash, so this new decoder accepts that old journal header and then reads the added outputPrimitiveSize from the following field(s). Please bump the journal format (or add an equivalent codec-version discriminator) and add a regression showing that a journal written with the old mesh record is discarded, rather than parsed with the new codec.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5547279545 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#pullrequestreview-5547279545). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T11:41:09Z. **Review:** CHANGES_REQUESTED --- The journal codec changes, but `FileFormat` remains 2. A journal written by main after #5884 can already carry the new `ShaderDiskCache::SourceVersion()` (the recompiler source hash includes the new mesh field) while still using the old `encodeMesh` layout. `PipelineJournal.cpp` is not part of that source-version hash, so this new decoder accepts that old journal header and then reads the added `outputPrimitiveSize` from the following field(s). Please bump the journal format (or add an equivalent codec-version discriminator) and add a regression showing that a journal written with the old mesh record is discarded, rather than parsed with the new codec.
milescoviello commented 2026-10-16 11:45:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T11:45:46Z.


Thanks, you're right. The guards only build on Linux with libstdc++, so Windows and macOS builds of main after #5884 compiled and could write journals with the new source version and the old mesh records. My note in the description was wrong for those.

2d5f761cb bumps the journal format to 3. The journal test now rewrites a recorded journal's header to format 2 and requires the replay to load no module and no recipe. With the format left at 2 it fails 3 of 3 (a journal in format 2, whose mesh records lack the output primitive size, was loaded), and with 3 it passes 3 of 3. I've updated the description.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6214789922 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#issuecomment-6214789922). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-16T11:45:46Z. --- Thanks, you're right. The guards only build on Linux with libstdc++, so Windows and macOS builds of `main` after #5884 compiled and could write journals with the new source version and the old mesh records. My note in the description was wrong for those. 2d5f761cb bumps the journal format to 3. The journal test now rewrites a recorded journal's header to format 2 and requires the replay to load no module and no recipe. With the format left at 2 it fails 3 of 3 (`a journal in format 2, whose mesh records lack the output primitive size, was loaded`), and with 3 it passes 3 of 3. I've updated the description. AI-assisted: yes
github-actions[bot] commented 2026-10-16 11:47:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T11:47:21Z.


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 1395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4650 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5500 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6215 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6222 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6312 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6320 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6454 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6523 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6529 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6683 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6214816939 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#issuecomment-6214816939). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T11:47:21Z. --- <!-- 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 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6215](https://www.github.com/boykopovar/AnyPS5/pull/6215) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6312](https://www.github.com/boykopovar/AnyPS5/pull/6312) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6454](https://www.github.com/boykopovar/AnyPS5/pull/6454) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6523](https://www.github.com/boykopovar/AnyPS5/pull/6523) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6529](https://www.github.com/boykopovar/AnyPS5/pull/6529) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` |
MarcZX10 commented 2026-10-16 11:48:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T11:48:07Z.

Review: APPROVED


The format-3 bump closes the compatibility gap: old format-2 journals are discarded even when their shader source version matches, and the regression checks that replay loads neither recipes nor modules. The mesh round-trip test also checks outputPrimitiveSize alongside the neighboring field. Eligibility, conventions and report checks pass; the required relinker/platform jobs are skipped for this path. The focused runtime results are reported in the PR body. I found no remaining issue in the requested change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5547356482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#pullrequestreview-5547356482). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T11:48:07Z. **Review:** APPROVED --- The format-3 bump closes the compatibility gap: old format-2 journals are discarded even when their shader source version matches, and the regression checks that replay loads neither recipes nor modules. The mesh round-trip test also checks `outputPrimitiveSize` alongside the neighboring field. Eligibility, conventions and report checks pass; the required relinker/platform jobs are skipped for this path. The focused runtime results are reported in the PR body. I found no remaining issue in the requested change.
Amoenus commented 2026-10-16 12:18:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-16T12:18:50Z.


Independent confirmation: unmodified main65's PipelineJournal.cpp fails the ShaderStages and MeshConfiguration guards on Ubuntu24.04/GCC13.3. Your 2d5f761cb correction unblocks those in our retained integration 5e69b9642. Its codec implementation differs from your head only in the integration-only State size guard (768): extra runtime color metadata is explicitly excluded from the canonical recipe/key by a new test.

On that adapted pin, CPU journal tests pass3/3 on Windows and Linux, including the line-strip field and format-2 rejection assertions. GPU journal tests pass3/3 each on NVIDIA RTX5080 (610.62/32.0.16.1062), AMD Radeon Graphics (32.0.21036.18), Windows11 Enterprise26200 / WinLibs GCC15.2r7, and Linux Mesa25.2.8 llvmpipe. Physical/software identity is verified per GPU process. Affected libraries/targets build; this is not an exact-head full-suite claim.

The separate CPU graphics error you noted reproduces3/3 on unmodified post-merge main eb901bcf4; journal control3/3 passes. I filed #6792 with exact commands and the identical serialized zero-word vertex request, keeping that investigation separate from this codec correction. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215344869 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#issuecomment-6215344869). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-16T12:18:50Z. --- <!-- codex-journal-crossvendor-main65 --> Independent confirmation: unmodified main65's `PipelineJournal.cpp` fails the `ShaderStages` and `MeshConfiguration` guards on Ubuntu24.04/GCC13.3. Your `2d5f761cb` correction unblocks those in our retained [integration `5e69b9642`](https://github.com/Amoenus/AnyPS5/commit/5e69b9642a699c0cb81f71829349e95a77165fff). Its codec implementation differs from your head only in the integration-only `State` size guard (768): extra runtime color metadata is explicitly excluded from the canonical recipe/key by a new test. On that adapted pin, CPU journal tests pass3/3 on Windows and Linux, including the line-strip field and format-2 rejection assertions. GPU journal tests pass3/3 each on NVIDIA RTX5080 (610.62/32.0.16.1062), AMD Radeon Graphics (32.0.21036.18), Windows11 Enterprise26200 / WinLibs GCC15.2r7, and Linux Mesa25.2.8 llvmpipe. Physical/software identity is verified per GPU process. Affected libraries/targets build; this is not an exact-head full-suite claim. The separate CPU graphics error you noted reproduces3/3 on unmodified post-merge main `eb901bcf4`; journal control3/3 passes. I filed #6792 with exact commands and the identical serialized zero-word vertex request, keeping that investigation separate from this codec correction. AI-assisted: Codex.
milescoviello commented 2026-10-16 12:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T12:22:07Z.


Thanks for checking it across the four devices. The agc_driver_graphics failure you filed as #6792 comes from #5804's vertex terminate case: its request's code span sees 12 zero words. #6789 makes that case's vertexBdaCode array static constexpr. With it, the whole test passes 3 of 3 here, and it fails 3 of 3 without.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215399574 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6784#issuecomment-6215399574). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-16T12:22:07Z. --- Thanks for checking it across the four devices. The `agc_driver_graphics` failure you filed as #6792 comes from #5804's vertex terminate case: its request's code span sees 12 zero words. #6789 makes that case's `vertexBdaCode` array `static constexpr`. With it, the whole test passes 3 of 3 here, and it fails 3 of 3 without. AI-assisted: yes
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!6784
No description provided.