Add new chunk to store the params to IDXGISwapChain::Present. Refs #356

This commit is contained in:
baldurk
2016-09-05 13:33:17 +02:00
parent 68cb108995
commit 2f2afa820b
4 changed files with 38 additions and 1 deletions
+2
View File
@@ -344,6 +344,8 @@ enum D3D11ChunkType
CREATE_RTV1,
CREATE_UAV1,
SWAP_PRESENT,
NUM_D3D11_CHUNKS,
};
+25 -1
View File
@@ -154,6 +154,8 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real
m_FailureReason = CaptureSucceeded;
m_EmptyCommandList = true;
m_PresentChunk = false;
m_DrawcallStack.push_back(&m_ParentDrawcall);
m_CurEventID = 1;
@@ -490,6 +492,16 @@ void WrappedID3D11DeviceContext::EndCaptureFrame()
m_ContextRecord->AddChunk(scope.Get());
}
void WrappedID3D11DeviceContext::Present(UINT SyncInterval, UINT Flags)
{
SCOPED_SERIALISE_CONTEXT(SWAP_PRESENT);
m_pSerialiser->Serialise("context", m_ResourceID);
m_pSerialiser->Serialise("SyncInterval", SyncInterval);
m_pSerialiser->Serialise("Flags", Flags);
m_ContextRecord->AddChunk(scope.Get());
}
void WrappedID3D11DeviceContext::FreeCaptureData()
{
SCOPED_LOCK(m_pDevice->D3DLock());
@@ -747,6 +759,17 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch
case DISCARD_VIEW: context->Serialise_DiscardView(NULL); break;
case DISCARD_VIEW1: context->Serialise_DiscardView1(NULL, NULL, 0); break;
case SWAP_PRESENT:
{
// we don't do anything with these parameters, they're just here to store
// them for user benefits
UINT SyncInterval = 0, Flags = 0;
m_pSerialiser->Serialise("SyncInterval", SyncInterval);
m_pSerialiser->Serialise("Flags", Flags);
m_PresentChunk = true;
break;
}
case CONTEXT_CAPTURE_FOOTER:
{
bool HasCallstack = false;
@@ -766,7 +789,8 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch
if(m_State == READING)
{
AddEvent(CONTEXT_CAPTURE_FOOTER, "IDXGISwapChain::Present()");
if(!m_PresentChunk)
AddEvent(CONTEXT_CAPTURE_FOOTER, "IDXGISwapChain::Present()");
FetchDrawcall draw;
draw.name = "Present()";
+5
View File
@@ -208,6 +208,8 @@ private:
bool m_SuccessfulCapture;
bool m_EmptyCommandList;
bool m_PresentChunk;
ResourceId m_FakeContext;
bool m_DoStateVerify;
@@ -300,6 +302,9 @@ public:
void BeginCaptureFrame();
void EndCaptureFrame();
// insert a fake chunk just to store these parameters
void Present(UINT SyncInterval, UINT Flags);
void CleanupCapture();
void FreeCaptureData();
+6
View File
@@ -191,6 +191,8 @@ const char *D3D11ChunkNames[] = {
"ID3D11Device3::CreateShaderResourceView1",
"ID3D11Device3::CreateRenderTargetView1",
"ID3D11Device3::CreateUnorderedAccessView1",
"IDXGISwapChain::Present",
};
WRAPPED_POOL_INST(WrappedID3D11Device);
@@ -3299,7 +3301,11 @@ HRESULT WrappedID3D11Device::Present(WrappedIDXGISwapChain3 *swap, UINT SyncInte
// kill any current capture that isn't application defined
if(m_State == WRITING_CAPFRAME && !m_AppControlledCapture)
{
m_pImmediateContext->Present(SyncInterval, Flags);
RenderDoc::Inst().EndFrameCapture((ID3D11Device *)this, swapdesc.OutputWindow);
}
if(RenderDoc::Inst().ShouldTriggerCapture(m_FrameCounter) && m_State == WRITING_IDLE)
{