Astro Bot: ray tracing, and the SRT plan bug that dropped its lighting #558
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!558
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/558/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?
@defektu on GitHub · 2026-09-10 18:43 UTC · original
defektu:astrobot-raytracing→main· +6580 −1228 · 85 files · 80 commits · closed without mergingBrings Astro Bot (PPSA21564) to a rendering title screen, on top of the PR #500 shader/graphics rewrite.
The headline fix is a general one: flat SRT slots were handed to reads that cannot be resolved before the draw.
The SRT plan bug
A flat SRT slot is read once before the draw, so it only works if the whole read can be evaluated then.
SrtWalker::Collectrequired only that the offset be an immediate — but if the base address is carried around a loop, there is no address to read from yet. Giving such a read a slot only guarantees evaluation fails later and the dispatch is dropped.Any shader that walks a pointer hits this. A BVH traversal does it by construction, which is why every ray-tracing kernel in the title lost every descriptor it touched. The walker now also requires the base address not to reach a phi, and routes those to
dynamic_reads— runtime reads, which is what they are.After this,
a descriptor source did not evaluatestops firing entirely.MIMG 230/231 were decoded as an image sample that does not exist
ImageOps.cppmapped opcode0xe6toimage_sample_d_cl_o_a_0xe6— the name carried the raw opcode because it was a guess. Per the RDNA2 ISA MIMG opcode table, 230 isIMAGE_BVH_INTERSECT_RAYand 231 isIMAGE_BVH64_INTERSECT_RAY: ray/BVH-node intersection ops taking no sampler, whose SGPR operand is a 128-bit BVH T#, not an image T#.Read as an image sample, that BVH T# went into image-descriptor resolution and could never resolve. The eight kernels that dropped were exactly the eight containing
0xe6.Decoded properly now, with address register counts per ISA Table 48, matching the encoding restrictions the ISA places on these ops (R128=1, DIM=0, DMASK=0xf). Tests pin all three cases.
Also in here
RayTracing.cpp): T# base extraction, node addressing, the bit-packed shared-exponent box node with implicit child pointers, bound decompression, the ray/box slab test and distance sort. Emitted in IR rather than SPIR-V builder calls, sinceGetAddressResource+LoadAddressU32already give per-lane 64-bit addressed reads. Triangle leaves report a miss pending the leaf format.LowerDynamicBufferReads: a scalar buffer read whose V# is built from a loop-carried value becomes base+offset raw address loads, which is what an untyped scalar buffer read is. Only fires where the dispatch would have been skipped anyway.v_movrels_b32lowered to an indexed array load, libJson2 leniency, and the earlier Astro decode/SRT/descriptor work.Result
Title screen renders correctly: the logo is crisp instead of a smeared block, the rectangular artifact around it is gone, and the lettering geometry resolves. The eight ray-tracing kernels submit with no device loss and no skipped dispatches.
Verification
shader_cfg_testspasses; full build clean.Known gaps
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Diagnostics
- ImageOps: decode the PlayStation gradient-adjust ("_a") derivative and coarse-derivative MIMG sample variants (0xa2/0xa3/0xaa/0xab/0xb2/0xb3/ 0xba/0xbb, 0xe6, 0xe8-0xef). Team Asobi shaders emit these; they route through the existing explicit-LOD sample path, with Adjust only steering sampler dword3 canonicalization. Was "MIMG opcode 0xe6 is not implemented". - pipelineCache: wire SrtRuntime::read_memory to a raw (non-GPU-clean-gated) backing reader. PR #500 added the field but left it null, so the SRT evaluator could not resolve a descriptor the shader builds from SRT dwords. SRTs are CPU-written / GPU-read-only, so a plain backing read is both correct and always available. - pm4: acknowledge indirect SH regs SPI_SHADER_PGM_RSRC1_ES / RSRC2_ES (0xCA/0xCB) like RSRC4_GS -- the emulator sizes the export stage from the recompiled shader, so the guest's resource words are advisory. Co-Authored-By: Claude Sonnet 5 <[email protected]>Astro Bot PPSA21564 title-screen shaders emit wave32 forms the SOP1 table only had in wave64: - S_WQM_B32 (SOP1 0x09): new WqmU32 IR opcode, per-4-bit "any set -> all set" expansion in SPIR-V, constant-folded like WqmU64. - S_OR / S_XOR / S_ANDN2 _SAVEEXEC_B32 (SOP1 0x3d-0x3f): reuse the S_SAVEEXEC helper (S_ORN2_SAVEEXEC_B32 0x40 was already upstream); its 32-bit path grows a LogicalXor case. - S_CBRANCH_CDBG{SYS,USER,_OR_USER,_AND_USER} (SOPP 0x17-0x1a): the CDBG mode bits are always zero on a non-debug target, so decode as S_NOP instead of rejecting the shader. Co-Authored-By: Claude Sonnet 5 <[email protected]>A stale depth target left bound from an earlier, smaller pass shrank the render area for a larger colour pass -- Astro Bot's title screen keeps a 1920x1080 depth attachment on a 3840x2160 composite pass, so rendering clamped to a 1080p corner and the rest of the frame kept whatever was there before ("only a square is cleared"). The guest cannot pair mismatched attachment sizes, so treat the depth as unbound when it is smaller than the colour attachments. Co-Authored-By: Claude Sonnet 5 <[email protected]>My First Gran Turismo (PPSA24156) probes for a set of optional steering-wheel driver PRXs (pdiWheel_0.prx, ...) that aren't valid SELF/ELF images for this session and were never meant to load. Upstream RuntimeLinker::LoadProgram() turned that into a fatal EXIT(): elf is not valid: .../pdiWheel_0.prx runtimeLinker.cpp:1492 On real hardware this is just a load failure the title handles. Match the almo-port behaviour: - LoadProgram(): return nullptr on an invalid ELF instead of EXIT(). - PreloadAdjacentPrograms(): skip a module that failed to load. - KernelLoadStartModule(): report KERNEL_ERROR_ENOEXEC to the guest. - emulator.cpp LoadElf(): keep a null return fatal for the primary game executable only (EXIT_IF). Co-Authored-By: Claude Sonnet 5 <[email protected]>MIMG opcode 0xe6 was mapped to a made-up image_sample gradient variant ("image_sample_d_cl_o_a_0xe6" -- the name carried the raw opcode because it was a guess). Per the RDNA2 ISA MIMG opcode table, 230 is IMAGE_BVH_INTERSECT_RAY (32-bit node pointer) and 231 is IMAGE_BVH64_INTERSECT_RAY (64-bit); neither uses a sampler, and their SGPR operand is a 128-bit BVH T#, not an image T#. The misdecode is why Astro Bot (PPSA21564) drops eight compute kernels every frame. Read as an image sample, the BVH T# went through image-descriptor resolution, and its base is a loop-carried BVH node pointer, so it could never resolve before the dispatch -- "a descriptor source did not evaluate", dispatch skipped. Those eight kernels are exactly the eight in that title that contain opcode 0xe6, and nothing else does. Decode them properly: address register counts follow ISA Table 48 (11 for the 32-bit pointer, 12 for the 64-bit one, three fewer when A16 packs direction and inverse direction into halves), and the decoded form matches the encoding restrictions the ISA places on these ops (R128=1, DIM=0, DMASK=0xf). Traversal itself is not emitted yet, so they are still reported unsupported -- but as an unimplemented BVH op rather than as an image sample, which keeps the BVH T# out of image-descriptor resolution entirely. Co-Authored-By: Claude Opus 5 <[email protected]>Transcribes docs/design/bvh-ray-intersection.md: BVH T# base extraction, node addressing, the shared-exponent box node (bit-field reads, implicit child pointers from the running child-kind sum, bound decompression), the ray/box slab test and the distance sort. Emitted as IR rather than SPIR-V builder calls -- GetAddressResource plus LoadAddressU32 already give per-lane 64-bit addressed reads, so the node fetch is sixteen loads issued in dwordx4-shaped groups (an address load carries at most four components of metadata, and the node address is per-lane so it cannot use the wider scalar-address form). Effect so far: the eight ray-tracing kernels in Astro Bot now decode and translate, and their BVH T#s no longer enter image-descriptor resolution -- the shader's image descriptor count drops from 19 to 17. They still do not reach SPIR-V emission, because those kernels also build BUFFER descriptors from memory at a loop-carried address ("source=22/31 dword=0/4"), which bind-time resolution cannot evaluate either. That is a separate blocker of similar shape and has to be solved before any of this executes. So the traversal itself is unverified: nothing has run it yet. Triangle leaves report a miss pending the leaf format, which keeps traversal terminating rather than following an undecoded leaf. Co-Authored-By: Claude Opus 5 <[email protected]>Resolves 15 conflicting files against main's ~23-commit refactor: - SPIR-V enum system: hand-rolled constants -> Khronos spv:: header (SPIRV-Headers), with AddFunction/Type moving from brace-init-list calls to plain variadic ones. - PreparedBindings.program/.snapshot -> PreparedBindings.runtime (ShaderStageRuntime*), consolidating program+resources. - Resolve{Render,Depth}Target dropped their submit_id parameter. - ValueEmitContext's giant switch-based EmitValueFlow was split into per-opcode Emit<Name> functions dispatched via an X-macro (ValueOpcodes.inc); ported our IndexedVectorLoad/AnyLane/WqmU32 cases into that shape as new standalone functions. - DefineInputs/DefineOutputs merged the old two-pass allocate-then-annotate flow into one per-input pass. Carried forward across the refactor: PPSA21564 pixel-shader-cap ladder, the KYTY_STRICT_STRUCTURED/KYTY_LOOP_FUEL debug guards, the IndexedVectorLoad (v_movrels_b32) lowering, the helper-invocation ballot mask (and itsa5b874e9DPP-ballot exception), the vertex-shader subgroup-barrier fallback, TBuffer packed-bitfield stores, and the BVH ray-intersection prep work. tests/ShaderRecompilerComputeTests.cpp updated for the same API moves (PreparedBindings.runtime, Resolve*Target signature, GpuResourceManager removal, provoking_vtx_last pipeline param) plus one test restored that existed at the merge base but had gone missing from our branch history (provoking-vertex + blend-pipeline cache checks). Verified: kyty_emulator, shader_recompiler_compute_tests, and the Qt6 launcher all build and link clean (KYTY_BUILD_LAUNCHER=ON, Qt 6.10.3). 326/328 compute+graphics shader test cases pass. Two known-preexisting failures traced to origin/main's own SRT/resource-materialization code (untouched by any of our commits, confirmed via targeted SPIR-V disassembly), not to anything in this merge: - ScalarMemoryLoadVariants, ScalarLoadSignedImmediateOffsetAddsSoffset: SrtWalker treats a plain S_LOAD (LoadAddressU32) as SRT-flattenable whenever its base address is compile-time-uniform, baking a stale compile-time value into flattened_srt instead of emitting a real runtime buffer read -- conflates "address is uniform" with "the memory contents are a compile-time constant". - ImageLoadFmaskUsesNativeSampleMapping: EXIT_IF(index >= program.info.images.size()) in ResourceMaterialization.cpp:1198. Co-Authored-By: Claude Sonnet 5 <[email protected]>- ResourceMaterialization.cpp: NativeImageKeyArg crashed with EXIT_IF(index >= program.info.images.size()) whenever it ran on the FMASK UINT32_MAX remap sentinel, since ApplyResourceSpecialization's dead GetImageResource survives until EliminateDeadCode runs. This was the exact crash behind the ImageLoadFmaskUsesNativeSampleMapping test failure; special-casing the sentinel fixes it. - tests/ShaderRecompilerComputeTests.cpp: - CheckDepthSliceGrowth never called context.ShutdownGpu(), so RenderContext::InitializeGpu() would abort the next test that shares the renderer (a pre-existing gap that never got exercised because the merge conflicts blocked the suite from reaching it). - The provoking-vertex pipeline-cache test's third vertex used a white (1,1,1,1) color where it needed a distinct 0.25f component, so the last-provoking-vertex assertion (0x3e800000) never matched. - ShaderRecompiler.cpp: KYTY_STRICT_STRUCTURED="" (empty, but set) read as v[0] != '0' == true and silently enabled the ~65x-slower dispatcher-fallback path. - libJson2.cpp: the trailing-comma scanner's escape tracking cleared `escaped` before testing it against the current character, so an escaped quote inside a string ended string-tracking early, letting later commas inside string data get corrupted into spaces. Also bounded the discarded-document log preview by the actual buffer size instead of trusting %.80s to stop at a NUL that may not exist. - tile.cpp: TileGetTextureTotalSize called EXIT (fatal) on an unsupported 3D tiled layout instead of returning false, even though every caller already handles a false return. Left three CodeRabbit findings unaddressed pending more digging (not obviously safe "quick wins" despite the label): the renderCompute.cpp and renderDraw.cpp suggestions to gate two PPSA21564 workarounds more narrowly, and the RayTracing.cpp BVH node-kind check (that path is already flagged untested/unverified upstream). Also left the SrtWalker.cpp phi-classification suggestion (a performance nitpick, not a correctness bug) and the depthRenderTarget.cpp kOnes/eInvert stencil-op semantics finding (flagged by CodeRabbit itself as a heavy lift) for separate follow-up. Co-Authored-By: Claude Sonnet 5 <[email protected]>@defektu on GitHub · 2026-09-10 18:45 UTC · original
I know it is shitshow commit with PR500 backed up. But...



@defektu on GitHub · 2026-09-10 21:40 UTC · original
37c8482 fixes 1024px stencil issue for Astro Bot

@defektu on GitHub · 2026-09-12 01:49 UTC · original · edited 2026-09-12 02:01 UTC
a5b874e fixes wireframe look (ballot fix) by @EmK530 who was shy to PR to main too.
Others mostly fix dropped ps shaders and particle effects.
It has mip texture problems that needs to be resolved tho:
@EmK530 on GitHub · 2026-09-12 08:49 UTC · original · edited 2026-09-13 11:32 UTC
I thought the proper way was to PR into your branch haha
edit: Pretty sure the regression only exists here so PR to main doesn't make sense
@francoisatt on GitHub · 2026-09-13 06:57 UTC · original
Tried to build this on Windows (clang-cl 19.1.5, Ninja) and it needs a rebase before it can be tested locally. The branch is 23 commits behind main, and three of those touch the same area:
25a4437refactor(graphics),1d1f00b,7c54734.The production code compiles fine — it's shader_recompiler_compute_tests that fails, 12 errors, all from main's API having moved: PreparedBindings no longer has program/snapshot (8 uses in the test file), and ResolveRenderDepthTarget/ResolveRenderColorTarget lost their submit_id parameter. Nothing to do with your changes; the test file just predates those commits. CI rebases before building, which is why it doesn't show up there.
Happy to build and run the full suite on Windows once it's rebased
— Observer: System Redux (PPSA02118) just turned up on #281 with MIMG 0xe7, which makes six titles waiting on this one.
@defektu on GitHub · 2026-09-13 14:31 UTC · original · edited 2026-09-13 14:33 UTC
@francoisatt Thanks for the feedback. Rebased for latest changes. pushing up.
@defektu on GitHub · 2026-09-13 14:33 UTC · original
Rebased/merged onto origin/main (commit `
9ad0cbe7`, fast-forwarded onto this branch)Root cause of the compile errors: the branch was 23 commits behind main's shader-recompiler refactor (`
25a4437`, `1d1f00b`, `7c54734`), which:This wasn't limited to the test file — it touched 15 files total, including the SPIR-V backend itself (`spirvEmitterInternal.h`, `spirvEmitterFlow.cpp`, `spirvEmitterModule.cpp`, `spirvEmitterProgram.cpp`, etc.), `ShaderRecompiler.cpp`, `Translate.cpp`/`.h`, `renderDraw.cpp`, `libJson2.cpp`, and `textureCache.h`/`vulkanWindow.cpp`. Everything from this branch (the PPSA21564 pixel-shader-cap ladder, the `KYTY_STRICT_STRUCTURED`/`KYTY_LOOP_FUEL` debug guards, `IndexedVectorLoad`/`v_movrels_b32` lowering, the helper-invocation ballot mask and its DPP-ballot exception, the vertex-shader subgroup-barrier fallback, TBuffer packed-bitfield stores, and the BVH ray-intersection prep) was ported onto the new shape.
Verification: `kyty_emulator`, `shader_recompiler_compute_tests`, and the Qt6 launcher all build and link clean (clang-cl 19.1.5, Ninja, `KYTY_BUILD_LAUNCHER=ON` with Qt 6.10.3). 326/328 compute+graphics shader test cases pass.
Two known failures, both pre-existing in origin/main's own code (not touched by any commit on this branch, confirmed by disassembling the compiled SPIR-V):
Neither looks related to anything in this PR; happy to file these separately against main if that's useful. Let me know if you'd rather I open a fresh PR from the rebased branch instead of force-pushing over this one (this push was a fast-forward, so history's untouched either way).
@coderabbitai[bot] on GitHub · 2026-09-13 14:34 UTC · original · edited 2026-09-14 15:04 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
12207b21-a752-42ed-98fc-33e871c94043📥 Commits
Reviewing files that changed from the base of the PR and between
d9f34f90caandf9c1e3faed.📒 Files selected for processing (2)
src/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/image/textureCommon.cpp🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough
The PR updates guest GPU execution, Vulkan rendering, shader decoding and compilation, resource tracking, runtime loading, JSON APIs, and validation tests. It adds occlusion-query handling, indirect dispatch support, descriptor materialization paths, BVH translation, and diagnostic reporting.
Changes
GPU, shader, and runtime changes
src/loader/...,src/libs/libJson2.cpp,src/libs/libKernel.cppsrc/graphics/guest_gpu/...,src/kernel/memory.*src/graphics/host_gpu/renderer/...,src/graphics/presentation/window/vulkanWindow.cppsrc/graphics/shader/recompiler/...,src/graphics/shader/shader*src/graphics/shader/recompiler/ir/passes/...,src/graphics/shader/recompiler/ShaderRecompiler.*CMakeLists.txt,tests/...Priority: ⬆️ High
Estimated code review effort: 5 (Critical) | ~120 minutes
Change: Bug fix
Suggested reviewers:
nmzikMerge Risk: 🟡 Moderate · up to
f9c1eSeveral rendering paths can still produce incorrect depth, stencil, texture, or ray-tracing results. These correctness risks should be resolved before merging.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
astrobot-raytracing🧪 Generate unit tests (beta)
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.@ -1349,3 +1352,3 @@total_size.size = static_cast<uint32_t>(layout.total_size);total_size.align = layout.texture.block.block_size;return;return true;@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Return
falsefor unsupported 3D layouts.TileGetTiledTextureLayoutreturnsfalsefor invalid dimensions and unsupported texture block layouts.TileGetTextureTotalSizecallsEXITinstead of returning that status. The sampled-texture path indescriptors.cppusesfalseto bind a null texture, so this fallback is unreachable. The video-out caller intentionally exits when the footprint is invalid.♻️ Proposed change
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@ -1191,0 +1337,4 @@EXIT("TextureCache: failed to obtain stencil upload source\n");}UploadStencil(image, *source, source_offset);image.ClearStencilModified();@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep the stencil dirty when the upload is skipped.
UploadStencil()returns early for linear or mismatched layouts.RefreshImage()then clearsIsStencilModified()unconditionally.The host image can retain stale stencil data and appear current. Make
UploadStencil()report success. Clear the modified state only after a completed upload.🤖 Prompt for AI Agents
@ -66,0 +68,4 @@case Prospero::StencilOp::kOnes: return vk::StencilOp::eInvert;// kAnd/kOr/kNand/kNor/kXnor (0x0a-0x0f) have no Vulkan equivalent; approximate with a// replace rather than aborting the title.default: return vk::StencilOp::eReplace;@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Do not lower
kOnestoeInvert.eInverttoggles existing stencil bits. It does not set writable bits to one. If a writable bit is already one, this mapping clears it and changes subsequent stencil tests.Implement equivalent
kOnesbehavior, or keep the operation unsupported until the required reference and mask state can be represented. Do not silently map the remaining unsupported operations toeReplacewithout equivalent semantics.🤖 Prompt for AI Agents
@ -255,0 +339,4 @@sh_ctx.GetCs().cs_regs.data_addr);ResetBindings();return;}@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Restrict the compute-dispatch drop to the intended compatibility case.
GetComputeProgramcan return null for any title. This branch then silently drops arbitrary compute work.Gate this fallback on PPSA21564 and the specific unsupported materialization reason. Keep the normal failure path for other null-program cases.
🤖 Prompt for AI Agents
@ -530,0 +565,4 @@state.height);}depth.image_id = {};}@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not globally unbind mismatched depth attachments.
A draw can still require depth testing or depth writes inside the shared color and depth region. Clearing
depth.image_iddisables all depth behavior for that draw.Restrict this workaround to the identified PPSA21564 pass until mismatched attachment semantics have a general implementation.
🤖 Prompt for AI Agents
@ -0,0 +268,4 @@// DMASK is always 0xf here, so the four results land in consecutive destination registers.for (uint32_t component = 0; component < 4u; component++) {WriteOperand(OffsetOperand(inst.dst, component),ir.Select(is_box, hits[component].child, miss));@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject node kinds that do not use the shared-exponent layout.
The code above always decodes a shared-exponent box. However,
BvhChildUnitsidentifies kind 2 as a big FP32 box and kind 6 as an instance. Thekind > 1condition accepts both kinds and returns child pointers decoded from the wrong fields.Until those layouts are implemented, return a miss for every kind except the supported shared-exponent kind.
Proposed safe fallback
📝 Committable suggestion
🤖 Prompt for AI Agents
@ -1116,0 +1483,4 @@uint32_t key_arg = UINT32_MAX;if (op == ValueOpcode::GetImageResource) {key_arg = NativeImageKeyArg(program, inst);}@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4153
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 6414
Handle the remapped FMASK sentinel before indexing image metadata
ImageRemapassignsUINT32_MAXto FMASK images.ApplyResourceSpecializationapplies this value to the deadGetImageResource, which remains untilEliminateDeadCode.DiscardResourcePlanningInputsruns first and callsNativeImageKeyArg; its bounds check can fail compilation.Handle only the FMASK sentinel:
Proposed fix
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@ -398,0 +569,4 @@// evaluation fails later and the dispatch is dropped. Leave those as runtime reads.std::vector<const Inst*> visited;if (!offset.IsImmediate() || offset.GetType() != Type::U32 ||AddressReachesPhi(inst->Arg(0), visited, 0u)) {@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
Keep invariant-phi bases on the flat-slot path.
AddressReachesPhireturns true for every reachablePhi.PlanBuilder::Collectthen places the read indynamic_readsinstead ofsrt_reads. However,ResolveInvariantPhiaccepts phis whose arms are equivalent, andEvaluatePhievaluates those phis during bind-time evaluation. A raw read with an immediateU32offset and such a base therefore otherwise qualifies for flat-slot specialization.Make the phi check ignore phis that
ResolveInvariantPhiresolves. Keep unresolved or loop-carried phis on the dynamic-read path. This applies to any reachable descriptor source with that shape, not only BVH shaders.🤖 Prompt for AI Agents
@ -558,0 +585,4 @@static const bool strict_structured = [] {const char* v = std::getenv("KYTY_STRICT_STRUCTURED");return v != nullptr && v[0] != '\0' && v[0] != '0';}();@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Treat an empty
KYTY_STRICT_STRUCTUREDas disabled.v[0] != '0'is true when the variable is set to an empty string, becausev[0]is'\0'. SettingKYTY_STRICT_STRUCTURED=then enables strict mode and takes the dispatcher fallback, which your comment measures at roughly 65x frame time. Require a non-empty value.🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@ -972,0 +999,4 @@in_string = false;}continue;}@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix the escape tracking in the trailing-comma scan.
escapedis recomputed before it is used in the quote test. For the character after a backslash,escapedbecomesfalseand the testc == '"' && !escapedthen succeeds. An escaped quote therefore ends string tracking. After that, a,inside string data that is followed by}or]is replaced with a space, which silently corrupts the parsed string value.🐛 Proposed fix for the escape state machine
📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
On
src/libs/libJson2.cppline 1036 (outdated):🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Bound the log read by
size.srcis a pointer/length pair, not a NUL-terminated string.%.80scaps the printed length, but the formatter still scans for a NUL. If the buffer is shorter than 80 bytes and is not terminated, the read passes the buffer end. Pass the length explicitly.🛡️ Proposed fix
<algorithm>must be available in this translation unit forstd::min.📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@ -4455,0 +4353,4 @@HW::UserConfig user_config{};HW::Shader shaders{};scheduler.Begin(registers, user_config, shaders);context.InitializeGpu(nullptr);@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Shut down the shared GPU before the next test initializes it.
CheckDepthSliceGrowthstartsGuestGpuon the sharedRenderer()but does not callShutdownGpu(). The unmap path synchronously removes the cache entries beforeKernelMunmap, so the lane is not shown usingbaseat that point. However,CheckGpuCommandLanelater callsInitializeGpu()on the same renderer.RenderContext::InitializeGpu()aborts whenm_gpuis still non-null, which blocks the full test workflow.🧹 Proposed cleanup
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · edited 2026-09-13 15:07 UTC
On
tests/ShaderRecompilerComputeTests.cppline 11875 (outdated):🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Restore the distinct color for vertex two.
In the non-feedback, non-packed path, flat interpolation uses the provoking vertex color. The last-provoking draw sets
mode.provoking_vtx_last = true, so the all-white third vertex produces1.0f. The assertion still requires0x3e800000(0.25f) for covered pixels, which makes this test case fail.📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit
9fcd2ee@coderabbitai[bot] on GitHub · 2026-09-13 14:51 UTC · original · reviewed
Actionable comments posted: 13
🧹 Nitpick comments (1)
🤖 Prompt for all review comments with AI agents
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
c43417a5-0fe8-47e4-a323-aedd5190389e📥 Commits
Reviewing files that changed from the base of the PR and between
d3d7bd33f8and9ad0cbe759.📒 Files selected for processing (82)
3rdparty/xxHashCMakeLists.txtsrc/emulator.cppsrc/graphics/guest_gpu/command_processor/commandProcessor.hsrc/graphics/guest_gpu/command_processor/pm4Handlers.cppsrc/graphics/guest_gpu/graphicsRun.cppsrc/graphics/guest_gpu/pm4.hsrc/graphics/guest_gpu/tile.cppsrc/graphics/guest_gpu/tile.hsrc/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.hsrc/graphics/host_gpu/renderer/commandScheduler.cppsrc/graphics/host_gpu/renderer/commandScheduler.hsrc/graphics/host_gpu/renderer/context.cppsrc/graphics/host_gpu/renderer/depthRenderTarget.cppsrc/graphics/host_gpu/renderer/depthRenderTarget.hsrc/graphics/host_gpu/renderer/image/image.hsrc/graphics/host_gpu/renderer/masterSemaphore.cppsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/render.hsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/presentation/videoOut.cppsrc/graphics/presentation/window/vulkanWindow.cppsrc/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ShaderRecompiler.hsrc/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cppsrc/graphics/shader/recompiler/frontend/decode/ImageOps.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/Control.cppsrc/graphics/shader/recompiler/frontend/translate/Memory.cppsrc/graphics/shader/recompiler/frontend/translate/RayTracing.cppsrc/graphics/shader/recompiler/frontend/translate/Scalar.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.hsrc/graphics/shader/recompiler/frontend/translate/Translator.hsrc/graphics/shader/recompiler/ir/IREmitter.cppsrc/graphics/shader/recompiler/ir/IREmitter.hsrc/graphics/shader/recompiler/ir/Program.cppsrc/graphics/shader/recompiler/ir/ShaderIR.hsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.cppsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.incsrc/graphics/shader/recompiler/ir/passes/BindingLayout.cppsrc/graphics/shader/recompiler/ir/passes/BindingLayout.hsrc/graphics/shader/recompiler/ir/passes/ConstantPropagation.cppsrc/graphics/shader/recompiler/ir/passes/DeadCodeElimination.cppsrc/graphics/shader/recompiler/ir/passes/DynamicBuffer.cppsrc/graphics/shader/recompiler/ir/passes/DynamicBuffer.hsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.hsrc/graphics/shader/recompiler/ir/passes/ResourceTracking.cppsrc/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.hsrc/graphics/shader/recompiler/ir/passes/WaterfallDescriptor.cppsrc/graphics/shader/recompiler/ir/passes/WaterfallDescriptor.hsrc/graphics/shader/shader.cppsrc/graphics/shader/shader.hsrc/graphics/shader/shaderPixelParameter.cppsrc/kernel/memory.cppsrc/kernel/memory.hsrc/libs/libJson2.cppsrc/libs/libKernel.cppsrc/loader/redZonePatcher.cppsrc/loader/runtimeLinker.cpptests/ResourceTrackingTests.cpptests/ScalarProvenanceTests.cpptests/ShaderRecompilerComputeTests.cpptests/shaderCfgTests.cppIncluded review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@defektu on GitHub · 2026-09-14 13:58 UTC · original
d9f34f9 fixes mipmap texture errors of AstroBot. This might be chopping mip maps but I can't be sure because smooth shading is not working.




@coderabbitai[bot] on GitHub · 2026-09-14 14:07 UTC · original · edited 2026-09-14 14:49 UTC
On
src/graphics/host_gpu/renderer/cache/textureCache.cppline 1219 (outdated):🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Bound the atlas diagnostic read.
TextureCache::InitializeImage()callsNoteAtlasUpload()before the upload checks. The first initialization for each data address reachesstd::vector<uint8_t> bytesandTryReadBacking()withinfo.data.sizefor a non-empty multi-mip BC7 image. The relevant size path usesuint64_tand has no diagnostic-specific or 32-bit cap. This full-size allocation can create material host-memory pressure and raise an allocation failure. The source has no release-build guard.Use bounded block sampling, or exclude this diagnostic from release builds.
🤖 Prompt for AI Agents
✅ Addressed in commits
5975f9etof9c1e3f@coderabbitai[bot] on GitHub · 2026-09-14 14:07 UTC · original · edited 2026-09-14 14:49 UTC
On
src/graphics/host_gpu/renderer/image/textureCommon.cppline 358 (outdated):🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Keep tile regions aligned with generated tile data.
When
TextureBuildGpuTileInfos()skips an invalid range,BuildTextureTransfer()still marks the transfer valid and retains the matchingvk::BufferImageCopyregion.TileManager::Detile()sizes its scratch buffer from the remaining tiles, butUploadImage()submits every retained region toImage::Upload(). A skipped trailing region can therefore read beyond the detiled buffer.Detile()clears its scratch buffer, so the failure is not uninitialized data when the region remains in bounds.Remove the matching region with the skipped tile, or return
falsefromTextureBuildGpuTileInfos()so the transfer is rejected. Do not leave the region and tile vectors out of sync.🤖 Prompt for AI Agents
✅ Addressed in commits
5975f9etof9c1e3f@coderabbitai[bot] on GitHub · 2026-09-14 14:07 UTC · original · reviewed
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
5a39c6b3-389c-446a-8c0e-5481bca79fa4📥 Commits
Reviewing files that changed from the base of the PR and between
9fcd2ee5b1andd9f34f90ca.📒 Files selected for processing (5)
src/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/image/imageInfo.hsrc/graphics/host_gpu/renderer/image/textureCommon.cppsrc/graphics/host_gpu/renderer/image/textureCommon.hsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppIncluded review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@ChronoRPG on GitHub · 2026-09-14 21:36 UTC · original
It has issues with AMD; it won't load Astro Bot. I have a 9070 XT.
Vulkan pipeline cache: initializing _PipelineCache\PPSA21567.bin
Vulkan pipeline cache: initialized empty
Initialized: Graphics
version = 13
warning: executing wave64 compute shader cs=0x0000000908e86a00
Shaders: VS 0 | PS 0 | CS 1 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 0 | PS 0 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 0 | PS 1 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 3 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 4 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 5 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 6 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 7 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 8 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 9 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 10 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 11 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 12 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 13 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 14 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 2 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 2 | PS 2 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
--- Build ---
Official build KytyPS5-2026-09-14-18a1e0f
--- Error ---
shader CFG build failed: unsupported decoded instruction in CFG at pc 0x00002190: 0x00002190: unsupported family=MIMG opcode=0xe6 raw=[0xf1989f07 0x00040505 0x4442413d 0x4543403e 0x00004746] reason=MIMG opcode is not implemented in D:\a\KytyPS5\KytyPS5\src\graphics\shader\recompiler\frontend\cfg\ShaderCFG.cpp:40
F:\Emuladores\KytyPS5>
@defektu on GitHub · 2026-09-15 02:30 UTC · original
Hi @ChronoRPG, are you sure that you pulled this PR? Because your logs show "Official build KytyPS5-2026-09-14-18a1e0f" which indicates this PR is not pulled and rebuilt.
You can pull https://github.com/defektu/KytyPS5/tree/astrobot-raytracing and build cleanly.
@nzc20090108 on GitHub · 2026-09-19 12:57 UTC · original
This is the error log for the program built with the "astrobot- raytracing" version
Initialized: Config
Initialized: Log
Initialized: Timer
Initialized: Pthread
Initialized: Profiler
Initialized: Network
Initialized: Memory
Initialized: FileSystem
Initialized: Controller
Initialized: Audio
Vulkan pipeline cache: initializing _PipelineCache\PPSA21567.bin
Vulkan pipeline cache: initialized empty
Initialized: Graphics
version = 13
warning: executing wave64 compute shader cs=0x0000000908e86a00
Shaders: VS 0 | PS 0 | CS 1 | GS 0
Shaders: VS 0 | PS 0 | CS 2 | GS 0
Shaders: VS 0 | PS 1 | CS 2 | GS 0
Shaders: VS 1 | PS 1 | CS 2 | GS 0
Shaders: VS 1 | PS 1 | CS 3 | GS 0
Shaders: VS 1 | PS 1 | CS 4 | GS 0
Shaders: VS 1 | PS 1 | CS 5 | GS 0
Shaders: VS 1 | PS 1 | CS 6 | GS 0
Shaders: VS 1 | PS 1 | CS 7 | GS 0
Shaders: VS 1 | PS 1 | CS 8 | GS 0
Shaders: VS 1 | PS 1 | CS 9 | GS 0
Shaders: VS 1 | PS 1 | CS 10 | GS 0
Shaders: VS 1 | PS 1 | CS 11 | GS 0
Shaders: VS 1 | PS 1 | CS 12 | GS 0
Shaders: VS 1 | PS 1 | CS 13 | GS 0
Shaders: VS 1 | PS 1 | CS 14 | GS 0
Shaders: VS 1 | PS 1 | CS 15 | GS 0
Shaders: VS 1 | PS 2 | CS 15 | GS 0
Shaders: VS 2 | PS 2 | CS 15 | GS 0
--- Build ---
Fork build nzc20090108/KytyPS5
f9c1e3f--- Error ---
ShaderRecompiler CS failed hash=0x78af8e269b528b5c: SPIR-V validation failed
in D:\a\KytyPS5\KytyPS5\src\graphics\host_gpu\renderer\pipeline\pipelineCache.cpp:305
D:\PS5\KytyPS5-Windowsastrobot-raytracing-x64>

_kyty.txt
@theantipopau on GitHub · 2026-09-22 21:07 UTC · original
Independent data point on AMD hardware: I built the PR head as published (
f9c1e3f, based3d7bd3+ 80 commits; not merged into current main) and ran Astro Bot PPSA21564.Setup: Windows 11, Ryzen 7 9800X3D, Radeon RX 9070 XT, AMD driver 26.8.1, no patches/cheats.
Result: boots and renders to the title screen ("ASTRO BOT - PRESS ANY BUTTON") by the 6 minute mark. I saw the SIE "presents" card, the Team Asobi logo, and the 3D letter intro with correct shading. No crash, no faults, and no long driver compile stalls (for comparison, #640 on the same machine spends minutes in the driver per BVH kernel). The captured log has no
a descriptor source did not evaluateor error lines, onlywarning: executing wave64 compute shaderandocclusion query could not be serviced by a host query; falling back to always-visible.Observations:
MasterSemaphore::Wait<-CommandScheduler::Wait<-GuestGpu::ProcessCommands. GPU 3D engine averages ~50%, so it looks like a serialized CPU/GPU wait rather than a saturated GPU.AI disclosure: I used Claude Code to help build the branch, run the game, sample threads and collect the numbers. I ran and checked everything on my own machine.
@Nmzik on GitHub · 2026-10-21 19:42 UTC · original
Stale.
Pull request closed