rhi: Always check and mark the extra buffers for reuse on metal
It's not just with tesselation we're using these buffers, but also for multiview, which meant we'd continuously grow the pool until we run out resources when multiview was enabled. Interesting observation from this is that newBufferWithLength would 'hang' instead of returning erroneously unable to acquire a new buffer. Pick-to: 6.9 Change-Id: Ie30ca44bc7b4b8f29c517fe6c88fafbe46be3d17 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
5a230596c8
commit
3c81c89076
@ -1509,18 +1509,18 @@ void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
|
||||
cbD->currentComputePipeline = nullptr;
|
||||
cbD->currentPipelineGeneration = psD->generation;
|
||||
|
||||
if (!psD->d->tess.enabled && !psD->d->tess.failed) {
|
||||
if (!psD->d->tess.enabled && !psD->d->tess.failed)
|
||||
psD->makeActiveForCurrentRenderPassEncoder(cbD);
|
||||
} else {
|
||||
// mark work buffers that can now be safely reused as reusable
|
||||
for (QMetalBuffer *workBuf : psD->d->extraBufMgr.deviceLocalWorkBuffers) {
|
||||
if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
|
||||
workBuf->lastActiveFrameSlot = -1;
|
||||
}
|
||||
for (QMetalBuffer *workBuf : psD->d->extraBufMgr.hostVisibleWorkBuffers) {
|
||||
if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
|
||||
workBuf->lastActiveFrameSlot = -1;
|
||||
}
|
||||
|
||||
// mark work buffers that can now be safely reused as reusable
|
||||
// NOTE: These are usually empty unless tessellation or mutiview is used.
|
||||
for (QMetalBuffer *workBuf : psD->d->extraBufMgr.deviceLocalWorkBuffers) {
|
||||
if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
|
||||
workBuf->lastActiveFrameSlot = -1;
|
||||
}
|
||||
for (QMetalBuffer *workBuf : psD->d->extraBufMgr.hostVisibleWorkBuffers) {
|
||||
if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
|
||||
workBuf->lastActiveFrameSlot = -1;
|
||||
}
|
||||
|
||||
psD->lastActiveFrameSlot = currentFrameSlot;
|
||||
|
Loading…
x
Reference in New Issue
Block a user