virtualx-engine/thirdparty/vulkan/loader/dxgi_loader.c

23 lines
683 B
C
Raw Normal View History

2019-11-06 10:38:30 +01:00
#include "dxgi_loader.h"
#include <strsafe.h>
static HMODULE load_dxgi_module() {
TCHAR systemPath[MAX_PATH] = "";
GetSystemDirectory(systemPath, MAX_PATH);
StringCchCat(systemPath, MAX_PATH, TEXT("\\dxgi.dll"));
return LoadLibrary(systemPath);
}
typedef HRESULT (APIENTRY *PFN_CreateDXGIFactory1)(REFIID riid, void **ppFactory);
HRESULT dyn_CreateDXGIFactory1(REFIID riid, void **ppFactory) {
PFN_CreateDXGIFactory1 fpCreateDXGIFactory1 =
(PFN_CreateDXGIFactory1)GetProcAddress(load_dxgi_module(), "CreateDXGIFactory1");
if (fpCreateDXGIFactory1 != NULL)
return fpCreateDXGIFactory1(riid, ppFactory);
return DXGI_ERROR_NOT_FOUND;
}