[idd] driver: fix failure to report completion when an error occurs

This commit is contained in:
Geoffrey McRae 2025-03-30 18:21:34 +00:00
parent cadcfe4b39
commit 63a9365377

View File

@ -134,8 +134,16 @@ void CSwapChainProcessor::SwapChainThreadCore()
if (buffer.MetaData.PresentationFrameNumber != lastFrameNumber) if (buffer.MetaData.PresentationFrameNumber != lastFrameNumber)
{ {
lastFrameNumber = buffer.MetaData.PresentationFrameNumber; lastFrameNumber = buffer.MetaData.PresentationFrameNumber;
if (!SwapChainNewFrame(buffer.MetaData.pSurface)) SwapChainNewFrame(buffer.MetaData.pSurface);
// report that all GPU processing for this frame has been queued
hr = IddCxSwapChainFinishedProcessingFrame(m_hSwapChain);
if (FAILED(hr))
{
DEBUG_ERROR_HR(hr, "IddCxSwapChainFinishedProcessingFrame Failed");
break; break;
}
} }
} }
else else
@ -204,6 +212,15 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer
DEBUG_ERROR("Failed to get a CFrameBufferResource from the pool"); DEBUG_ERROR("Failed to get a CFrameBufferResource from the pool");
return false; return false;
} }
auto copyQueue = m_dx12Device->GetCopyQueue();
if (!copyQueue)
{
DEBUG_ERROR("Failed to get a CopyQueue");
return false;
}
copyQueue->SetCompletionCallback(&CompletionFunction, this, fbRes);
D3D12_TEXTURE_COPY_LOCATION srcLoc = {}; D3D12_TEXTURE_COPY_LOCATION srcLoc = {};
srcLoc.pResource = srcRes->GetRes().Get(); srcLoc.pResource = srcRes->GetRes().Get();
@ -220,27 +237,10 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer
dstLoc.PlacedFootprint.Footprint.Depth = 1; dstLoc.PlacedFootprint.Footprint.Depth = 1;
dstLoc.PlacedFootprint.Footprint.RowPitch = srcRes->GetFormat().Width * 4; //FIXME dstLoc.PlacedFootprint.Footprint.RowPitch = srcRes->GetFormat().Width * 4; //FIXME
auto copyQueue = m_dx12Device->GetCopyQueue();
if (!copyQueue)
{
DEBUG_ERROR("Failed to get a CopyQueue");
return false;
}
copyQueue->SetCompletionCallback(&CompletionFunction, this, fbRes);
srcRes->Sync(*copyQueue); srcRes->Sync(*copyQueue);
copyQueue->GetGfxList()->CopyTextureRegion( copyQueue->GetGfxList()->CopyTextureRegion(
&dstLoc, 0, 0, 0, &srcLoc, NULL); &dstLoc, 0, 0, 0, &srcLoc, NULL);
copyQueue->Execute(); copyQueue->Execute();
// report that all GPU processing for this frame has been queued
hr = IddCxSwapChainFinishedProcessingFrame(m_hSwapChain);
if (FAILED(hr))
{
DEBUG_ERROR_HR(hr, "IddCxSwapChainFinishedProcessingFrame Failed");
return false;
}
return true; return true;
} }