mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 22:28:32 +09:00
[Fix] (DirectVulkan): flag a transform feedback capture as a GPU write
A capture is a GPU write like any shader's, so a later CPU read of the buffer has to wait for it. Only shader storage buffers were flagged, so mapping or reading back a capture buffer could observe whatever the queue had retired so far. Nothing needs copying -- the capture writes land in coherent host-visible storage already -- but coherence only says the writes are visible once they have happened, which is exactly what MarkGpuWritten arranges through the readback op.
This commit is contained in:
@@ -8086,8 +8086,11 @@ void main() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Host-visible coherent GPU residency: the capture writes land where
|
// Host-visible coherent GPU residency: the capture writes land where
|
||||||
// MapBuffer/GetBufferSubData read.
|
// MapBuffer/GetBufferSubData read. Coherence makes them visible once they
|
||||||
|
// have happened, so the buffer is also flagged for the wait that a later CPU
|
||||||
|
// read has to perform - the capture is a GPU write like any shader's.
|
||||||
bufferObject->EnsureGpuResidentStorage();
|
bufferObject->EnsureGpuResidentStorage();
|
||||||
|
bufferObject->MarkGpuWritten();
|
||||||
BufferSlice slice{};
|
BufferSlice slice{};
|
||||||
if (!m_bufferManager.AcquireResidentSlice(BufferKind::Vertex, bufferObject, slice)) {
|
if (!m_bufferManager.AcquireResidentSlice(BufferKind::Vertex, bufferObject, slice)) {
|
||||||
MGLOG_E("BeginXfbCaptureForDraw: failed to acquire capture buffer %zu", i);
|
MGLOG_E("BeginXfbCaptureForDraw: failed to acquire capture buffer %zu", i);
|
||||||
|
|||||||
Reference in New Issue
Block a user