forked from KhronosGroup/Vulkan-Loader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdxgi_loader.c
More file actions
23 lines (16 loc) · 683 Bytes
/
dxgi_loader.c
File metadata and controls
23 lines (16 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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;
}