Monado OpenXR Runtime
d3d_dxgi_helpers.hpp
Go to the documentation of this file.
1// Copyright 2022, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Misc D3D11/12 helper routines.
6 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
7 * @ingroup aux_d3d
8 */
9
10#pragma once
11
12#include "xrt/xrt_defines.h"
13
14#include "util/u_logging.h"
15
16#include <dxgi.h>
17#include <wil/com.h>
18
19#include <utility>
20
21
22namespace xrt::auxiliary::d3d {
23
24/**
25 * @brief Create a DXGI Adapter, using our priorities.
26 *
27 * We try to use IDXGIFactory6::EnumAdapterByGpuPreference preferring HIGH_PERFORMANCE, if it's available
28 *
29 * @param index The requested adapter index
30 * @param log_level The level to compare against for internal log messages
31 *
32 * @throws wil::ResultException in case of error
33 *
34 * @return wil::com_ptr<IDXGIAdapter>
35 */
36wil::com_ptr<IDXGIAdapter>
37getAdapterByIndex(uint16_t index, u_logging_level log_level = U_LOGGING_INFO);
38
39/**
40 * @brief Create a DXGI Adapter, for the provided LUID.
41 *
42 * @param luid The requested adapter luid
43 * @param log_level The level to compare against for internal log messages
44 * @throws wil::ResultException in case of error
45 *
46 * @return wil::com_ptr<IDXGIAdapter>
47 */
48wil::com_ptr<IDXGIAdapter>
50
51} // namespace xrt::auxiliary::d3d
wil::com_ptr< IDXGIAdapter > getAdapterByLUID(const xrt_luid_t &luid, u_logging_level log_level)
Create a DXGI Adapter, for the provided LUID.
Definition: d3d_dxgi_helpers.cpp:59
wil::com_ptr< IDXGIAdapter > getAdapterByIndex(uint16_t index, u_logging_level log_level)
Create a DXGI Adapter, using our priorities.
Definition: d3d_dxgi_helpers.cpp:33
u_logging_level
Logging level enum.
Definition: u_logging.h:40
@ U_LOGGING_INFO
Info messages: not very verbose, not indicating a problem.
Definition: u_logging.h:43
To transport LUIDs between different APIs.
Definition: xrt_defines.h:60
Basic logging functionality.
Common defines and enums for XRT.