14#include "xrt/xrt_config_have.h"
26static inline D3D12_RESOURCE_FLAGS
30 if ((xsub & XRT_SWAPCHAIN_USAGE_COLOR) != 0) {
31 ret |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
33 if ((xsub & XRT_SWAPCHAIN_USAGE_DEPTH_STENCIL) != 0) {
34 ret |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
36 if ((xsub & XRT_SWAPCHAIN_USAGE_UNORDERED_ACCESS) != 0) {
37 ret |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
41 if ((xsub & XRT_SWAPCHAIN_USAGE_SAMPLED) == 0) {
44 assert((xsub & XRT_SWAPCHAIN_USAGE_DEPTH_STENCIL) != 0);
45 ret |= D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
47 return (D3D12_RESOURCE_FLAGS)ret;
56static inline D3D12_RESOURCE_STATES
59 D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATES(0);
61 bool use_color = (xsub & XRT_SWAPCHAIN_USAGE_COLOR) != 0;
62 bool use_unordered = (xsub & XRT_SWAPCHAIN_USAGE_UNORDERED_ACCESS) != 0;
63 bool use_depth = (xsub & XRT_SWAPCHAIN_USAGE_DEPTH_STENCIL) != 0;
64 bool use_transfer_src = (xsub & XRT_SWAPCHAIN_USAGE_TRANSFER_SRC) != 0;
65 bool use_transfer_dst = (xsub & XRT_SWAPCHAIN_USAGE_TRANSFER_DST) != 0;
66 bool use_mutable = (xsub & XRT_SWAPCHAIN_USAGE_MUTABLE_FORMAT) != 0;
67 bool use_input_attachment = (xsub & XRT_SWAPCHAIN_USAGE_INPUT_ATTACHMENT) != 0;
81 state = D3D12_RESOURCE_STATE_RENDER_TARGET;
82 }
else if (use_depth) {
83 state = D3D12_RESOURCE_STATE_DEPTH_WRITE;
89 state = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
90 }
else if (use_transfer_src) {
91 state = D3D12_RESOURCE_STATE_COPY_SOURCE;
92 }
else if (use_transfer_dst) {
93 state = D3D12_RESOURCE_STATE_COPY_DEST;
94 }
else if (use_mutable) {
95 state = D3D12_RESOURCE_STATE_COMMON;
96 }
else if (use_input_attachment) {
97 state = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
100 state = D3D12_RESOURCE_STATE_COMMON;
113static inline D3D12_RESOURCE_STATES
116 D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
118 if ((xsub & XRT_SWAPCHAIN_USAGE_UNORDERED_ACCESS) != 0) {
119 state |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
126 if ((xsub & XRT_SWAPCHAIN_USAGE_DEPTH_STENCIL) != 0) {
127 state |= D3D12_RESOURCE_STATE_DEPTH_READ;
xrt_swapchain_usage_bits
Usage of the swapchain images.
Definition: xrt_compositor.h:506
Header declaring XRT graphics interfaces.
A minimal way to include Windows.h.