D3D12 backed image buffer allocator.
More...
#include "d3d_d3d12_allocator.h"
#include "d3d_d3d12_allocator.hpp"
#include "d3d_d3d12_bits.h"
#include "d3d_dxgi_formats.h"
#include "util/u_misc.h"
#include "util/u_logging.h"
#include "util/u_debug.h"
#include "util/u_handles.h"
#include "xrt/xrt_windows.h"
#include <Unknwn.h>
#include <d3d12.h>
#include <wil/com.h>
#include <wil/result.h>
#include <memory>
|
#define | DEFAULT_CATCH(...) |
|
#define | D3DA_TRACE(...) U_LOG_IFL_T(debug_get_log_option_d3d12_log(), __VA_ARGS__) |
|
#define | D3DA_DEBUG(...) U_LOG_IFL_D(debug_get_log_option_d3d12_log(), __VA_ARGS__) |
|
#define | D3DA_INFO(...) U_LOG_IFL_I(debug_get_log_option_d3d12_log(), __VA_ARGS__) |
|
#define | D3DA_WARN(...) U_LOG_IFL_W(debug_get_log_option_d3d12_log(), __VA_ARGS__) |
|
#define | D3DA_ERROR(...) U_LOG_IFL_E(debug_get_log_option_d3d12_log(), __VA_ARGS__) |
|
|
static wil::unique_handle | xrt::auxiliary::d3d::d3d12::createSharedHandle (ID3D12Device &device, const wil::com_ptr< ID3D12Resource > &image) |
|
xrt_result_t | xrt::auxiliary::d3d::d3d12::allocateSharedImages (ID3D12Device &device, const xrt_swapchain_create_info &xsci, size_t image_count, std::vector< wil::com_ptr< ID3D12Resource > > &out_images, std::vector< wil::unique_handle > &out_handles, std::uint64_t &out_image_mem_size) |
| Allocate images (ID3D12Resource) that have a corresponding native handle. More...
|
|
static xrt_result_t | d3d12_images_allocate (struct xrt_image_native_allocator *xina, const struct xrt_swapchain_create_info *xsci, size_t image_count, struct xrt_image_native *out_images) |
|
static xrt_result_t | d3d12_images_free (struct xrt_image_native_allocator *xina, size_t image_count, struct xrt_image_native *images) |
|
static void | d3d12_destroy (struct xrt_image_native_allocator *xina) |
|
struct xrt_image_native_allocator * | d3d12_allocator_create (ID3D11Device *device) |
|
◆ DEFAULT_CATCH
#define DEFAULT_CATCH |
( |
|
... | ) |
|
Value: catch (wil::ResultException const &e) \
{ \
U_LOG_E("Caught exception: %s", e.what()); \
return __VA_ARGS__; \
} \
catch (std::exception const &e) \
{ \
U_LOG_E("Caught exception: %s", e.what()); \
return __VA_ARGS__; \
} \
catch (...) \
{ \
U_LOG_E("Caught exception"); \
return __VA_ARGS__; \
}
◆ allocateSharedImages()
xrt_result_t xrt::auxiliary::d3d::d3d12::allocateSharedImages |
( |
ID3D12Device & |
device, |
|
|
const xrt_swapchain_create_info & |
xsci, |
|
|
size_t |
image_count, |
|
|
std::vector< wil::com_ptr< ID3D12Resource > > & |
out_images, |
|
|
std::vector< wil::unique_handle > & |
out_handles, |
|
|
std::uint64_t & |
out_image_mem_size |
|
) |
| |
Allocate images (ID3D12Resource) that have a corresponding native handle.
- Parameters
-
| device | A D3D12 device to allocate with. |
| xsci | Swapchain create info: note that the format is assumed to be a DXGI_FORMAT (conversion to typeless is automatic) |
| image_count | The number of images to create. |
| keyed_mutex | Whether to create images with a shared "keyed mutex" as well |
[out] | out_images | A vector that will be cleared and populated with the images. |
[out] | out_handles | A vector that will be cleared and populated with the corresponding native handles. |
[out] | out_image_mem_size | The image memory allocation size in bytes |
- Returns
- xrt_result_t, one of:
References XRT_ERROR_SWAPCHAIN_FLAG_VALID_BUT_UNSUPPORTED, XRT_SWAPCHAIN_CREATE_PROTECTED_CONTENT, and XRT_SWAPCHAIN_CREATE_STATIC_IMAGE.