On Fri Aug 25 14:03:52 2023 +0000, Evan Tang wrote:
The issue is, to prevent concurrent writes of the same Vulkan
descriptor we must delay writing them until command list submission, so instead of descriptors being written on the fly, often by multiple threads, we write them all at the last millisecond from a single thread. Are concurrent writes to the same descriptor really allowed in DX12? If so, wouldn't that mean every DX12 driver has to use atomics/locks to update its descriptors? That seems like a lot of burden to put on drivers for little benefit to games (since they'd still be unsure of which descriptor write overwrote which). Are you sure this isn't a leftover from pre-update-after-bind, where entire descriptor sets needed synchronization, in which case we should be able to update concurrently as long as update after bind is used?
It's unclear if "free-threaded" means concurrent writes are allowed, but they do happen surprisingly often. It's unlikely Windows drivers do any kind of locking, so most likely the concurrently written descriptors are identical or at least produce a valid descriptor if the data is a blend of both. I have seen crashes in Vulkan from concurrent writes though, so we must prevent it. Descriptor buffers are used in vkd3d-proton to allow memcpying of Vulkan descriptors, and it seems to handle concurrency as well as Windows does.