Monado OpenXR Runtime
comp_render.h File Reference

Compositor render implementation. More...

#include "xrt/xrt_defines.h"
#include "xrt/xrt_vulkan_includes.h"
#include "render/render_interface.h"
#include "util/u_misc.h"
#include <assert.h>
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, 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_add_target (struct comp_render_dispatch_data *data, struct render_gfx_target_resources *target_rtr)
 Initialize structure for use of the GFX renderer. More...
 
static void comp_render_gfx_add_squash_view (struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, struct render_gfx_target_resources *squash_rtr, const struct render_viewport_data *layer_viewport_data)
 Add view to the common data, as required by the GFX renderer. More...
 
static void comp_render_gfx_add_target_view (struct comp_render_dispatch_data *data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct xrt_matrix_2x2 *target_vertex_rot, const struct render_viewport_data *target_viewport_data)
 
void comp_render_gfx_layers (struct render_gfx *render, const struct comp_layer *layers, uint32_t layer_count, const struct comp_render_dispatch_data *d, VkImageLayout transition_to)
 Dispatch the (graphics pipeline) layer squasher, on any number of views. More...
 
void comp_render_gfx_dispatch (struct render_gfx *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
 Writes the needed commands to the render_gfx to do a full composition with distortion. More...
 
static void comp_render_cs_add_target (struct comp_render_dispatch_data *data, VkImage target_image, VkImageView target_storage_view)
 Add the target info, as required by the CS renderer. More...
 
static void comp_render_cs_add_squash_view (struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, VkImageView squash_storage_view, const struct render_viewport_data *squash_viewport_data)
 Add view to the common data, as required by the CS renderer. More...
 
static void comp_render_cs_add_target_view (struct comp_render_dispatch_data *data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct render_viewport_data *target_viewport_data)
 
void comp_render_cs_layer (struct render_compute *render, 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)
 Dispatch the layer squasher for a single view. More...
 
void comp_render_cs_layers (struct render_compute *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d, VkImageLayout transition_to)
 Dispatch the layer squasher, on any number of views. More...
 
void comp_render_cs_dispatch (struct render_compute *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
 Write commands to render to do a full composition with distortion. More...
 
Input data structs
static void comp_render_initial_init (struct comp_render_dispatch_data *data, bool fast_path, bool do_timewarp)
 Initialize structure for use without the target step. More...
 
static struct comp_render_view_datacomp_render_dispatch_add_squash_view (struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, const struct render_viewport_data *squash_viewport_data)
 Shared implementation setting up common view params between GFX and CS. More...
 
static struct comp_render_view_datacomp_render_dispatch_add_target_view (struct comp_render_dispatch_data *data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct render_viewport_data *target_viewport_data)
 

Detailed Description

Function Documentation

◆ comp_render_dispatch_add_squash_view()

static struct comp_render_view_data * comp_render_dispatch_add_squash_view ( struct comp_render_dispatch_data data,
const struct xrt_pose world_pose,
const struct xrt_pose eye_pose,
const struct xrt_fov fov,
VkImage  squash_image,
const struct render_viewport_data squash_viewport_data 
)
inlinestatic

Shared implementation setting up common view params between GFX and CS.

Private implementation method, do not use outside of more-specific add_view calls!

Parameters
dataCommon render dispatch data, will be updated
world_poseNew world pose of this view. Populates comp_render_view_data::world_pose
eye_poseNew eye pose of this view Populates comp_render_view_data::eye_pose
fovAssigned to fov in the view data, and used to compute comp_render_view_data::target_pre_transform Populates comp_render_view_data::fov
squash_imageScratch image for this view Populates comp_render_view_data::squash::image
squash_viewport_dataWhere in the image to render the view Populates comp_render_view_data::squash::viewport_data
squash_as_src_sample_viewThe image view into the scratch image for sampling. Populates comp_render_view_data::squash_as_src::sample_view
squash_as_src_norm_rectHow to transform when sampling from the scratch image. Populates comp_render_view_data::squash_as_src::norm_rect
target_viewport_dataDistortion target viewport data (aka target) Populates comp_render_view_data::target::viewport_data
Returns
Pointer to the comp_render_view_data we have been populating, for additional setup.

◆ comp_render_initial_init()

static void comp_render_initial_init ( struct comp_render_dispatch_data data,
bool  fast_path,
bool  do_timewarp 
)
inlinestatic

Initialize structure for use without the target step.

Parameters
[out]dataCommon render dispatch data. Will be zeroed and initialized.
fast_pathWhether we will use the "fast path" avoiding layer squashing.
do_timewarpWhether timewarp (reprojection) will be performed.

Referenced by chl_frame_state::chl_frame_state_init().