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

44 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 {
struct SdlInstance {
SdlInstance() {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE))
Logger::err("Instance::init: Failed to initialize SDL");
}
~SdlInstance() {
SDL_Quit();
}
};
SdlInstance sdl;
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");
return DXGI_ERROR_UNSUPPORTED;
}
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 CreateDXGIFactory1(REFIID riid, void **ppFactory) {
return dxvk::createDxgiFactory(riid, ppFactory);
}
DLLEXPORT HRESULT __stdcall CreateDXGIFactory(REFIID riid, void **ppFactory) {
return dxvk::createDxgiFactory(riid, ppFactory);
}
}