mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[dxgi] Implement DxgiSurfaceFactory
This commit is contained in:
parent
1754b73ade
commit
3a9e975a71
@ -3,6 +3,7 @@ d3d11_res = wrc_generator.process('version.rc')
|
||||
dxgi_common_src = [
|
||||
'../dxgi/dxgi_format.cpp',
|
||||
'../dxgi/dxgi_monitor.cpp',
|
||||
'../dxgi/dxgi_surface.cpp',
|
||||
'../dxgi/dxgi_swapchain.cpp',
|
||||
]
|
||||
|
||||
|
45
src/dxgi/dxgi_surface.cpp
Normal file
45
src/dxgi/dxgi_surface.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "dxgi_surface.h"
|
||||
|
||||
#include "../wsi/wsi_window.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxgiSurfaceFactory::DxgiSurfaceFactory(PFN_vkGetInstanceProcAddr vulkanLoaderProc, HWND hWnd)
|
||||
: m_vkGetInstanceProcAddr(vulkanLoaderProc), m_window(hWnd) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
DxgiSurfaceFactory::~DxgiSurfaceFactory() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiSurfaceFactory::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
if (ppvObject == nullptr)
|
||||
return E_POINTER;
|
||||
|
||||
*ppvObject = nullptr;
|
||||
|
||||
if (riid == __uuidof(IUnknown)
|
||||
|| riid == __uuidof(IDXGIVkSurfaceFactory)) {
|
||||
*ppvObject = ref(this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Logger::warn("DxgiSurfaceFactory::QueryInterface: Unknown interface query");
|
||||
Logger::warn(str::format(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
VkResult STDMETHODCALLTYPE DxgiSurfaceFactory::CreateSurface(
|
||||
VkInstance Instance,
|
||||
VkPhysicalDevice Adapter,
|
||||
VkSurfaceKHR* pSurface) {
|
||||
return wsi::createSurface(m_window, m_vkGetInstanceProcAddr, Instance, pSurface);
|
||||
}
|
||||
|
||||
}
|
43
src/dxgi/dxgi_surface.h
Normal file
43
src/dxgi/dxgi_surface.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "../util/com/com_object.h"
|
||||
|
||||
#include "../vulkan/vulkan_loader.h"
|
||||
|
||||
#include "dxgi_interfaces.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Surface factory
|
||||
*
|
||||
* Provides a way to transparently create a
|
||||
* Vulkan surface for a given platform window.
|
||||
*/
|
||||
class DxgiSurfaceFactory : public ComObject<IDXGIVkSurfaceFactory> {
|
||||
|
||||
public:
|
||||
|
||||
DxgiSurfaceFactory(
|
||||
PFN_vkGetInstanceProcAddr vulkanLoaderProc,
|
||||
HWND hWnd);
|
||||
|
||||
~DxgiSurfaceFactory();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
VkResult STDMETHODCALLTYPE CreateSurface(
|
||||
VkInstance Instance,
|
||||
VkPhysicalDevice Adapter,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
private:
|
||||
|
||||
PFN_vkGetInstanceProcAddr m_vkGetInstanceProcAddr;
|
||||
HWND m_window;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -9,6 +9,7 @@ dxgi_src = [
|
||||
'dxgi_monitor.cpp',
|
||||
'dxgi_options.cpp',
|
||||
'dxgi_output.cpp',
|
||||
'dxgi_surface.cpp',
|
||||
'dxgi_swapchain.cpp',
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user