diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index 92a42a714a..f8b954d047 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -103,8 +103,14 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue(SerialiserType &ser, if(IsReplayingAndReading()) { + void *realptr = NULL; + HRESULT hr = m_pDevice->CreateCommandQueue(&Descriptor, guid, &realptr); + ID3D12CommandQueue *ret = NULL; - HRESULT hr = m_pDevice->CreateCommandQueue(&Descriptor, guid, (void **)&ret); + if(guid == __uuidof(ID3D12CommandQueue)) + ret = (ID3D12CommandQueue *)realptr; + else if(guid == __uuidof(ID3D12CommandQueue1)) + ret = (ID3D12CommandQueue1 *)realptr; if(FAILED(hr)) { @@ -154,12 +160,17 @@ HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC * if(ppCommandQueue == NULL) return m_pDevice->CreateCommandQueue(pDesc, riid, NULL); - if(riid != __uuidof(ID3D12CommandQueue)) + if(riid != __uuidof(ID3D12CommandQueue) && riid != __uuidof(ID3D12CommandQueue1)) return E_NOINTERFACE; + void *realptr = NULL; + HRESULT ret = m_pDevice->CreateCommandQueue(pDesc, riid, &realptr); + ID3D12CommandQueue *real = NULL; - HRESULT ret; - SERIALISE_TIME_CALL(ret = m_pDevice->CreateCommandQueue(pDesc, riid, (void **)&real)); + if(riid == __uuidof(ID3D12CommandQueue)) + real = (ID3D12CommandQueue *)realptr; + else if(riid == __uuidof(ID3D12CommandQueue1)) + real = (ID3D12CommandQueue1 *)realptr; if(SUCCEEDED(ret)) { @@ -210,7 +221,10 @@ HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC * wrapped->GetCreationRecord()->GetResourceID(), eFrameRef_Read); } - *ppCommandQueue = (ID3D12CommandQueue *)wrapped; + if(riid == __uuidof(ID3D12CommandQueue)) + *ppCommandQueue = (ID3D12CommandQueue *)wrapped; + else if(riid == __uuidof(ID3D12CommandQueue1)) + *ppCommandQueue = (ID3D12CommandQueue1 *)wrapped; } else { diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp index c696928e57..3d0854238f 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp @@ -79,7 +79,13 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue1(SerialiserType &ser, HRESULT hr = E_NOINTERFACE; if(m_pDevice9) { - hr = m_pDevice9->CreateCommandQueue1(&Descriptor, creator, guid, (void **)&ret); + void *realptr = NULL; + hr = m_pDevice9->CreateCommandQueue1(&Descriptor, creator, guid, &realptr); + + if(guid == __uuidof(ID3D12CommandQueue)) + ret = (ID3D12CommandQueue *)realptr; + else if(guid == __uuidof(ID3D12CommandQueue1)) + ret = (ID3D12CommandQueue1 *)realptr; } else { @@ -136,12 +142,18 @@ HRESULT WrappedID3D12Device::CreateCommandQueue1(const D3D12_COMMAND_QUEUE_DESC if(ppCommandQueue == NULL) return m_pDevice9->CreateCommandQueue1(pDesc, CreatorID, riid, NULL); - if(riid != __uuidof(ID3D12CommandQueue)) + if(riid != __uuidof(ID3D12CommandQueue) && riid != __uuidof(ID3D12CommandQueue1)) return E_NOINTERFACE; - ID3D12CommandQueue *real = NULL; + void *realptr = NULL; HRESULT ret; - SERIALISE_TIME_CALL(ret = m_pDevice9->CreateCommandQueue1(pDesc, CreatorID, riid, (void **)&real)); + SERIALISE_TIME_CALL(ret = m_pDevice9->CreateCommandQueue1(pDesc, CreatorID, riid, &realptr)); + + ID3D12CommandQueue *real = NULL; + if(riid == __uuidof(ID3D12CommandQueue)) + real = (ID3D12CommandQueue *)realptr; + else if(riid == __uuidof(ID3D12CommandQueue1)) + real = (ID3D12CommandQueue1 *)realptr; if(SUCCEEDED(ret)) { @@ -192,7 +204,10 @@ HRESULT WrappedID3D12Device::CreateCommandQueue1(const D3D12_COMMAND_QUEUE_DESC wrapped->GetCreationRecord()->GetResourceID(), eFrameRef_Read); } - *ppCommandQueue = (ID3D12CommandQueue *)wrapped; + if(riid == __uuidof(ID3D12CommandQueue)) + *ppCommandQueue = (ID3D12CommandQueue *)wrapped; + else if(riid == __uuidof(ID3D12CommandQueue1)) + *ppCommandQueue = (ID3D12CommandQueue1 *)wrapped; } else {