If RestoreDeferredContextState was used a command list is not successful

This commit is contained in:
baldurk
2023-04-17 11:34:37 +01:00
parent 167c88ee41
commit c149b9f2ec
2 changed files with 22 additions and 2 deletions
+13 -2
View File
@@ -162,7 +162,6 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real
m_ScratchSerialiser.SetUserData(GetResourceManager());
m_ScratchSerialiser.SetVersion(D3D11InitParams::CurrentVersion);
m_SuccessfulCapture = true;
m_FailureReason = CaptureSucceeded;
m_EmptyCommandList = true;
@@ -189,6 +188,8 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real
m_CurrentPipelineState->SetImmediatePipeline(m_pDevice);
m_MarkedActive = false;
m_SuccessfulCapture = true;
}
else
{
@@ -198,8 +199,16 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real
// bool flag rather than "if immediate and not flagged"
m_MarkedActive = true;
// deferred contexts are only successful if they were active capturing when they started
if(IsCaptureMode(m_State) && RenderDoc::Inst().GetCaptureOptions().captureAllCmdLists)
{
m_State = CaptureState::ActiveCapturing;
m_SuccessfulCapture = true;
}
else
{
m_SuccessfulCapture = false;
}
}
ReplayFakeContext(ResourceId());
@@ -641,8 +650,10 @@ void WrappedID3D11DeviceContext::CleanupCapture()
m_MapResourceRecordAllocs.clear();
if(RenderDoc::Inst().GetCaptureOptions().captureAllCmdLists)
if(RenderDoc::Inst().GetCaptureOptions().captureAllCmdLists || IsActiveCapturing(m_State))
return;
m_SuccessfulCapture = false;
}
else
{
@@ -5570,6 +5570,15 @@ HRESULT WrappedID3D11DeviceContext::FinishCommandList(BOOL RestoreDeferredContex
// we pick up on that.
m_EmptyCommandList = true;
// except if we were supposed to restore the deferred context state. Then there would have to
// be some state setting here (which we're not recording).
// This makes the command list immediately unsuccessful and forces a retry - if this happens
// again the restore will be recorded
if(RestoreDeferredContextState)
m_EmptyCommandList = false;
m_SuccessfulCapture = false;
// still need to propagate up dirty resources to the immediate context
wrapped->SwapDirtyResources(m_DeferredDirty);