Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-01-22 22:04:39 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-01-22 22:04:39 +0300
commit3128f4ea8e90a2053d420c0c78235c8befb718f5 (patch)
tree37a0ddd9413e24897121d90b678edb8c9aaec101
parent0ee69fef00fa958a433d25732be27aa18b892ac4 (diff)
[dxgi] Implement IDXGIVkInteropFactory for DXGI factorydxgi-interop-factory
-rw-r--r--src/dxgi/dxgi_factory.cpp44
-rw-r--r--src/dxgi/dxgi_factory.h30
2 files changed, 73 insertions, 1 deletions
diff --git a/src/dxgi/dxgi_factory.cpp b/src/dxgi/dxgi_factory.cpp
index d1568663..63522186 100644
--- a/src/dxgi/dxgi_factory.cpp
+++ b/src/dxgi/dxgi_factory.cpp
@@ -5,8 +5,47 @@
namespace dxvk {
+ DxgiVkFactory::DxgiVkFactory(DxgiFactory* pFactory)
+ : m_factory(pFactory) {
+
+ }
+
+
+ ULONG STDMETHODCALLTYPE DxgiVkFactory::AddRef() {
+ return m_factory->AddRef();
+ }
+
+
+ ULONG STDMETHODCALLTYPE DxgiVkFactory::Release() {
+ return m_factory->Release();
+ }
+
+
+ HRESULT STDMETHODCALLTYPE DxgiVkFactory::QueryInterface(
+ REFIID riid,
+ void** ppvObject) {
+ return m_factory->QueryInterface(riid, ppvObject);
+ }
+
+
+ void STDMETHODCALLTYPE DxgiVkFactory::GetVulkanInstance(
+ VkInstance* pInstance,
+ PFN_vkGetInstanceProcAddr* ppfnVkGetInstanceProcAddr) {
+ auto instance = m_factory->GetDXVKInstance();
+
+ if (pInstance)
+ *pInstance = instance->handle();
+
+ if (ppfnVkGetInstanceProcAddr)
+ *ppfnVkGetInstanceProcAddr = instance->vki()->getLoaderProc();
+ }
+
+
+
+
DxgiFactory::DxgiFactory(UINT Flags)
: m_instance (new DxvkInstance()),
+ m_interop (this),
m_options (m_instance->config()),
m_monitorInfo (this, m_options),
m_flags (Flags) {
@@ -40,6 +79,11 @@ namespace dxvk {
return S_OK;
}
+ if (riid == __uuidof(IDXGIVkInteropFactory)) {
+ *ppvObject = ref(&m_interop);
+ return S_OK;
+ }
+
if (riid == __uuidof(IDXGIVkMonitorInfo)) {
*ppvObject = ref(&m_monitorInfo);
return S_OK;
diff --git a/src/dxgi/dxgi_factory.h b/src/dxgi/dxgi_factory.h
index 4d75c277..72af2f3c 100644
--- a/src/dxgi/dxgi_factory.h
+++ b/src/dxgi/dxgi_factory.h
@@ -9,7 +9,34 @@
#include "../dxvk/dxvk_instance.h"
namespace dxvk {
-
+
+ class DxgiFactory;
+
+ class DxgiVkFactory : public IDXGIVkInteropFactory {
+
+ public:
+
+ DxgiVkFactory(DxgiFactory* pFactory);
+
+ ULONG STDMETHODCALLTYPE AddRef();
+
+ ULONG STDMETHODCALLTYPE Release();
+
+ HRESULT STDMETHODCALLTYPE QueryInterface(
+ REFIID riid,
+ void** ppvObject);
+
+ void STDMETHODCALLTYPE GetVulkanInstance(
+ VkInstance* pInstance,
+ PFN_vkGetInstanceProcAddr* ppfnVkGetInstanceProcAddr);
+
+ private:
+
+ DxgiFactory* m_factory;
+
+ };
+
+
class DxgiFactory : public DxgiObject<IDXGIFactory7> {
public:
@@ -146,6 +173,7 @@ namespace dxvk {
private:
Rc<DxvkInstance> m_instance;
+ DxgiVkFactory m_interop;
DxgiOptions m_options;
DxgiMonitorInfo m_monitorInfo;
UINT m_flags;