Monado OpenXR Runtime
comp_render.h File Reference

Independent semaphore implementation. More...

Include dependency graph for comp_render.h:

Go to the source code of this file.

Data Structures

struct  comp_render_view_data
 The input data needed for a single view, it shared between both GFX and CS paths. More...
 
struct  comp_render_dispatch_data
 The input data needed for a complete layer squashing distortion rendering to a target. More...
 

Functions

static void comp_render_gfx_initial_init (struct comp_render_dispatch_data *data, struct render_gfx_target_resources *rtr, bool fast_path, bool do_timewarp)
 
static void comp_render_gfx_add_view (struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, struct render_gfx_target_resources *rtr, const struct render_viewport_data *layer_viewport_data, const struct xrt_normalized_rect *layer_norm_rect, VkImage image, VkImageView srgb_view, const struct xrt_matrix_2x2 *vertex_rot, const struct render_viewport_data *target_viewport_data)
 
void comp_render_gfx_dispatch (struct render_gfx *rr, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
 Helper function that takes a set of layers, new device poses, a scratch images with associated render_gfx_target_resources and writes the needed commands to the render_gfx to do a full composition with distortion. More...
 
static void comp_render_cs_initial_init (struct comp_render_dispatch_data *data, VkImage target_image, VkImageView target_unorm_view, bool fast_path, bool do_timewarp)
 
static void comp_render_cs_add_view (struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, const struct render_viewport_data *layer_viewport_data, const struct xrt_normalized_rect *layer_norm_rect, VkImage image, VkImageView srgb_view, VkImageView unorm_view, const struct render_viewport_data *target_viewport_data)
 
void comp_render_cs_layer (struct render_compute *crc, uint32_t view_index, const struct comp_layer *layers, const uint32_t layer_count, const struct xrt_normalized_rect *pre_transform, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const VkImage target_image, const VkImageView target_image_view, const struct render_viewport_data *target_view, bool do_timewarp)
 Helper to dispatch the layer squasher for a single view. More...
 
void comp_render_cs_layers (struct render_compute *crc, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d, VkImageLayout transition_to)
 Helper function to dispatch the layer squasher, works on any number of views. More...
 
void comp_render_cs_dispatch (struct render_compute *crc, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
 Helper function that takes a set of layers, new device poses, a scratch images and writes the needed commands to the render_compute to do a full composition with distortion. More...
 

Detailed Description

Independent semaphore implementation.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ comp_render_cs_layer()

void comp_render_cs_layer ( struct render_compute crc,
uint32_t  view_index,
const struct comp_layer layers,
const uint32_t  layer_count,
const struct xrt_normalized_rect pre_transform,
const struct xrt_pose world_pose,
const struct xrt_pose eye_pose,
const VkImage  target_image,
const VkImageView  target_image_view,
const struct render_viewport_data target_view,
bool  do_timewarp 
)

Helper to dispatch the layer squasher for a single view.

All source layer images and target image needs to be in the correct image layout, no barrier is inserted at all. The view_index argument is needed to grab a pre-allocated UBO from the render_resources and to correctly select left/right data from various layers.

Expected layouts:

  • Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
  • Target images: VK_IMAGE_LAYOUT_GENERAL

Stop compositing layers if device's sampled image limit is reached. For most hardware this isn't a problem, most have well over 32 max samplers. But notably the RPi4 only have 16 which is a limit we may run into. But if you got 16+ layers on a RPi4 you have more problems then max samplers.

Exit loop if shader cannot receive more image samplers

Todo:
: If Vulkan 1.2, use VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT and skip this

References render_resources::clamp_to_border_black, render_resources::clamp_to_edge, xrt_matrix_4x4::math_matrix_4x4_view_from_pose(), render_compute::r, RENDER_MAX_IMAGES_SIZE, and render_resources::ubos.