diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-22 19:54:30 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-23 16:59:06 +0200 |
commit | be2635b8dd37dfa7cb3f1c41544b2736d13a058d (patch) | |
tree | 09cbe9d0ec2c117aa51948d28f1df5675b05415d /src/gui/rhi/qrhid3d11.cpp | |
parent | 6b52ba42865c6d298a8ddf1d735e4c3d3b3dab56 (diff) |
rhi: Reuse the data in buffer ops in res.update batches
Because having profilers bombarded with mallocs (due to creating
deep copy QByteArrays) is not nice.
Change-Id: I848f41f3465d6dc2a58a193cc863495aacf13d79
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 3b14b77ce1..e924966585 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -1418,12 +1418,12 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) { QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, u.buf); Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic); - memcpy(bufD->dynBuf.data() + u.offset, u.data.constData(), size_t(u.data.size())); + memcpy(bufD->dynBuf.data() + u.offset, u.data.constData(), size_t(u.dataSize)); bufD->hasPendingDynamicUpdates = true; } else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) { QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, u.buf); Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic); - Q_ASSERT(u.offset + u.data.size() <= bufD->m_size); + Q_ASSERT(u.offset + u.dataSize <= bufD->m_size); QD3D11CommandBuffer::Command cmd; cmd.cmd = QD3D11CommandBuffer::Command::UpdateSubRes; cmd.args.updateSubRes.dst = bufD->buffer; @@ -1437,7 +1437,7 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate box.left = UINT(u.offset); box.top = box.front = 0; box.back = box.bottom = 1; - box.right = UINT(u.offset + u.data.size()); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc + box.right = UINT(u.offset + u.dataSize); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc cmd.args.updateSubRes.hasDstBox = true; cmd.args.updateSubRes.dstBox = box; cbD->commands.append(cmd); |