From d15549ba89b6cc0910f4b9f17e78fd6c9c8e1ac1 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 13 Nov 2019 11:33:11 +0000 Subject: [PATCH] Add some extra UUID handles in D3D11/DXGI QueryInterface implementations --- renderdoc/driver/d3d11/d3d11_device.cpp | 36 ++++++++++++++++ renderdoc/driver/dxgi/dxgi_wrapped.cpp | 55 +++++++++++++++++-------- 2 files changed, 73 insertions(+), 18 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 24c459bd4..d816ed1e8 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -488,6 +488,10 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject) static const GUID ID3D10Device_uuid = { 0x9b7e4c0f, 0x342c, 0x4106, {0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0}}; + // ID3D10DeviceChild UUID {9B7E4C00-342C-4106-A19F-4F2704F689F0} + static const GUID ID3D10DeviceChild_uuid = { + 0x9b7e4c00, 0x342c, 0x4106, {0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0}}; + // ID3D12Device UUID {189819f1-1db6-4b57-be54-1821339b85f7} static const GUID ID3D12Device_uuid = { 0x189819f1, 0x1db6, 0x4b57, {0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7}}; @@ -496,6 +500,10 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject) static const GUID ID3D11ShaderTraceFactory_uuid = { 0x1fbad429, 0x66ab, 0x41cc, {0x96, 0x17, 0x66, 0x7a, 0xc1, 0x0e, 0x44, 0x59}}; + // ID3D11On12Device UUID {85611e73-70a9-490e-9614-a9e302777904} + static const GUID ID3D11On12Device_uuid = { + 0x85611e73, 0x70a9, 0x490e, {0x96, 0x14, 0xa9, 0xe3, 0x02, 0x77, 0x79, 0x04}}; + // RenderDoc UUID {A7AA6116-9C8D-4BBA-9083-B4D816B71B78} static const GUID IRenderDoc_uuid = { 0xa7aa6116, 0x9c8d, 0x4bba, {0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78}}; @@ -576,6 +584,22 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject) return hr; } } + else if(riid == __uuidof(IDXGIDevice4)) + { + hr = m_pDevice->QueryInterface(riid, ppvObject); + + if(SUCCEEDED(hr)) + { + IDXGIDevice4 *real = (IDXGIDevice4 *)(*ppvObject); + *ppvObject = (IDXGIDevice4 *)(new WrappedIDXGIDevice4(real, this)); + return S_OK; + } + else + { + *ppvObject = NULL; + return hr; + } + } else if(riid == __uuidof(ID3D11Device)) { AddRef(); @@ -588,6 +612,12 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject) *ppvObject = NULL; return E_NOINTERFACE; } + else if(riid == ID3D10DeviceChild_uuid) + { + RDCWARN("Trying to get ID3D10DeviceChild - not supported."); + *ppvObject = NULL; + return E_NOINTERFACE; + } else if(riid == ID3D12Device_uuid) { RDCWARN("Trying to get ID3D12Device - not supported."); @@ -679,6 +709,12 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject) *ppvObject = NULL; return E_NOINTERFACE; } + else if(riid == ID3D11On12Device_uuid) + { + RDCWARN("Trying to get ID3D11On12Device. Not supported at this time."); + *ppvObject = NULL; + return E_NOINTERFACE; + } else if(riid == __uuidof(ID3D11InfoQueue)) { RDCWARN( diff --git a/renderdoc/driver/dxgi/dxgi_wrapped.cpp b/renderdoc/driver/dxgi/dxgi_wrapped.cpp index 02f622b4b..30f0981bd 100644 --- a/renderdoc/driver/dxgi/dxgi_wrapped.cpp +++ b/renderdoc/driver/dxgi/dxgi_wrapped.cpp @@ -77,6 +77,30 @@ bool RefCountDXGIObject::HandleWrap(REFIID riid, void **ppvObject) *ppvObject = (IDXGIAdapter *)(new WrappedIDXGIAdapter4(real)); return true; } + else if(riid == __uuidof(IDXGIAdapter1)) + { + IDXGIAdapter1 *real = (IDXGIAdapter1 *)(*ppvObject); + *ppvObject = (IDXGIAdapter1 *)(new WrappedIDXGIAdapter4(real)); + return true; + } + else if(riid == __uuidof(IDXGIAdapter2)) + { + IDXGIAdapter2 *real = (IDXGIAdapter2 *)(*ppvObject); + *ppvObject = (IDXGIAdapter2 *)(new WrappedIDXGIAdapter4(real)); + return true; + } + else if(riid == __uuidof(IDXGIAdapter3)) + { + IDXGIAdapter3 *real = (IDXGIAdapter3 *)(*ppvObject); + *ppvObject = (IDXGIAdapter3 *)(new WrappedIDXGIAdapter4(real)); + return true; + } + else if(riid == __uuidof(IDXGIAdapter4)) + { + IDXGIAdapter4 *real = (IDXGIAdapter4 *)(*ppvObject); + *ppvObject = (IDXGIAdapter4 *)(new WrappedIDXGIAdapter4(real)); + return true; + } else if(riid == __uuidof(IDXGIFactory)) { // yes I know PRECISELY how fucked up this is. Speak to microsoft - after KB2670838 the internal @@ -95,30 +119,12 @@ bool RefCountDXGIObject::HandleWrap(REFIID riid, void **ppvObject) RDCERR("Unexpected uuid in RefCountDXGIObject::HandleWrap"); return false; } - else if(riid == __uuidof(IDXGIAdapter1)) - { - IDXGIAdapter1 *real = (IDXGIAdapter1 *)(*ppvObject); - *ppvObject = (IDXGIAdapter1 *)(new WrappedIDXGIAdapter4(real)); - return true; - } else if(riid == __uuidof(IDXGIFactory1)) { IDXGIFactory1 *real = (IDXGIFactory1 *)(*ppvObject); *ppvObject = (IDXGIFactory1 *)(new WrappedIDXGIFactory(real)); return true; } - else if(riid == __uuidof(IDXGIAdapter2)) - { - IDXGIAdapter2 *real = (IDXGIAdapter2 *)(*ppvObject); - *ppvObject = (IDXGIAdapter2 *)(new WrappedIDXGIAdapter4(real)); - return true; - } - else if(riid == __uuidof(IDXGIAdapter3)) - { - IDXGIAdapter3 *real = (IDXGIAdapter3 *)(*ppvObject); - *ppvObject = (IDXGIAdapter3 *)(new WrappedIDXGIAdapter4(real)); - return true; - } else if(riid == __uuidof(IDXGIFactory2)) { IDXGIFactory2 *real = (IDXGIFactory2 *)(*ppvObject); @@ -887,6 +893,19 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIAdapter4::QueryInterface(REFIID riid, void return E_NOINTERFACE; } } + else if(riid == __uuidof(IDXGIAdapter4)) + { + if(m_pReal3) + { + AddRef(); + *ppvObject = (IDXGIAdapter4 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else { WarnUnknownGUID("IDXGIAdapter", riid);