Skip to content

fix(shader): preserve NGG passthrough and wave32 launch inputs - #143

Merged
boykopovar merged 5 commits into
boykopovar:mainfrom
SamG-Coder:codex/shader-geometry-validation
Oct 1, 2026
Merged

boykopovar merged 5 commits into
boykopovar:mainfrom
SamG-Coder:codex/shader-geometry-validation

Conversation

@SamG-Coder

@SamG-Coder SamG-Coder commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Route supported NGG passthrough triangle draws through the mesh translation path, preserving launch registers, packed primitive inputs, wave32/wave64 behavior, and the hidden-word prefix used by vertex-table metadata.

Rebased onto upstream c088b87. The #113 and #133 foundations are now upstream and are no longer included as dependency commits. Request serialization uses version 6 for the passthrough field, preserving upstream's version-5 pixel-input layout. Point/line passthrough remains unsupported.

Current validation

Windows / RTX 5080:

  • Final full build passed; 88/88 CTest tests passed at 5bcb6ea.
  • Fresh converted PS5-targeted demos passed wave32/wave64 passthrough, mesh launch, cross-wave shared-memory, and raw vertex-table position fetching: eight positive cases.
  • The deliberately corrupted shared-memory case produced the expected failure colour and was rejected by the positive image expectation.
  • Independent full triangle/background pixel checks passed for the launch/shared-memory cases and both vertex-table cases.
  • All eight positive demos, the negative control, and both independent pixel oracles were rerun on final commit 5bcb6ea after adapting to the upstream driver-module refactor.

The older strip, FP16 and full-program compilation results are historical coverage and were not rerun for this update. No physical-console, complete-application, performance or clean-exit claim is made. Captures stop after readback. Demos and reports remain outside Git; no application shader assets are included.

#147 is superseded: its optional-pointer fix is now upstream, and its remaining geometry changes are consolidated here. No unmerged dependencies. AI-assisted: yes.

@SamG-Coder
SamG-Coder marked this pull request as draft September 29, 2026 03:17
@SamG-Coder
SamG-Coder marked this pull request as ready for review September 29, 2026 03:26
@STL1te STL1te mentioned this pull request Sep 29, 2026
5 of 9 tasks
@github-actions github-actions Bot added build shader core/shader agc libSceAgc* needs rebase Conflicts with main, rebase needed labels Sep 29, 2026
@SamG-Coder
SamG-Coder force-pushed the codex/shader-geometry-validation branch from 15012f3 to ab48b92 Compare October 1, 2026 10:11
@SamG-Coder
SamG-Coder force-pushed the codex/shader-geometry-validation branch from ab48b92 to 5bcb6ea Compare October 1, 2026 10:46
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 1, 2026
@boykopovar
boykopovar merged commit de49f81 into boykopovar:main Oct 1, 2026
3 checks passed
boykopovar added a commit that referenced this pull request Oct 1, 2026
Revert "Merge pull request #143 from SamG-Coder/codex/shader-geometry…
Pacuka pushed a commit to Pacuka/AnyPS5 that referenced this pull request Oct 1, 2026
…r-geometry-validation"

This reverts commit de49f81, reversing
changes made to cfb1d76.
@boykopovar

Copy link
Copy Markdown
Owner

#258

Revert "fix(shader): preserve NGG passthrough and wave32 launch inputs"
due to a regression detected on Dreaming Sarah.

The image wasn't displayed (black screen). Related logs:

[gpu] skipped draw: AGC graphics: VGT_SHADER_STAGES_EN=0x2002000: unsupported geometry input or output assembly [DRAW_IN
DEX_AUTO, color target 0x120c560000]
[gpu] skipped draw: AGC graphics: subgroup capability 61 is unsupported for shader stage 128 [DRAW_INDEX_OFFSET_2, color
 target 0x120cce0000]
[gpu] skipped draw: AGC graphics: subgroup capability 61 is unsupported for shader stage 128 [DRAW_INDEX_OFFSET_2, color
 target 0x120c560000]
[gpu] skipped draw: AGC graphics: subgroup capability 61 is unsupported for shader stage 128 [DRAW_INDEX_OFFSET_2, color
 target 0x120b7c0000]

The problem is also described in #256

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 2, 2026
… PlayGo, Fiber, CesCs, Http, Ssl, RT miss) into astrobot

boykopovar#143 (NGG passthrough) stays: upstream's revert (7c5f8b6, boykopovar#258) is
undone inside this merge, so its 15 files match astrobot except for
c3a740b's RayTracingMiss lines in CacheKey.hpp and Recompiler.hpp.

Conflicts resolved:
- libScePad Export.cpp: astrobot's APS5_TRACE_PAD_OUTPUT helpers and
  upstream's ValidPort, g_opened and PAD_ERROR_DEVICE_NO_HANDLE share one
  anonymous namespace; scePadGetHandle and the mic vibration option are
  upstream's.
- CacheKey.hpp: RayTracingMiss follows RayTracingStrict, then astrobot's
  GpuSelectedDescriptors and WaveLayoutFor.
- Recompiler.hpp: both declarations.
- RequestSerializer.cpp: request serialization stays version 7 (6 adds
  the mesh passthrough flag, 7 nonConstantImageOffsets). Upstream's only
  change here was the revert back to 5 and adds no field, and its version
  5 requests still read correctly.
- TechnicalDebt.md: upstream's keyboard entry is taken, and the to-intel
  trampoline entry appears once, where upstream lists it.
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 2, 2026
…opovar#251 execution tests, NGS2/audio boykopovar#236-boykopovar#248, boykopovar#249, boykopovar#292, our boykopovar#246) into astrobot

Conflicts:
- tests/Recorder.cpp: our boykopovar#246 commit is already on astrobot (3a494ec) along
  with the later key-fill tests, so ours is kept; every line upstream's boykopovar#246
  added is present once.
- RdnaOpcode.hpp: upstream's order (SClause before SCbranchCdbg, then the cache
  and perf-hint no-ops).
- SpirvAluEmitterMath.cpp: v_writelane fix landed on both sides with the same
  semantics; ours kept.
- libSceNgs2.native: upstream's NGS2 (system, racks, voices, ATRAC9, tests)
  replaces astrobot's single-file port. Astro Bot imports no NGS2 functions.
  Upstream left the Geom and Pan helpers as throwing stubs, so astrobot's
  working versions move to src/GeomPan.cpp in place of Unimplemented.cpp.
  libSceNgs2's stub layer and VerboseLog.hpp (used only by the old port) go.
- TechnicalDebt.md: both entries kept.

boykopovar#143 (NGG passthrough) stays as on astrobot: upstream did not touch its files
since the boykopovar#258 revert. The recompile request serialization stays at version 7.
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 3, 2026
…oykopovar#304 boykopovar#305 boykopovar#306 boykopovar#322 boykopovar#409 boykopovar#416, boykopovar#276 boykopovar#277 boykopovar#275 boykopovar#307, shader ops boykopovar#226 boykopovar#255 boykopovar#260 boykopovar#280 boykopovar#308 boykopovar#309 boykopovar#311 boykopovar#318 boykopovar#320 boykopovar#324 boykopovar#326 boykopovar#379 boykopovar#384 boykopovar#399, boykopovar#261, kernel boykopovar#335 boykopovar#341 boykopovar#349 boykopovar#355, libs boykopovar#227 boykopovar#244 boykopovar#245 boykopovar#273 boykopovar#274 boykopovar#279 boykopovar#286 boykopovar#287 boykopovar#289 boykopovar#296 boykopovar#300 boykopovar#328 boykopovar#358 boykopovar#402) into astrobot

Where our PR merged in a revised form, main's version is taken; where
astrobot carries the same work plus later local commits, astrobot's code
stays and main's additions appear once.

Conflicts:
- AvPlayer (Export.cpp both libs, include/AvPlayer.hpp, src/Player.cpp,
  src/Source.cpp, AvPlayerLibrary.cmake, CMakeLists.txt, SceTypes.hpp,
  tests/GuestAvPlayer.cpp): main's boykopovar#307 (our reviewed squash, which carries
  9c8e7fd e9ea5c8 adcede3 fb4eeb9 953057c ac456ee). It links the
  shared ffmpeg-core target, so astrobot's second FFmpeg build goes:
  3rdparty/FFmpeg submodule, core/libs/FFmpeg.cmake and src/Exports.cpp.
- libScePngEnc: main's boykopovar#227 (supersedes OverkillLabs' encoder).
- libScePad Export.cpp: main's boykopovar#287 tilt correction (supersedes 49d45f5).
- libSceAudioPropagation Export.cpp: astrobot's object model, which
  defines every function boykopovar#289 declares as a stub.
- libSceSaveData.native Export.cpp: both (SaveDataHoldWrites and boykopovar#289's
  unknown exports).
- VideoOutDriver.cpp: astrobot's (2546bd1 counters around boykopovar#416's
  lastFlipVblank store, same value). tests/Flip.cpp: boykopovar#416's pacing test and
  boykopovar#417's after-GPU test both kept.
- boykopovar#278 files (DisplayFormat, VulkanDevice, GpuColorTransfer,
  ResidentPresent, agc CMakeLists): main's comment-free boykopovar#278 plus
  astrobot's P5 present-direct (b29728d), which removed DetileImage,
  ResidentPresent.hpp and the recorder-test hook; the resident present test
  stays its own executable.
- VulkanDevice.cpp/.hpp: astrobot's GDS, local memory probe, sample dumps
  and P5 code; boykopovar#303/boykopovar#409 comments as main has them; main's shader clock
  (boykopovar#324) and DepthSurface-free includes.
- RequestSerializer.cpp: version stays 8 (6 mesh passthrough, 7
  nonConstantImageOffsets, 8 astrobot's later field). boykopovar#303's auto-merged
  second write and read of nonConstantImageOffsets removed.
- SpirvEmitter.hpp, SpirvEmitterState.hpp, Recompiler.hpp/.cpp, StageIO.hpp,
  SpirvOptimizer.cpp, InstructionTranslator.cpp, ShaderReplay.cpp: local
  fields kept, boykopovar#303/boykopovar#305 comments as main has them.
- SpirvAluEmitterMath.cpp: v_readlane keeps the split-wave path and takes
  boykopovar#322's wrap at the wave size for the others.
- SpirvEmitter.cpp: astrobot's single-lane layout check.
- SpirvFlowEmitter.cpp: boykopovar#304 as merged (the second lane emits a shared
  value itself when the first lane defined nothing).
- SpirvImageEmitter.cpp: main's Offset operand placed before MinLod.
- boykopovar#304: main's WaveUniformValues (SpirvAnalysis.cpp) replaces astrobot's
  copy in SpirvWaveExchange.cpp.
- Recorder.hpp/.cpp, Draw.hpp, Graphics Draw.cpp, ShaderResources.cpp:
  astrobot's boykopovar#276/boykopovar#277 with its later snapshot work (per-use budgets,
  stale-snapshot refresh, profile counters, boykopovar#410, boykopovar#424, fan GS); boykopovar#409/boykopovar#306
  comments as main has them.
- PacketMemory.cpp: boykopovar#409 as merged plus astrobot's two opt-outs.
- tests: ShaderMemory.cpp takes boykopovar#303's and boykopovar#304's new tests; Recorder.cpp
  takes boykopovar#409's afterRecordedWorkTests and drops main's copies of the
  boykopovar#276/boykopovar#277 tests astrobot already has; Structurizer.cpp keeps boykopovar#413's case.

boykopovar#143 (NGG passthrough) stays as on astrobot: upstream did not touch its
files since the boykopovar#258 revert.
SP4C3B4R-8 pushed a commit to SP4C3B4R-8/AnyPS5 that referenced this pull request Oct 7, 2026
Since boykopovar#143 every draw with PRIMGEN_PASSTHRU_EN took the emulated mesh path.
PPSA02929's draws (VGT_SHADER_STAGES_EN 0x2002000) lost their 5 rect-list
draws (the fog, which the mesh path refuses) and drew misplaced tiles,
stripes and garbled menu text from its recorded triangle draws, at half
the frame rate of the vertex path. PPSA21564 only needed the mesh path
because the vertex path left the NGG system SGPRs at zero: its fullscreen
pass (0x50070c800) reads its vertex count from GS_TG_INFO and exported
nothing on the vertex path.

In passthrough mode the geometry engine assembles the primitives and the
program exports them unchanged, so a program whose vertex outputs depend
only on its own vertex runs exactly as a vertex shader. The decoder now
proves this per program and subgroup shape: the program is translated as
a vertex shader with the subgroup inputs (s0 to s7, the GS input VGPRs,
the lane) as opaque values, and every value that depends on them must be
a boolean that evaluates the same for every lane, wave and subgroup count
the geometry engine can launch (GE_CNTL) and for the vertex path's own
context, the primitive export must send the received v0 for every
allocated primitive, and LDS, cross-lane operations, ballots, barriers
and memory writes are refused. A program that passes takes the vertex
path for any topology; the others keep the mesh path. The vertex path now
gives a merged program a full one-wave subgroup in GS_TG_INFO and
MERGED_WAVE_INFO. APS5_NGG_PASSTHROUGH_MESH=1 sends every passthrough
draw to the mesh path as before, and APS5_TRACE_NGG_PASSTHROUGH=1 prints
each program's path.

PPSA02929's 5 passthrough programs and 59 of PPSA21564's take the vertex
path. PPSA02929 renders its menu text, fog and tiles at 60 fps in
gameplay (31 before); PPSA21564's gate passes at the same frame rates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants