diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-03 14:28:23 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-09 15:15:05 +0000 |
commit | 89ec1b3618f0f26a8f92049aabfc2df4d84c34c5 (patch) | |
tree | 1432a975da140b93d737d9dde865ed4c4864427b /src/gui/rhi/qrhivulkan_p_p.h | |
parent | 4a3ee77f650868ba408827d9793e8b86a93400f0 (diff) |
rhi: Add support for buffer readbacks
This also marks the beginnings of significantly extending autotesting
of the resource and rendering functionality in QRhi.
Also involves fixing up the buffer operation lists like we did
for textures before. This is to ensure updates and reads on the
same batch execute in the correct order. So just have two lists:
one with buffer, one with texture operations.
Also simplify the struct layouts. No need for those inner structs
with many duplicate members. This reduces the size even, since using a
union was never an option here. Also switch to a VLA, the size is around
253 KB per batch.
The Null backend now keeps track of the QRhiBuffer data so it can return
valid results in readbacks.
Task-number: QTBUG-78984
Task-number: QTBUG-78986
Task-number: QTBUG-78971
Task-number: QTBUG-78883
Change-Id: I9694bd7fec523a4e71cf8a5c77c828123ebbb3bd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhivulkan_p_p.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h index 7bd20b3671..d0e1e6758b 100644 --- a/src/gui/rhi/qrhivulkan_p_p.h +++ b/src/gui/rhi/qrhivulkan_p_p.h @@ -79,7 +79,7 @@ struct QVkBuffer : public QRhiBuffer VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]; QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]; - QVector<QRhiResourceUpdateBatchPrivate::DynamicBufferUpdate> pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT]; + QVarLengthArray<QRhiResourceUpdateBatchPrivate::BufferOp, 16> pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT]; VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT]; QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]; struct UsageState { @@ -853,17 +853,25 @@ public: VkFence cmdFence = VK_NULL_HANDLE; } ofr; - struct ActiveReadback { + struct TextureReadback { int activeFrameSlot = -1; QRhiReadbackDescription desc; QRhiReadbackResult *result; - VkBuffer buf; - QVkAlloc bufAlloc; - quint32 bufSize; + VkBuffer stagingBuf; + QVkAlloc stagingAlloc; + quint32 byteSize; QSize pixelSize; QRhiTexture::Format format; }; - QVector<ActiveReadback> activeReadbacks; + QVector<TextureReadback> activeTextureReadbacks; + struct BufferReadback { + int activeFrameSlot = -1; + QRhiBufferReadbackResult *result; + int byteSize; + VkBuffer stagingBuf; + QVkAlloc stagingAlloc; + }; + QVector<BufferReadback> activeBufferReadbacks; struct DeferredReleaseEntry { enum Type { @@ -933,7 +941,8 @@ public: Q_DECLARE_TYPEINFO(QRhiVulkan::DescriptorPoolData, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QRhiVulkan::DeferredReleaseEntry, Q_MOVABLE_TYPE); -Q_DECLARE_TYPEINFO(QRhiVulkan::ActiveReadback, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QRhiVulkan::TextureReadback, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QRhiVulkan::BufferReadback, Q_MOVABLE_TYPE); QT_END_NAMESPACE |