aboutsummaryrefslogtreecommitdiff
path: root/contrib/DirectX-Headers/test
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/DirectX-Headers/test')
-rw-r--r--contrib/DirectX-Headers/test/CMakeLists.txt6
-rw-r--r--contrib/DirectX-Headers/test/meson.build9
-rw-r--r--contrib/DirectX-Headers/test/test.cpp32
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
4project(DirectX-Headers-Test CXX)
5add_executable(DirectX-Headers-Test test.cpp)
6target_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
4cpp = meson.get_compiler('cpp')
5d3d12_lib = cpp.find_library('d3d12')
6dxcore_lib = cpp.find_library('dxcore')
7
8headers_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
13int 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}