rhi: d3d12: Fix finish() when called outside a frame
Pick-to: 6.8 Fixes: QTBUG-133454 Change-Id: I447610917966a9dcd4b80dc8b84156ce985f9ca9 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 01308ff18e74860dd32472bbff31ca1fabd8339f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
987ff07a85
commit
6446d865be
@ -1900,10 +1900,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];
|
||||||
@ -1928,18 +1926,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();
|
||||||
@ -1948,9 +1948,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