mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Handle querying D3D device for multiple interfaces, from DXGI. Refs #402
This commit is contained in:
@@ -412,8 +412,32 @@ public:
|
||||
// interface for DXGI
|
||||
virtual IUnknown *GetRealIUnknown() { return GetReal(); }
|
||||
virtual IID GetBackbufferUUID() { return __uuidof(ID3D11Texture2D); }
|
||||
virtual IID GetDeviceUUID() { return __uuidof(ID3D11Device); }
|
||||
virtual IUnknown *GetDeviceInterface() { return (ID3D11Device *)this; }
|
||||
virtual bool IsDeviceUUID(REFIID iid)
|
||||
{
|
||||
if(iid == __uuidof(ID3D11Device) || iid == __uuidof(ID3D11Device1) ||
|
||||
iid == __uuidof(ID3D11Device2) || iid == __uuidof(ID3D11Device3) ||
|
||||
iid == __uuidof(ID3D11Device4))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
virtual IUnknown *GetDeviceInterface(REFIID iid)
|
||||
{
|
||||
if(iid == __uuidof(ID3D11Device))
|
||||
return (ID3D11Device *)this;
|
||||
else if(iid == __uuidof(ID3D11Device1))
|
||||
return (ID3D11Device1 *)this;
|
||||
else if(iid == __uuidof(ID3D11Device2))
|
||||
return (ID3D11Device2 *)this;
|
||||
else if(iid == __uuidof(ID3D11Device3))
|
||||
return (ID3D11Device3 *)this;
|
||||
else if(iid == __uuidof(ID3D11Device4))
|
||||
return (ID3D11Device4 *)this;
|
||||
|
||||
RDCERR("Requested unknown device interface %s", ToStr::Get(iid).c_str());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
// log replaying
|
||||
|
||||
|
||||
@@ -126,8 +126,19 @@ public:
|
||||
// interface for DXGI
|
||||
virtual IUnknown *GetRealIUnknown() { return GetReal(); }
|
||||
virtual IID GetBackbufferUUID() { return __uuidof(ID3D12Resource); }
|
||||
virtual IID GetDeviceUUID() { return __uuidof(ID3D12CommandQueue); }
|
||||
virtual IUnknown *GetDeviceInterface() { return (ID3D12CommandQueue *)this; }
|
||||
virtual bool IsDeviceUUID(REFIID iid)
|
||||
{
|
||||
return iid == __uuidof(ID3D12CommandQueue) ? true : false;
|
||||
}
|
||||
virtual IUnknown *GetDeviceInterface(REFIID iid)
|
||||
{
|
||||
if(iid == __uuidof(ID3D12CommandQueue))
|
||||
return (ID3D12CommandQueue *)this;
|
||||
|
||||
RDCERR("Requested unknown device interface %s", ToStr::Get(iid).c_str());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
// the rest forward to the device
|
||||
virtual void FirstFrame(WrappedIDXGISwapChain3 *swapChain) { m_pDevice->FirstFrame(swapChain); }
|
||||
virtual void NewSwapchainBuffer(IUnknown *backbuffer)
|
||||
|
||||
@@ -424,8 +424,16 @@ public:
|
||||
// interface for DXGI
|
||||
virtual IUnknown *GetRealIUnknown() { return GetReal(); }
|
||||
virtual IID GetBackbufferUUID() { return __uuidof(ID3D12Resource); }
|
||||
virtual IID GetDeviceUUID() { return __uuidof(ID3D12Device); }
|
||||
virtual IUnknown *GetDeviceInterface() { return (ID3D12Device *)this; }
|
||||
virtual bool IsDeviceUUID(REFIID iid) { return iid == __uuidof(ID3D12Device) ? true : false; }
|
||||
virtual IUnknown *GetDeviceInterface(REFIID iid)
|
||||
{
|
||||
if(iid == __uuidof(ID3D12Device))
|
||||
return (ID3D12Device *)this;
|
||||
|
||||
RDCERR("Requested unknown device interface %s", ToStr::Get(iid).c_str());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
// Swap Chain
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(IUnknown *, WrapSwapchainBuffer,
|
||||
WrappedIDXGISwapChain3 *swap, DXGI_SWAP_CHAIN_DESC *desc,
|
||||
|
||||
@@ -382,10 +382,10 @@ HRESULT WrappedIDXGISwapChain3::GetDevice(
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
// try one of the trivial wraps, we don't mind making a new one of those
|
||||
if(riid == m_pDevice->GetDeviceUUID())
|
||||
if(m_pDevice->IsDeviceUUID(riid))
|
||||
{
|
||||
// probably they're asking for the device device.
|
||||
*ppDevice = m_pDevice->GetDeviceInterface();
|
||||
*ppDevice = m_pDevice->GetDeviceInterface(riid);
|
||||
m_pDevice->AddRef();
|
||||
}
|
||||
else if(riid == __uuidof(IDXGISwapChain))
|
||||
@@ -601,10 +601,10 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain3::QueryInterface(REFIID riid, vo
|
||||
|
||||
HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if(riid == m_pD3DDevice->GetDeviceUUID())
|
||||
if(m_pD3DDevice->IsDeviceUUID(riid))
|
||||
{
|
||||
m_pD3DDevice->AddRef();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface(riid);
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
@@ -620,10 +620,10 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice1::QueryInterface(REFIID riid, void
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if(riid == m_pD3DDevice->GetDeviceUUID())
|
||||
if(m_pD3DDevice->IsDeviceUUID(riid))
|
||||
{
|
||||
m_pD3DDevice->AddRef();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface(riid);
|
||||
return S_OK;
|
||||
}
|
||||
else if(riid == __uuidof(IDXGIDevice1))
|
||||
@@ -673,10 +673,10 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice1::QueryInterface(REFIID riid, void
|
||||
|
||||
HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice2::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if(riid == m_pD3DDevice->GetDeviceUUID())
|
||||
if(m_pD3DDevice->IsDeviceUUID(riid))
|
||||
{
|
||||
m_pD3DDevice->AddRef();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface(riid);
|
||||
return S_OK;
|
||||
}
|
||||
else if(riid == __uuidof(IDXGIDevice1))
|
||||
@@ -717,10 +717,10 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice2::QueryInterface(REFIID riid, void
|
||||
|
||||
HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice3::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if(riid == m_pD3DDevice->GetDeviceUUID())
|
||||
if(m_pD3DDevice->IsDeviceUUID(riid))
|
||||
{
|
||||
m_pD3DDevice->AddRef();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface();
|
||||
*ppvObject = m_pD3DDevice->GetDeviceInterface(riid);
|
||||
return S_OK;
|
||||
}
|
||||
else if(riid == __uuidof(IDXGIDevice1))
|
||||
|
||||
@@ -164,8 +164,8 @@ struct ID3DDevice
|
||||
|
||||
virtual IID GetBackbufferUUID() = 0;
|
||||
|
||||
virtual IID GetDeviceUUID() = 0;
|
||||
virtual IUnknown *GetDeviceInterface() = 0;
|
||||
virtual bool IsDeviceUUID(REFIID guid) = 0;
|
||||
virtual IUnknown *GetDeviceInterface(REFIID guid) = 0;
|
||||
|
||||
virtual void FirstFrame(WrappedIDXGISwapChain3 *swapChain) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user