mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
Pixel, vertex-path and fetch programs keep LDS in a Function-storage array private to each invocation. Sub-dword LDS writes (ds_write_b8, ds_write_b16 and their _d16_hi forms), the 32-bit LDS atomics and ds_append/ds_consume still emitted OpAtomicLoad, OpAtomicCompareExchange or OpAtomicIAdd on that array, with Workgroup scope and a Workgroup OpMemoryBarrier. Vulkan allows atomics only on Uniform, Workgroup, Image, StorageBuffer, PhysicalStorageBuffer and TaskPayloadWorkgroupEXT pointers (VUID-StandaloneSpirv-None-04686) and Workgroup memory scope only in compute, mesh, task and tessellation control (VUID-StandaloneSpirv-None-07321). With ANYPS5_ENABLE_SPIRV_TOOLS the recompiler rejected such shaders; without it the invalid module went to the driver. InFunctionStorage now names the storage EmitMemoryElementPointer picks. For Function storage, StoreSubwordInBounds, Atomic32, EmitAtomicUpdate, SharedAtomicUpdate and AppendConsume load the dword, compute the new value and store it, as scratch already did. The array belongs to one invocation, so no other invocation can observe the dword in between. Atomic32 takes the next value from AtomicNext32, which FlatAtomicNext32 now shares for its plain integer operations. The per-invocation LDS model and what it means for ds_append are recorded as technical debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>