mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-01 12:45:56 +00:00
On NVIDIA's proprietary driver, function arrays that live in local memory and are read under a data-dependent branch return wrong values in subgroups 1-3 of a mesh workgroup; subgroup 0 is correct. A wave64 geometry program whose relative addressing keeps its VGPRs in the vector window therefore loses register writes in every wave but the first. In the clipping geometry program of Sony's PS5 PSP emulator (PPSA07550) the empty waves never cleared their candidate primitive slots and wrote degenerate triangles over wave 0's, so the 3D menu drew spikes. On that driver a mesh program's window now lives in a device-local storage buffer of 256 workgroup slots of 65536 dwords, claimed through a per-slot lock and released after the final barrier. The pool is created before the first draw that uses it records anything, and its header is zeroed in a batch of its own that is submitted and waited for; the pool is published only after that wait, and a failure releases it. Direct register accesses keep one function variable per register; a direct store also writes the buffer when a buffer read can see it, relative reads load the buffer, relative writes store only to it, and a direct read that may follow a relative write loads the buffer and refreshes the variable. A buffer entry is zeroed only when a buffer read can see it before a write. APS5_NO_MESH_WINDOW_BUFFER=1 keeps the arrays.