mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 13:45:55 +00:00
Ensure optional interfaces are correctly initialised to NULL
This commit is contained in:
@@ -204,6 +204,7 @@ WrappedID3D12CommandQueue::WrappedID3D12CommandQueue(ID3D12CommandQueue *real,
|
||||
RenderDoc::Inst().GetCrashHandler()->RegisterMemoryRegion(this,
|
||||
sizeof(WrappedID3D12CommandQueue));
|
||||
|
||||
m_WrappedDebug.m_pReal = NULL;
|
||||
if(m_pReal)
|
||||
m_pReal->QueryInterface(__uuidof(ID3D12DebugCommandQueue), (void **)&m_WrappedDebug.m_pReal);
|
||||
|
||||
@@ -261,6 +262,19 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::QueryInterface(REFIID riid,
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugCommandQueue))
|
||||
{
|
||||
if(m_WrappedDebug.m_pReal)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugCommandQueue *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12Pageable))
|
||||
{
|
||||
*ppvObject = (ID3D12Pageable *)this;
|
||||
@@ -782,15 +796,19 @@ WrappedID3D12GraphicsCommandList2::WrappedID3D12GraphicsCommandList2(ID3D12Graph
|
||||
RenderDoc::Inst().GetCrashHandler()->RegisterMemoryRegion(
|
||||
this, sizeof(WrappedID3D12GraphicsCommandList2));
|
||||
|
||||
m_pList1 = NULL;
|
||||
m_pList2 = NULL;
|
||||
|
||||
m_WrappedDebug.m_pReal = NULL;
|
||||
m_WrappedDebug.m_pReal1 = NULL;
|
||||
m_WrappedDebug.m_pReal2 = NULL;
|
||||
|
||||
if(m_pList)
|
||||
{
|
||||
m_pList->QueryInterface(__uuidof(ID3D12DebugCommandList), (void **)&m_WrappedDebug.m_pReal);
|
||||
m_pList->QueryInterface(__uuidof(ID3D12DebugCommandList1), (void **)&m_WrappedDebug.m_pReal1);
|
||||
m_pList->QueryInterface(__uuidof(ID3D12DebugCommandList2), (void **)&m_WrappedDebug.m_pReal2);
|
||||
|
||||
m_pList1 = NULL;
|
||||
m_pList2 = NULL;
|
||||
|
||||
m_pList->QueryInterface(__uuidof(ID3D12GraphicsCommandList1), (void **)&m_pList1);
|
||||
m_pList->QueryInterface(__uuidof(ID3D12GraphicsCommandList2), (void **)&m_pList2);
|
||||
}
|
||||
@@ -918,6 +936,45 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList2::QueryInterface(REFI
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugCommandList))
|
||||
{
|
||||
if(m_WrappedDebug.m_pReal)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugCommandList *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugCommandList1))
|
||||
{
|
||||
if(m_WrappedDebug.m_pReal1)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugCommandList1 *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugCommandList2))
|
||||
{
|
||||
if(m_WrappedDebug.m_pReal2)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugCommandList2 *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12GraphicsCommandList1))
|
||||
{
|
||||
*ppvObject = (ID3D12GraphicsCommandList1 *)this;
|
||||
|
||||
@@ -256,6 +256,9 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
}
|
||||
|
||||
m_pInfoQueue = NULL;
|
||||
m_WrappedDebug.m_pDebug = NULL;
|
||||
m_WrappedDebug.m_pDebug1 = NULL;
|
||||
m_WrappedDebug.m_pDebug2 = NULL;
|
||||
if(m_pDevice)
|
||||
{
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D12InfoQueue), (void **)&m_pInfoQueue);
|
||||
@@ -542,6 +545,48 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject)
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugDevice1))
|
||||
{
|
||||
// we queryinterface for this at startup, so if it's present we can
|
||||
// return our wrapper
|
||||
if(m_WrappedDebug.m_pDebug1)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugDevice1 *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCWARN(
|
||||
"Returning a dummy ID3D12DebugDevice1 that does nothing. This ID3D12DebugDevice1 will "
|
||||
"not "
|
||||
"work!");
|
||||
*ppvObject = (ID3D12DebugDevice1 *)&m_DummyDebug;
|
||||
m_DummyDebug.AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D12DebugDevice2))
|
||||
{
|
||||
// we queryinterface for this at startup, so if it's present we can
|
||||
// return our wrapper
|
||||
if(m_WrappedDebug.m_pDebug1)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D12DebugDevice2 *)&m_WrappedDebug;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCWARN(
|
||||
"Returning a dummy ID3D12DebugDevice2 that does nothing. This ID3D12DebugDevice2 will "
|
||||
"not "
|
||||
"work!");
|
||||
*ppvObject = (ID3D12DebugDevice2 *)&m_DummyDebug;
|
||||
m_DummyDebug.AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else if(riid == IRenderDoc_uuid)
|
||||
{
|
||||
AddRef();
|
||||
|
||||
Reference in New Issue
Block a user