[draft] Atelier Yumia: boot fixes, audio output, tessellation and pipeline cache determinism #1744
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1744
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1744/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@MrBigBritches on GitHub · 2026-10-20 01:31 UTC · original
MrBigBritches:yumia-fixes→main· +682 −82 · 25 files · 8 commits · closed without merging[draft]
Depends on PR #1683, #1684, #1687
Gets Atelier Yumia (PPSA25468) past the logos into gameplay, with audio, at ~60 fps once the pipeline cache is warm.
Shader decoding
S_SETREG_IMM32_B32(SOPK 0x15) with its trailing literal; translate as a control no-op likeS_SETREG_B32.Audio (NGS2)
Ngs2SystemRenderonly mixed standard mastering voices, so games mastering through custom racks were silent. The setup (input channels) and output (output id) controls are now handled.Clipping
PA_CL_UCP_*writes are stored rather than rejected (PA_CL_CLIP_CNTLcan be written after them).ClipCheckacceptsUCP_ENAplanes backed by exported clip distances, only rejects modifiers that apply to the current state, and prints the clip state when it rejects.ClipDistance, with plane equations passed in push constants so plane changes don't recompile shaders.Tessellation
mov,add,add3,mul_lo,subrev, exactor/and/shift forms, the patch ordinal viav_and_b32 0xff, and constants moved into SGPRs/VCC.Pipeline cache and diagnostics
Testing
tests/shaderCfgTests.cpp: trap temporaries at code 0x6f and a trailing-dword length test. The new decoder cases were run in a standalone harness; please run the full test suite in CI.Known limitations
0x10,0x13,0x19, …) still pass audio through unprocessed, and side-chain ducking isn't applied.@MrBigBritches on GitHub · 2026-10-20 01:33 UTC · original
#1627
@theantipopau on GitHub · 2026-10-20 01:36 UTC · original
Huge result — logos to gameplay with audio at 60fps! Some coordination notes since this stacks on my PRs:
@coderabbitai[bot] on GitHub · 2026-10-20 01:38 UTC · original
📝 Walkthrough
The changes add user clip-plane handling across guest register storage, graphics draw data, and SPIR-V output. Tessellation analysis and interfaces now track per-patch data. Shader decoding adds trap-temporary registers and an immediate register-setting opcode. Custom audio rack rendering and controls change. Renderer diagnostics, cache checkpoints, compilation logs, and spill allocation also change.
Suggested reviewers:
nmzik,senaxx,shadowbeat070Priority: ➖ Normal
Change: Bug fix
Merge Risk: 🟡 Moderate · up to
b4f3dThe new NGS2 custom-rack support still aborts when a title connects a side-chain input. Custom mastering setup can also abort for valid rack options. Fix these before relying on the audio path, because they can stop the game's audio initialization or rendering. A narrower tessellation-analysis edge case can also reject valid shaders.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 23 files. (2 skipped: 2 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -88,0 +208,4 @@}if (!reachable) {continue;}@coderabbitai[bot] on GitHub · 2026-10-20 01:38 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Mark code after
S_ENDPGMas unreachable before the forward-branch join.The new reachability tracking sets
reachable = falseonly afterS_BRANCH. The analysis keepsreachable == trueafterS_ENDPGM. Assume a forward branch target follows a path that ends withS_ENDPGM. At that target, Line 177 merges the terminated fall-through state with the branch state. Line 178 then sets toKind::Unknownevery VGPR whose value differs between the two paths. The same rule applies to SGPR constants at Line 179. The terminated path cannot reach the join. If such a register forms a later HS/LS ring address, Line 228 gets a non-affine value. Line 230 then stops with "tessellation address is not affine", but the address is affine on every live path.A typical trigger is a shader that ends one branch with an early
s_endpgmand puts the other branch after it:If
IsDirectBranchalready coversS_ENDPGM, this issue does not apply.🐛 Proposed fix
📝 Committable suggestion
@ -1782,0 +1797,4 @@port.sidechain_warned = true;}continue;}@coderabbitai[bot] on GitHub · 2026-10-20 01:38 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
The side-chain drop path cannot run. Every nonzero
port.inputstill aborts.Ngs2RackCreatecallsNgs2InitModulesfor every custom rack.Ngs2InitModuleshas the checkEXIT_NOT_IMPLEMENTED(custom.num_buffers != 1)(Line 1195). So any custom rack that exists hasnum_buffers == 1. A rack withnum_buffers > 1aborts during creation.Now take a destination port with
port.input != 0. The checkport.input >= custom.num_buffersis the same asport.input >= 1, which is always true. SoEXIT_NOT_IMPLEMENTEDfires every time. The warning and thecontinuenever run. The comment on Lines 1786-1788 says side-chain inputs come fromnum_buffers > 1, andNgs2InitModulesrejects exactly that setup.To fix this, use one of these options:
num_buffers != 1check inNgs2InitModulesso it accepts extra buffers. Modules still needsource_buffer_id/dest_buffer_id0; Lines 1833-1834 already enforce that.port.inputagainst a limit that the code does not force to 1.🐛 Proposed fix (relax the creation check)
🧰 Tools
🪛 ast-grep (0.45.3)
[error] 1793-1796: Use of an unbounded buffer function that can overflow the destination; use a size-bounded equivalent (fgets, strncpy/strlcpy, strncat/strlcat, snprintf).
Context: fmt::sprintf(
"warning: NGS2 side-chain input %u of a custom rack is not emulated, "
"dropping it\n",
port.input)
Note: [CWE-120] Buffer Copy without Checking Size of Input ('Classic Buffer Overflow').
(dangerous-buffer-functions-cpp)
@ -2488,0 +2513,4 @@case 0:EXIT_NOT_IMPLEMENTED(param->size < sizeof(Ngs2VoiceParamHeader) + 8u);EXIT_NOT_IMPLEMENTED(values[0] == 0 ||values[0] > voice->rack->option.common.max_voice_channels);@coderabbitai[bot] on GitHub · 2026-10-20 01:38 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Validate the channel count against
custom_mastering.max_channels, notcommon.max_voice_channels.Ngs2CustomMasteringRackOptionhas its ownmax_channelsfield. The standard submixer setup validates againstoption.submixer.max_channels(Line 2381). This code usesrack_option.max_voice_channelsinstead, which is a different field. A title can setmax_channelscorrectly and leavemax_voice_channelsat 0. In that case every custom mastering setup call aborts at this check.🐛 Proposed fix
📝 Committable suggestion
@coderabbitai[bot] on GitHub · 2026-10-20 01:38 UTC · original · reviewed
Actionable comments posted: 3
🧹 Nitpick comments: 1
ℹ️ Review info
⚙️ Run configuration
38bbb2c1-dc9c-4655-afa3-b80a951b8ef9📥 Commits
Reviewing files that changed from the base of the PR and between
f186b35706andb4f3dc1ec8.📒 Files selected for processing: 25
src/graphics/guest_gpu/command_processor/pm4Handlers.cppsrc/graphics/guest_gpu/hardwareContext.hsrc/graphics/host_gpu/renderer/debug.cppsrc/graphics/host_gpu/renderer/masterSemaphore.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/shaders.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/shader/recompiler/Tessellation.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterTessellation.cppsrc/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.hsrc/graphics/shader/recompiler/frontend/translate/Scalar.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.cppsrc/graphics/shader/recompiler/ir/Reg.hsrc/graphics/shader/recompiler/ir/ShaderIR.hsrc/graphics/shader/shader.cppsrc/graphics/shader/shader.hsrc/libs/ngs2.cpptests/ShaderRecompilerComputeTests.cpptests/shaderCfgTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@theantipopau on GitHub · 2026-10-20 01:49 UTC · original
Chunk 1 review (decode: S_SETREG_IMM32 + EncodedWordCount) — verified against the ISA layouts, looks right:
I'll take chunk 2 (NGS2 custom mastering) next.
@theantipopau on GitHub · 2026-10-20 01:50 UTC · original
Chunk 2 review (NGS2 custom mastering) — the direction matches #1683/#1684's degrade-don't-abort philosophy and the headline fix is right (custom mastering voices now reach the mix). Two questions:
The rest reads clean: in-range side-chains warn-once-and-drop while out-of-range still aborts, 0x4003 setup/output mirrors standard mastering with channel-count validation, and unknown sub-controls warn-and-ignore.
@theantipopau on GitHub · 2026-10-20 01:51 UTC · original
Chunk 3 review (clipping/UCP) — this is well designed. Verified end to end: coefficients stored at write time (order-independent vs UCP_ENA, fixing the old abort-on-write); emulated mask excludes shader-exported distances and collapses under CLIP_DISABLE; ClipCheck now only aborts on genuinely unemulatable combos (exported-but-not-enabled distances, modifiers on enabled planes, kill/viewport-index exports); push layout reserves UserClipPlaneDword + 4*planes with upload and emitter iterating planes ascending so slots agree; the mask is in the static pipeline key while equations stay dynamic (no recompile on plane changes); ClipDistance budget guarded at 8 with user planes prioritized over the clipping-error guard. GetUserClipPlane is only reached with plane < 6 via the 0x3f-masked loops. No notes.
@theantipopau on GitHub · 2026-10-20 01:51 UTC · original
Chunks 4–5 review (tessellation + diagnostics/misc) — done, and with that I've covered the whole PR:
Tessellation: sound over-approximation throughout. Backward branches fail loud (fixpoint needed — correct), forward joins merge-or-adopt with reachability, disjoint-or/and-masks/shifts all carry exactness side-conditions, scalar kill-set erases self+neighbor (conservative), 64-bit DS ops symmetric on reads/writes, constant-store patch bounds guarded against UINT32 overflow with the empty-set case pinned to [0,0). The VCC scalar keys (0x10000+) can't collide with SGPR numbers. No notes.
Misc: semaphore EXIT now names the tick + result (strictly better message, same abort); 1-minute driver-cache checkpoints trade negligible I/O for surviving early crashes; always-on SPIR-V hash log is cheap (compile-time only) and directly supports the determinism goal; clip-plane push wiring is consistent end to end (mask in key, ascending plane order both sides, draw_data sized to DwordCount, mesh/tess explicitly punted).
The spill_order fix deserves emphasis: pointer-keyed unordered_map iteration made SPIR-V nondeterministic across runs, silently defeating driver pipeline caches — creation-order vector is the right fix.
Summary across all five chunks: chunk 1 verified, chunk 2 has two open questions (loop-break gate removal, union read before type check), chunks 3–5 clean. Biggest remaining item is structural: land #1683/#1684/#1687 first, then rebase this down from +682.
@Nmzik on GitHub · 2026-10-20 13:43 UTC · original
@MrBigBritches
6b6274fa5aand others. Cherry picked. Sole credited to you Thanks!Pull request closed