Monado OpenXR Runtime
|
Compositor rendering code. More...
#include "xrt/xrt_compositor.h"
#include "os/os_time.h"
#include "math/m_api.h"
#include "math/m_mathinclude.h"
#include "util/u_misc.h"
#include "util/u_trace_marker.h"
#include "vk/vk_helpers.h"
#include "render/render_interface.h"
#include "util/comp_render.h"
#include "util/comp_render_helpers.h"
#include "util/comp_base.h"
Functions | |
static void | do_cs_equirect2_layer (const struct xrt_layer_data *data, const struct comp_layer *layer, const struct xrt_matrix_4x4 *eye_view_mat, const struct xrt_matrix_4x4 *world_view_mat, uint32_t view_index, uint32_t cur_layer, uint32_t cur_image, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE], VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE], struct render_compute_layer_ubo_data *ubo_data, uint32_t *out_cur_image) |
static void | do_cs_projection_layer (const struct xrt_layer_data *data, const struct comp_layer *layer, const struct xrt_pose *world_pose, uint32_t view_index, uint32_t cur_layer, uint32_t cur_image, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE], VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE], struct render_compute_layer_ubo_data *ubo_data, bool do_timewarp, uint32_t *out_cur_image) |
static void | do_cs_quad_layer (const struct xrt_layer_data *data, const struct comp_layer *layer, const struct xrt_matrix_4x4 *eye_view_mat, const struct xrt_matrix_4x4 *world_view_mat, uint32_t view_index, uint32_t cur_layer, uint32_t cur_image, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE], VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE], struct render_compute_layer_ubo_data *ubo_data, uint32_t *out_cur_image) |
static void | do_cs_cylinder_layer (const struct xrt_layer_data *data, const struct comp_layer *layer, const struct xrt_matrix_4x4 *eye_view_mat, const struct xrt_matrix_4x4 *world_view_mat, uint32_t view_index, uint32_t cur_layer, uint32_t cur_image, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE], VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE], struct render_compute_layer_ubo_data *ubo_data, uint32_t *out_cur_image) |
static void | do_cs_clear (struct render_compute *crc, const struct comp_render_dispatch_data *d) |
static void | do_cs_distortion_from_scratch (struct render_compute *crc, const struct comp_render_dispatch_data *d) |
static void | do_cs_distortion_for_layer (struct render_compute *crc, const struct comp_layer *layer, const struct xrt_layer_projection_view_data *vds[XRT_MAX_VIEWS], const struct comp_render_dispatch_data *d) |
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... | |
Compositor rendering code.
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:
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
References render_resources::clamp_to_border_black, render_resources::clamp_to_edge, xrt_matrix_4x4::math_matrix_4x4_view_from_pose(), render_compute::r, and RENDER_MAX_IMAGES_SIZE.