summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d11.cpp
diff options
context:
space:
mode:
authorBen Fletcher <ben.fletcher@me.com>2022-12-08 21:34:12 -0800
committerBen Fletcher <ben.fletcher@me.com>2022-12-14 17:29:53 -0800
commit509fd9f2bbe015c677adfd5381a91b3c808ca36d (patch)
treea9e908ec313eaa7f55c5e922371f225051c7a726 /src/gui/rhi/qrhid3d11.cpp
parent2946447f50bc03ae5c9b5b9668d43ca7223a53c1 (diff)
RHI: Buffer readback fixes and unit test
Fixes issues with readback of storage buffers modified on GPU for D3D and Metal. Adds unit test for storage buffer readback. D3D * Fixes issue where QRhiBufferReadbackResult::completed callback could be called twice on buffer readback completion. Metal * Fixes issue where buffer readback occurred prior to command buffer being committed. Change-Id: If55ac005f4438d66d2f65ea2e1ee0d5686c884ff Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r--src/gui/rhi/qrhid3d11.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index a4a83e4296..8da44eee32 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -1631,6 +1631,8 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
if (bufD->m_type == QRhiBuffer::Dynamic) {
u.result->data.resize(u.readSize);
memcpy(u.result->data.data(), bufD->dynBuf + u.offset, size_t(u.readSize));
+ if (u.result->completed)
+ u.result->completed();
} else {
BufferReadback readback;
readback.result = u.result;
@@ -1666,8 +1668,6 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
activeBufferReadbacks.append(readback);
}
- if (u.result->completed)
- u.result->completed();
}
}
for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {