mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-11-12 09:10:21 +01:00
video_core: commit the emulated-LDS allocation taken from the stream buffer (#5070)
The BufferType::SharedMemory path in Rasterizer::BindBuffers backs a compute shader's LDS with a region of the stream buffer: it calls StreamBuffer::Map, zeroes the bytes and binds them as the storage buffer the recompiler lowered the LDS accesses to. It never called Commit. Map only chooses the region and waits until it is free; Commit is what reserves it. Commit flushes the host writes on non-coherent memory, advances the ring cursor past the mapped bytes and records the completion watch that makes a later wrap wait for the GPU work that used them. Without it the next Map on the same stream buffer hands out the same bytes again, so a streamed upload can overwrite the shader's shared memory while the dispatch that uses it is in flight, and the shader's LDS stores can land in bytes a later upload reads as its source. Every other StreamBuffer::Map in the tree is paired with a Commit; this was the only call site without one. Co-authored-by: nikmparis217-ux <295578344+nikmparis217-ux@users.noreply.github.com>
This commit is contained in:
1 parent
ca89b01791
commit
bc028b7ca6
1 file changed
+1
@@ -764,6 +764,7 @@ void Rasterizer::BindBuffers(const Shader::Info& stage, Shader::Backend::Binding
|
||||
const auto lds_size = cs_program.SharedMemSize() * cs_program.NumWorkgroups();
|
||||
const auto [data, offset] = lds_buffer.Map(lds_size, alignment);
|
||||
std::memset(data, 0, lds_size);
|
||||
lds_buffer.Commit();
|
||||
buffer_infos.emplace_back(lds_buffer.Handle(), offset, lds_size);
|
||||
} else {
|
||||
UNREACHABLE_MSG("Unexpected buffer type {}", u32(desc.buffer_type));
|
||||
|
||||
Reference in new issue
Block a user