From 41fca78d27972e2c29cd77db304a20cefacdd974 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 1 May 2018 23:30:39 +0200 Subject: [PATCH] [dxgi] Add GetDevice method to IDXGIVkInteropSurface Convenient way of getting the IDXGIVkInteropDevice from the surface without having to go through several D3D interface queries. --- src/d3d11/d3d11_texture.cpp | 11 +++++++++++ src/d3d11/d3d11_texture.h | 3 +++ src/dxgi/dxgi_interfaces.h | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 1f3e6d9ff..eddfe8ed7 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -320,6 +320,17 @@ namespace dxvk { } + HRESULT STDMETHODCALLTYPE D3D11VkInteropSurface::GetDevice( + IDXGIVkInteropDevice** ppDevice) { + Com device; + m_container->GetDevice(&device); + + return device->QueryInterface( + __uuidof(IDXGIVkInteropDevice), + reinterpret_cast(ppDevice)); + } + + HRESULT STDMETHODCALLTYPE D3D11VkInteropSurface::GetVulkanImageInfo( VkImage* pHandle, VkImageLayout* pLayout, diff --git a/src/d3d11/d3d11_texture.h b/src/d3d11/d3d11_texture.h index fbfd0205d..0d0ace577 100644 --- a/src/d3d11/d3d11_texture.h +++ b/src/d3d11/d3d11_texture.h @@ -214,6 +214,9 @@ namespace dxvk { REFIID riid, void** ppvObject); + HRESULT STDMETHODCALLTYPE GetDevice( + IDXGIVkInteropDevice** ppDevice); + HRESULT STDMETHODCALLTYPE GetVulkanImageInfo( VkImage* pHandle, VkImageLayout* pLayout, diff --git a/src/dxgi/dxgi_interfaces.h b/src/dxgi/dxgi_interfaces.h index c32bffdd8..7f76f2576 100644 --- a/src/dxgi/dxgi_interfaces.h +++ b/src/dxgi/dxgi_interfaces.h @@ -13,6 +13,7 @@ namespace dxvk { class DxvkImage; } +class IDXGIVkInteropDevice; /** * \brief Private DXGI device interface @@ -144,6 +145,17 @@ MIDL_INTERFACE("5546cf8c-77e7-4341-b05d-8d4d5000e77d") IDXGIVkInteropSurface : public IUnknown { static const GUID guid; + /** + * \brief Retrieves device interop interfaceSlots + * + * Queries the device that owns the surface for + * the \ref IDXGIVkInteropDevice interface. + * \param [out] ppDevice The device interface + * \returns \c S_OK on success + */ + virtual HRESULT STDMETHODCALLTYPE GetDevice( + IDXGIVkInteropDevice** ppDevice) = 0; + /** * \brief Retrieves Vulkan image info *