Monado OpenXR Runtime
d3d_d3d12_allocator.hpp File Reference

Higher-level D3D12-backed image buffer allocation routine. More...

#include "xrt/xrt_compositor.h"
#include <Unknwn.h>
#include <d3d12.h>
#include <wil/com.h>
#include <wil/resource.h>
#include <cstdint>
#include <vector>
Include dependency graph for d3d_d3d12_allocator.hpp:

Go to the source code of this file.

Functions

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...
 

Detailed Description

Function Documentation

◆ 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
deviceA D3D12 device to allocate with.
xsciSwapchain create info: note that the format is assumed to be a DXGI_FORMAT (conversion to typeless is automatic)
image_countThe number of images to create.
keyed_mutexWhether to create images with a shared "keyed mutex" as well
[out]out_imagesA vector that will be cleared and populated with the images.
[out]out_handlesA vector that will be cleared and populated with the corresponding native handles.
[out]out_image_mem_sizeThe 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.