26static inline VkImageView
29 if (
flags & XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT) {
30 return image->
views.alpha[array_index];
33 return image->
views.no_alpha[array_index];
44is_view_index_right(uint32_t view_index)
46 return view_index % 2 == 1;
50view_index_to_projection_data(uint32_t view_index,
55 *out_vd = &proj->v[view_index];
59view_index_to_depth_data(uint32_t view_index,
65 *out_vd = &depth->v[view_index];
66 *out_dvd = &depth->d[view_index];
77is_layer_view_visible(
const struct xrt_layer_data *data, uint32_t view_index)
81 case XRT_LAYER_CUBE: visibility = data->cube.visibility;
break;
82 case XRT_LAYER_CYLINDER: visibility = data->cylinder.visibility;
break;
83 case XRT_LAYER_EQUIRECT1: visibility = data->equirect1.visibility;
break;
84 case XRT_LAYER_EQUIRECT2: visibility = data->equirect2.visibility;
break;
85 case XRT_LAYER_QUAD: visibility = data->quad.visibility;
break;
86 case XRT_LAYER_PROJECTION:
87 case XRT_LAYER_PROJECTION_DEPTH:
return true;
88 default:
return false;
92 case XRT_LAYER_EYE_VISIBILITY_LEFT_BIT:
return !is_view_index_right(view_index);
93 case XRT_LAYER_EYE_VISIBILITY_RIGHT_BIT:
return is_view_index_right(view_index);
94 case XRT_LAYER_EYE_VISIBILITY_BOTH:
return true;
95 case XRT_LAYER_EYE_VISIBILITY_NONE:
96 default:
return false;
109 return (data->flags & XRT_LAYER_COMPOSITION_UNPREMULTIPLIED_ALPHA_BIT) != 0;
120 if (data->flip_y ^ invert_flip) {
127 *out_norm_rect = rect;
138cmd_barrier_view_images(
struct vk_bundle *vk,
141 VkAccessFlags src_access_mask,
142 VkAccessFlags dst_access_mask,
143 VkImageLayout transition_from,
144 VkImageLayout transition_to,
145 VkPipelineStageFlags src_stage_mask,
146 VkPipelineStageFlags dst_stage_mask)
148 VkImageSubresourceRange first_color_level_subresource_range = {
149 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
156 for (uint32_t i = 0; i < d->
view_count; i++) {
157 bool already_barriered =
false;
159 VkImage image = d->views[i].
image;
165 if (d->views[k].
image == image) {
166 already_barriered =
true;
171 if (already_barriered) {
185 first_color_level_subresource_range);
Helper implementation for native compositors.
Compositor render implementation.
void vk_cmd_image_barrier_locked(struct vk_bundle *vk, VkCommandBuffer cmd_buffer, VkImage image, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_image_layout, VkImageLayout new_image_layout, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask, VkImageSubresourceRange subresource_range)
Inserts a image barrier command, doesn't take any locks, the calling code will need hold the lock for...
Definition: vk_helpers.c:1683
xrt_layer_composition_flags
Bit field for holding information about how a layer should be composited.
Definition: xrt_compositor.h:92
xrt_layer_eye_visibility
Which view is the layer visible to?
Definition: xrt_compositor.h:159
@ XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT
The layer is locked to the device and the pose should only be adjusted for the IPD.
Definition: xrt_compositor.h:100
The NEW compositor rendering code header.
The input data needed for a complete layer squashing distortion rendering to a target.
Definition: comp_render.h:138
uint32_t view_count
The number of views currently in this dispatch data.
Definition: comp_render.h:142
VkImage image
The layer image for this view (aka scratch image), used for barrier operations.
Definition: comp_render.h:89
A single swapchain image, holds the needed state for tracking image usage.
Definition: comp_swapchain.h:58
struct comp_swapchain_image::@113 views
Views used by the renderer and distortion code, for each array layer.
Definition: m_space.cpp:87
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition: vk_helpers.h:50
All the pure data values associated with a composition layer.
Definition: xrt_compositor.h:394
All the pure data values associated with a depth information attached to a layer.
Definition: xrt_compositor.h:244
All the pure data values associated with a projection layer.
Definition: xrt_compositor.h:232
All the pure data values associated with a projection layer with depth swapchain attached.
Definition: xrt_compositor.h:267
All of the pure data values associated with a single view in a projection layer.
Definition: xrt_compositor.h:218
Normalized image rectangle, coordinates and size in 0 .
Definition: xrt_defines.h:453
Header declaring XRT graphics interfaces.