fix(agc): snapshot misaligned draw inputs from the offset the shader reads #202
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/202"
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?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-01T03:11:59Z.
What
Follows
3dec6cedand9f1c680b.3dec6cedbinds a guest buffer view whose offset is offminStorageBufferOffsetAlignmentfrom the aligned offset below it, and the shader adds the difference (the push constant patch) to every access. 9f1c680b'sShaderResources::PrepareDrawBindingscopies a read-only in-place draw input into a fresh buffer, but that snapshot starts at the view itself and is bound at offset 0. So for a misaligned view, the patched shader read the snapshot 4, 8 or 12 bytes past the view's data.The snapshot now covers
[address - adjustment, address + size), so the shader's offset into it lands on the view's first byte again. Aligned views (adjustment 0) are unchanged.In PPSA21564 this showed up as intermittent single-frame flicker whenever a per-frame constant block landed off the 16-byte alignment: the title screen's nebula haze vanished, the NEW GAME menu washed blue and the world map planet turned purple for a frame.
Tested
misalignedSnapshotTestsinagc_driver_recorder_testsbinds an aligned view and a view 4 bytes into it in one guest buffer array over a host import, checks the push constant patch is the 4-byte adjustment, and checks the draw snapshot holds the view's bytes at the offset the shader reads. Without the fix it fails with "a draw snapshot ends before the bytes the shader reads"; with it the whole binary passes. It skips itself without host imports or with an alignment outside 8 to 256.ctest --test-dir build: 79/79 pass on current main with this branch.agc_driver_recorder_testsandagc_driver_graphics_testspass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository