Skip to content

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

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/journal-mesh-output-size
Oct 16, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/journal-mesh-output-size

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

main 65d56a2 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 feat(agc): draw line-strip output of NGG geometry programs as mesh lines #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 65d56a2 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 aff725b, before fix(agc): stop pixel invocations on BDA faults when supported #5804 merged, so it is in a case fix(agc): stop pixel invocations on BDA faults when supported #5804 added. The request it dumps is a 12-word vertex program whose code words are all zero, the same length as fix(agc): stop pixel invocations on BDA faults when supported #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

boykopovar#5884 added MeshConfiguration::outputPrimitiveSize, and boykopovar#5875's pipeline
journal guards the layouts it encodes. The two merged separately, so on
Linux with libstdc++ PipelineJournal.cpp no longer compiles:
MeshConfiguration is 40 bytes, ShaderStages (which holds an optional
one) 112. The guards now name those sizes, and the recipe codec writes
and reads the new field, so a replayed line-strip geometry pipeline
keeps its two-vertex primitives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 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.

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.

The layout guards only build on Linux with libstdc++, so a Windows or
macOS build of main after boykopovar#5884 wrote journals whose mesh records lack
outputPrimitiveSize under the new shader-cache source version. The
journal format is now 3, so such a file is discarded instead of being
read with the new codec. MarcZX100 pointed this out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello

Copy link
Copy Markdown
Contributor Author

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.

2d5f761 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

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

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

@MarcZX10 MarcZX10 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.

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

Amoenus commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

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.

@milescoviello

Copy link
Copy Markdown
Contributor Author

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants