rhi: d3d12: Fix finish() when called outside a frame
Pick-to: 6.9 6.8 Fixes: QTBUG-133454 Change-Id: I447610917966a9dcd4b80dc8b84156ce985f9ca9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
68e48ac60a
commit
01308ff18e
@ -1949,10 +1949,8 @@ QRhi::FrameOpResult QRhiD3D12::endOffscreenFrame(QRhi::EndFrameFlags flags)
|
|||||||
|
|
||||||
QRhi::FrameOpResult QRhiD3D12::finish()
|
QRhi::FrameOpResult QRhiD3D12::finish()
|
||||||
{
|
{
|
||||||
if (!inFrame)
|
|
||||||
return QRhi::FrameOpSuccess;
|
|
||||||
|
|
||||||
QD3D12CommandBuffer *cbD = nullptr;
|
QD3D12CommandBuffer *cbD = nullptr;
|
||||||
|
if (inFrame) {
|
||||||
if (offscreenActive) {
|
if (offscreenActive) {
|
||||||
Q_ASSERT(!currentSwapChain);
|
Q_ASSERT(!currentSwapChain);
|
||||||
cbD = offscreenCb[currentFrameSlot];
|
cbD = offscreenCb[currentFrameSlot];
|
||||||
@ -1977,18 +1975,20 @@ QRhi::FrameOpResult QRhiD3D12::finish()
|
|||||||
cmdQueue->ExecuteCommandLists(1, execList);
|
cmdQueue->ExecuteCommandLists(1, execList);
|
||||||
|
|
||||||
releaseQueue.activatePendingDeferredReleaseRequests(currentFrameSlot);
|
releaseQueue.activatePendingDeferredReleaseRequests(currentFrameSlot);
|
||||||
|
}
|
||||||
|
|
||||||
// full blocking wait for everything, frame slots do not matter now
|
// full blocking wait for everything, frame slots do not matter now
|
||||||
waitGpu();
|
waitGpu();
|
||||||
|
|
||||||
hr = cmdAllocators[currentFrameSlot]->Reset();
|
if (inFrame) {
|
||||||
|
HRESULT hr = cmdAllocators[currentFrameSlot]->Reset();
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
qWarning("Failed to reset command allocator: %s",
|
qWarning("Failed to reset command allocator: %s",
|
||||||
qPrintable(QSystemError::windowsComString(hr)));
|
qPrintable(QSystemError::windowsComString(hr)));
|
||||||
return QRhi::FrameOpError;
|
return QRhi::FrameOpError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startCommandListForCurrentFrameSlot(&cmdList))
|
if (!startCommandListForCurrentFrameSlot(&cbD->cmdList))
|
||||||
return QRhi::FrameOpError;
|
return QRhi::FrameOpError;
|
||||||
|
|
||||||
cbD->resetState();
|
cbD->resetState();
|
||||||
@ -1997,9 +1997,9 @@ QRhi::FrameOpResult QRhiD3D12::finish()
|
|||||||
smallStagingAreas[currentFrameSlot].head = 0;
|
smallStagingAreas[currentFrameSlot].head = 0;
|
||||||
|
|
||||||
bindShaderVisibleHeaps(cbD);
|
bindShaderVisibleHeaps(cbD);
|
||||||
|
}
|
||||||
|
|
||||||
releaseQueue.executeDeferredReleases(currentFrameSlot);
|
releaseQueue.releaseAll();
|
||||||
|
|
||||||
finishActiveReadbacks(true);
|
finishActiveReadbacks(true);
|
||||||
|
|
||||||
return QRhi::FrameOpSuccess;
|
return QRhi::FrameOpSuccess;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user