Fix D3D12 command list reset not getting correct init parameters

This commit is contained in:
baldurk committed 2020-09-15 13:16:57 +01:00
1 parent 496bbbe976
commit 299249d718
3 files changed
+16 -11

No files matched your search

@@ -161,6 +161,8 @@ private:
D3D12_COMMAND_LIST_TYPE type;
} m_Init;
bool m_FakeCreationReset = false;
static rdcstr GetChunkName(uint32_t idx);
D3D12ResourceManager *GetResourceManager() { return m_pDevice->GetResourceManager(); }
public:
@@ -196,6 +198,8 @@ public:
m_Init.nodeMask = nodeMask;
m_Init.type = type;
}
HRESULT ResetInternal(ID3D12CommandAllocator *pAllocator, ID3D12PipelineState *pInitialState,
bool fakeCreationReset);
bool ValidateRootGPUVA(D3D12_GPU_VIRTUAL_ADDRESS buffer);
@@ -397,19 +397,18 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocator,
ID3D12PipelineState *pInitialState)
{
return ResetInternal(pAllocator, pInitialState, false);
}
HRESULT WrappedID3D12GraphicsCommandList::ResetInternal(ID3D12CommandAllocator *pAllocator,
ID3D12PipelineState *pInitialState,
bool fakeCreationReset)
{
HRESULT ret = S_OK;
if(IsCaptureMode(m_State))
{
// If this is the creation reset we won't have our init params yet and this reset is 'fake' to
// record the initial allocator and state. Don't actually call Reset(), just pretend it was so
// that we can pretend D3D12 doesn't have weird behaviour.
bool resetcall = true;
if(m_Init.riid.Data1 == 0 && m_Init.riid.Data2 == 0 && m_Init.riid.Data3 == 0)
resetcall = false;
m_ListRecord->DisableChunkLocking();
// reset for new recording
@@ -420,7 +419,9 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat
if(m_ListRecord->bakedCommands)
m_ListRecord->bakedCommands->Delete(GetResourceManager());
if(resetcall)
// If this reset is 'fake' to record the initial allocator and state. Don't actually call
// Reset(), just pretend it was so that we can pretend D3D12 doesn't have weird behaviour.
if(!fakeCreationReset)
{
SERIALISE_TIME_CALL(ret = m_pList->Reset(Unwrap(pAllocator), Unwrap(pInitialState)));
}
+2 -2
View File
@@ -340,9 +340,9 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST
if(IsCaptureMode(m_State))
{
// we just serialise out command allocator creation as a reset, since it's equivalent.
wrapped->Reset(pCommandAllocator, pInitialState);
wrapped->SetInitParams(riid, nodeMask, type);
// we just serialise out command allocator creation as a reset, since it's equivalent.
wrapped->ResetInternal(pCommandAllocator, pInitialState, true);
{
CACHE_THREAD_SERIALISER();