1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00
dxvk/src/dxgi/dxgi_main.cpp

40 lines
1.1 KiB
C++
Raw Normal View History

2017-10-11 03:09:04 +02:00
#include "dxgi_factory.h"
#include "dxgi_include.h"
namespace dxvk {
Logger Logger::s_instance("dxgi.log");
2017-10-11 03:09:04 +02:00
HRESULT createDxgiFactory(REFIID riid, void **ppFactory) {
if (riid != __uuidof(IDXGIFactory)
&& riid != __uuidof(IDXGIFactory1)) {
2017-10-11 03:09:04 +02:00
Logger::err("CreateDXGIFactory: Requested version of IDXGIFactory not supported");
Logger::err(str::format(riid));
*ppFactory = nullptr;
return E_NOINTERFACE;
2017-10-11 03:09:04 +02:00
}
try {
*ppFactory = ref(new DxgiFactory());
return S_OK;
} catch (const DxvkError& err) {
Logger::err(err.message());
return DXGI_ERROR_UNSUPPORTED;
}
}
}
extern "C" {
DLLEXPORT HRESULT __stdcall CreateDXGIFactory2(UINT Flags, REFIID riid, void **ppFactory) {
dxvk::Logger::warn("CreateDXGIFactory2: Ignoring flags");
return dxvk::createDxgiFactory(riid, ppFactory);
}
2017-10-11 03:09:04 +02:00
DLLEXPORT HRESULT __stdcall CreateDXGIFactory1(REFIID riid, void **ppFactory) {
return dxvk::createDxgiFactory(riid, ppFactory);
}
DLLEXPORT HRESULT __stdcall CreateDXGIFactory(REFIID riid, void **ppFactory) {
return dxvk::createDxgiFactory(riid, ppFactory);
}
}