From 41112d10e52582280f19ae130d0735d6efd56f62 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 19 Feb 2018 10:51:50 +0000 Subject: [PATCH] Allow uuid for ID3D12CommandList in CreateCommandList * This is as well as ID3D12GraphicsCommandList which is the actual type returned. --- .../driver/d3d12/d3d12_command_list_wrap.cpp | 14 ++++++++------ renderdoc/driver/d3d12/d3d12_device_wrap.cpp | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index c4e226623..f933d64ff 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -224,8 +224,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser, if(rerecord) { ID3D12GraphicsCommandList *list = NULL; - HRESULT hr = m_pDevice->CreateCommandList(nodeMask, type, pAllocator, pInitialState, riid, - (void **)&list); + HRESULT hr = + m_pDevice->CreateCommandList(nodeMask, type, pAllocator, pInitialState, + __uuidof(ID3D12GraphicsCommandList), (void **)&list); if(FAILED(hr)) { @@ -270,7 +271,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser, if(!GetResourceManager()->HasLiveResource(BakedCommandList)) { ID3D12GraphicsCommandList *list = NULL; - m_pDevice->CreateCommandList(nodeMask, type, pAllocator, pInitialState, riid, (void **)&list); + m_pDevice->CreateCommandList(nodeMask, type, pAllocator, pInitialState, + __uuidof(ID3D12GraphicsCommandList), (void **)&list); m_pDevice->AddResource(BakedCommandList, ResourceType::CommandBuffer, "Baked Command List"); m_pDevice->GetReplay()->GetResourceDesc(BakedCommandList).initialisationChunks.clear(); @@ -309,9 +311,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser, } ID3D12GraphicsCommandList *list = NULL; - m_pDevice->CreateCommandList(nodeMask, type, - m_Cmd->m_CrackedAllocators[GetResID(pAllocator)], - pInitialState, riid, (void **)&list); + m_pDevice->CreateCommandList( + nodeMask, type, m_Cmd->m_CrackedAllocators[GetResID(pAllocator)], pInitialState, + __uuidof(ID3D12GraphicsCommandList), (void **)&list); RDCASSERT(m_Cmd->m_BakedCmdListInfo[BakedCommandList].crackedLists.empty()); m_Cmd->m_BakedCmdListInfo[BakedCommandList].crackedLists.push_back(list); diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index cf15231c0..2a8a03ab7 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -234,8 +234,8 @@ bool WrappedID3D12Device::Serialise_CreateCommandList(SerialiserType &ser, UINT if(IsReplayingAndReading()) { ID3D12GraphicsCommandList *list = NULL; - HRESULT hr = - CreateCommandList(nodeMask, type, pCommandAllocator, pInitialState, guid, (void **)&list); + HRESULT hr = CreateCommandList(nodeMask, type, pCommandAllocator, pInitialState, + __uuidof(ID3D12GraphicsCommandList), (void **)&list); if(FAILED(hr)) { @@ -268,13 +268,14 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST return m_pDevice->CreateCommandList(nodeMask, type, Unwrap(pCommandAllocator), Unwrap(pInitialState), riid, NULL); - if(riid != __uuidof(ID3D12GraphicsCommandList)) + if(riid != __uuidof(ID3D12GraphicsCommandList) && riid != __uuidof(ID3D12CommandList)) return E_NOINTERFACE; ID3D12GraphicsCommandList *real = NULL; HRESULT ret; - SERIALISE_TIME_CALL(ret = m_pDevice->CreateCommandList(nodeMask, type, Unwrap(pCommandAllocator), - Unwrap(pInitialState), riid, (void **)&real)); + SERIALISE_TIME_CALL(ret = m_pDevice->CreateCommandList( + nodeMask, type, Unwrap(pCommandAllocator), Unwrap(pInitialState), + __uuidof(ID3D12GraphicsCommandList), (void **)&real)); if(SUCCEEDED(ret)) { @@ -315,7 +316,12 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST // during replay, the caller is responsible for calling AddLiveResource as this function // can be called from ID3D12GraphicsCommandList::Reset serialising - *ppCommandList = (ID3D12GraphicsCommandList *)wrapped; + if(riid == __uuidof(ID3D12GraphicsCommandList)) + *ppCommandList = (ID3D12GraphicsCommandList *)wrapped; + else if(riid == __uuidof(ID3D12CommandList)) + *ppCommandList = (ID3D12CommandList *)wrapped; + else + RDCERR("Unexpected riid! %s", ToStr(riid).c_str()); } return ret;