Commit eba81cf0 authored by Laszlo Agocs's avatar Laszlo Agocs

vk, mtl: Track resources correctly in copy, readback and mip.gen.

parent b06128e4
......@@ -1374,6 +1374,8 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
destinationSlice: u.desc.destinationLayer()
destinationLevel: u.desc.destinationLevel()
destinationOrigin: MTLOriginMake(dp.x(), dp.y(), 0)];
srcD->lastActiveFrameSlot = dstD->lastActiveFrameSlot = currentFrameSlot;
}
for (const QRhiResourceUpdateBatchPrivate::TextureRead &u : ud->textureReadbacks) {
......@@ -1396,6 +1398,7 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
aRb.format = texD->m_format;
src = texD->d->tex;
srcSize = texD->m_pixelSize;
texD->lastActiveFrameSlot = currentFrameSlot;
} else {
Q_ASSERT(currentSwapChain);
swapChainD = QRHI_RES(QMetalSwapChain, currentSwapChain);
......@@ -1432,8 +1435,10 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
}
for (const QRhiResourceUpdateBatchPrivate::TextureMipGen &u : ud->textureMipGens) {
QMetalTexture *utexD = QRHI_RES(QMetalTexture, u.tex);
ensureBlit();
[blitEnc generateMipmapsForTexture: QRHI_RES(QMetalTexture, u.tex)->d->tex];
[blitEnc generateMipmapsForTexture: utexD->d->tex];
utexD->lastActiveFrameSlot = currentFrameSlot;
}
if (blitEnc) {
......
......@@ -2555,6 +2555,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
finishTransferSrc(cb, srcD);
finishTransferDest(cb, dstD);
srcD->lastActiveFrameSlot = dstD->lastActiveFrameSlot = currentFrameSlot;
}
for (const QRhiResourceUpdateBatchPrivate::TextureRead &u : ud->textureReadbacks) {
......@@ -2573,6 +2575,7 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
aRb.pixelSize = u.rb.level() > 0 ? q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize)
: texD->m_pixelSize;
aRb.format = texD->m_format;
texD->lastActiveFrameSlot = currentFrameSlot;
} else {
Q_ASSERT(currentSwapChain);
swapChainD = QRHI_RES(QVkSwapChain, currentSwapChain);
......@@ -2718,6 +2721,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
}
finishTransferDest(cb, utexD);
utexD->lastActiveFrameSlot = currentFrameSlot;
}
ud->free();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment