forked from haasn/libplacebo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d3d11.c
54 lines (44 loc) · 1.38 KB
/
d3d11.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "gpu_tests.h"
#include "d3d11/gpu.h"
#include <dxgi1_2.h>
int main()
{
pl_log log = pl_test_logger();
IDXGIFactory1 *factory = NULL;
IDXGIAdapter1 *adapter1 = NULL;
HRESULT hr;
HMODULE dxgi = LoadLibraryW(L"dxgi.dll");
if (!dxgi)
return SKIP;
PFN_CREATE_DXGI_FACTORY pCreateDXGIFactory1 =
(void *) GetProcAddress(dxgi, "CreateDXGIFactory1");
if (!pCreateDXGIFactory1)
return SKIP;
pCreateDXGIFactory1(&IID_IDXGIFactory1, (void **) &factory);
// Test all attached devices
for (int i = 0;; i++) {
hr = IDXGIFactory1_EnumAdapters1(factory, i, &adapter1);
if (hr == DXGI_ERROR_NOT_FOUND)
break;
if (FAILED(hr)) {
printf("Failed to enumerate adapters\n");
return SKIP;
}
DXGI_ADAPTER_DESC1 desc;
hr = IDXGIAdapter1_GetDesc1(adapter1, &desc);
if (FAILED(hr)) {
printf("Failed to enumerate adapters\n");
return SKIP;
}
SAFE_RELEASE(adapter1);
const struct pl_d3d11 *d3d11;
struct pl_d3d11_params params = pl_d3d11_default_params;
params.debug = true;
params.adapter_luid = desc.AdapterLuid;
d3d11 = pl_d3d11_create(log, ¶ms);
REQUIRE(d3d11);
gpu_shader_tests(d3d11->gpu);
pl_d3d11_destroy(&d3d11);
}
SAFE_RELEASE(factory);
}