From fba8184491e0b7ae6fab7ac01b4600d230dc4569 Mon Sep 17 00:00:00 2001 From: marsunet Date: Tue, 21 Dec 2021 17:04:22 -0800 Subject: Initial commit with window demo. --- contrib/DirectX-Headers/test/CMakeLists.txt | 6 ++++++ contrib/DirectX-Headers/test/meson.build | 9 ++++++++ contrib/DirectX-Headers/test/test.cpp | 32 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 contrib/DirectX-Headers/test/CMakeLists.txt create mode 100644 contrib/DirectX-Headers/test/meson.build create mode 100644 contrib/DirectX-Headers/test/test.cpp (limited to 'contrib/DirectX-Headers/test') 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 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +project(DirectX-Headers-Test CXX) +add_executable(DirectX-Headers-Test test.cpp) +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 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +cpp = meson.get_compiler('cpp') +d3d12_lib = cpp.find_library('d3d12') +dxcore_lib = cpp.find_library('dxcore') + +headers_test = executable('DirectX-Headers-Test', 'test.cpp', + 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 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include +#include "dxguids/dxguids.h" + +int main() +{ + IDXCoreAdapter *adapter = nullptr; + ID3D12Device *device = nullptr; + + { + IDXCoreAdapterFactory *factory = nullptr; + if (FAILED(DXCoreCreateAdapterFactory(&factory))) + return -1; + + IDXCoreAdapterList *list = nullptr; + if (FAILED(factory->CreateAdapterList(1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, &list))) + return -1; + + if (FAILED(list->GetAdapter(0, &adapter))) + return -1; + } + + return D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device)); +} -- cgit v1.2.3