1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxgi] Implement IDXGIVkInteropFactory for DXGI factory

This commit is contained in:
Philip Rebohle 2023-01-22 20:04:39 +01:00
parent 0ee69fef00
commit 3128f4ea8e
2 changed files with 73 additions and 1 deletions

View File

@ -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;

View File

@ -10,6 +10,33 @@
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;