Monado OpenXR Runtime
d3d_d3d11_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 <d3d11.h>
18
19#include <wil/com.h>
20
21#include <utility>
22
23
24namespace xrt::auxiliary::d3d::d3d11 {
25
26/**
27 * @brief Create a D3D11 Device object
28 *
29 * @param adapter optional: adapter to create on.
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 std::pair<wil::com_ptr<ID3D11Device>, wil::com_ptr<ID3D11DeviceContext>>
35 */
36std::pair<wil::com_ptr<ID3D11Device>, wil::com_ptr<ID3D11DeviceContext>>
37createDevice(const wil::com_ptr<IDXGIAdapter> &adapter = nullptr, u_logging_level log_level = U_LOGGING_INFO);
38
39} // namespace xrt::auxiliary::d3d::d3d11
std::pair< wil::com_ptr< ID3D11Device >, wil::com_ptr< ID3D11DeviceContext > > createDevice(const wil::com_ptr< IDXGIAdapter > &adapter, u_logging_level log_level)
Create a D3D11 Device object.
Definition: d3d_d3d11_helpers.cpp:36
u_logging_level
Logging level enum.
Definition: u_logging.h:43
@ U_LOGGING_INFO
Info messages: not very verbose, not indicating a problem.
Definition: u_logging.h:46
Basic logging functionality.
Common defines and enums for XRT.