diff options
author | marsunet <marc.sunet@amd.com> | 2021-12-21 17:04:22 -0800 |
---|---|---|
committer | marsunet <marc.sunet@amd.com> | 2021-12-21 17:04:22 -0800 |
commit | fba8184491e0b7ae6fab7ac01b4600d230dc4569 (patch) | |
tree | c13194764867a4ad8f46702356b22dccc1e56dd3 /contrib/DirectX-Headers/test | |
parent | 8b1583b65d77188ef35a89e75f145f29c3e3b5d7 (diff) |
Diffstat (limited to 'contrib/DirectX-Headers/test')
-rw-r--r-- | contrib/DirectX-Headers/test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | contrib/DirectX-Headers/test/meson.build | 9 | ||||
-rw-r--r-- | contrib/DirectX-Headers/test/test.cpp | 32 |
3 files changed, 47 insertions, 0 deletions
diff --git a/contrib/DirectX-Headers/test/CMakeLists.txt b/contrib/DirectX-Headers/test/CMakeLists.txt new file mode 100644 index 0000000..cba8b59 --- /dev/null +++ b/contrib/DirectX-Headers/test/CMakeLists.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | # Copyright (c) Microsoft Corporation. | ||
2 | # Licensed under the MIT License. | ||
3 | |||
4 | project(DirectX-Headers-Test CXX) | ||
5 | add_executable(DirectX-Headers-Test test.cpp) | ||
6 | target_link_libraries(DirectX-Headers-Test DirectX-Headers DirectX-Guids d3d12 dxcore) \ No newline at end of file | ||
diff --git a/contrib/DirectX-Headers/test/meson.build b/contrib/DirectX-Headers/test/meson.build new file mode 100644 index 0000000..0e43a91 --- /dev/null +++ b/contrib/DirectX-Headers/test/meson.build | |||
@@ -0,0 +1,9 @@ | |||
1 | # Copyright (c) Microsoft Corporation. | ||
2 | # Licensed under the MIT License. | ||
3 | |||
4 | cpp = meson.get_compiler('cpp') | ||
5 | d3d12_lib = cpp.find_library('d3d12') | ||
6 | dxcore_lib = cpp.find_library('dxcore') | ||
7 | |||
8 | headers_test = executable('DirectX-Headers-Test', 'test.cpp', | ||
9 | dependencies : [dep_dxheaders, d3d12_lib, dxcore_lib]) \ No newline at end of file | ||
diff --git a/contrib/DirectX-Headers/test/test.cpp b/contrib/DirectX-Headers/test/test.cpp new file mode 100644 index 0000000..8f34d73 --- /dev/null +++ b/contrib/DirectX-Headers/test/test.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | // Copyright (c) Microsoft Corporation. | ||
2 | // Licensed under the MIT License. | ||
3 | |||
4 | #ifndef _WIN32 | ||
5 | #include <wsl/winadapter.h> | ||
6 | #endif | ||
7 | |||
8 | #include <directx/d3d12.h> | ||
9 | #include <directx/dxcore.h> | ||
10 | #include <directx/d3dx12.h> | ||
11 | #include "dxguids/dxguids.h" | ||
12 | |||
13 | int main() | ||
14 | { | ||
15 | IDXCoreAdapter *adapter = nullptr; | ||
16 | ID3D12Device *device = nullptr; | ||
17 | |||
18 | { | ||
19 | IDXCoreAdapterFactory *factory = nullptr; | ||
20 | if (FAILED(DXCoreCreateAdapterFactory(&factory))) | ||
21 | return -1; | ||
22 | |||
23 | IDXCoreAdapterList *list = nullptr; | ||
24 | if (FAILED(factory->CreateAdapterList(1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, &list))) | ||
25 | return -1; | ||
26 | |||
27 | if (FAILED(list->GetAdapter(0, &adapter))) | ||
28 | return -1; | ||
29 | } | ||
30 | |||
31 | return D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device)); | ||
32 | } | ||