rhi: metal: Skip unnecessary writes when updating the entire buffer
Follow the similar Vulkan change in 20eb40bce9
and drop the queued up buffer data for a given slot when the current update
covers the entire buffer. This is relevant in particular for Qt Quick 3D
where such dynamic buffer changes are common.
Change-Id: If1e70d78968586b552a5357bc97af10cc61d9611
Pick-to: 6.1 6.0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
346d30144a
commit
0c6375a346
@ -1746,8 +1746,11 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
|
|||||||
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
|
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
|
||||||
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, u.buf);
|
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, u.buf);
|
||||||
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
|
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
|
||||||
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i)
|
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
|
||||||
|
if (u.offset == 0 && u.data.size() == bufD->m_size)
|
||||||
|
bufD->d->pendingUpdates[i].clear();
|
||||||
bufD->d->pendingUpdates[i].append(u);
|
bufD->d->pendingUpdates[i].append(u);
|
||||||
|
}
|
||||||
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
|
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
|
||||||
// Due to the Metal API the handling of static and dynamic buffers is
|
// Due to the Metal API the handling of static and dynamic buffers is
|
||||||
// basically the same. So go through the same pendingUpdates machinery.
|
// basically the same. So go through the same pendingUpdates machinery.
|
||||||
|
Loading…
Reference in New Issue
Block a user