Monado OpenXR Runtime

GFX renderer control and dispatch - uses graphics shaders. More...

Collaboration diagram for Comp_render_gfx:

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)
 Initialize structure for use of the GFX renderer. More...
 
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)
 Add view to the common data, as required by the GFX renderer. More...
 
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...
 

Detailed Description

GFX renderer control and dispatch - uses graphics shaders.

Depends on the common comp_render_dispatch_data, as well as the resources render_gfx_target_resources (often called rtr), and render_gfx.

Function Documentation

◆ comp_render_gfx_add_view()

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 
)
inlinestatic

#include <compositor/util/comp_render.h>

Add view to the common data, as required by the GFX renderer.

Parameters
[in,out]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 - also populates comp_render_view_data::fov
rtrWill be associated with this view. GFX-specific
layer_viewport_dataWhere in the image to render the view Populates comp_render_view_data::layer_viewport_data
layer_norm_rectHow to transform when sampling from the scratch image. Populates comp_render_view_data::layer_norm_rect
imageScratch image for this view Populates comp_render_view_data::image
srgb_viewSRGB image view into the scratch image Populates comp_render_view_data::srgb_view
vertex_rot
target_viewport_dataDistortion target viewport data (aka target) Populates comp_render_view_data::target_viewport_data

◆ comp_render_gfx_dispatch()

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 
)

#include <compositor/util/comp_render.h>

Writes the needed commands to the render_gfx to do a full composition with distortion.

Takes a set of layers, new device poses, scratch images with associated render_gfx_target_resources and writes the needed commands to the render_gfx to do a full composition with distortion. The scratch images are optionally used to squash layers should it not be possible to do a comp_render_dispatch_data::fast_path. Will use the render passes of the targets which set the layout.

The render passes of comp_render_dispatch_data::views::rtr must be created with a final_layout of VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL or there will be validation errors.

Expected layouts:

After call layouts:

  • Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
  • Scratch images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
  • Target image: What the render pass of rtr specifies.
Note
Swapchains in the layers must implement comp_swapchain in addition to just xrt_swapchain, as this function downcasts to comp_swapchain !
Parameters
renderGFX render object
[in]layersLayers to render, see note.
[in]layer_countNumber of elements in layers array.
[in]dCommon render dispatch data

References comp_layer::data, comp_render_dispatch_data::fast_path, and xrt_layer_data::type.

◆ comp_render_gfx_initial_init()

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 
)
inlinestatic

#include <compositor/util/comp_render.h>

Initialize structure for use of the GFX renderer.

Parameters
[out]dataCommon render dispatch data. Will be zeroed and initialized.
rtrGFX-specific resources for the entire frameedg. Must be populated before call.
fast_pathWhether we will use the "fast path" avoiding layer squashing.
do_timewarpWhether timewarp (reprojection) will be performed.

◆ comp_render_gfx_layers()

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 
)

#include <compositor/util/comp_render.h>

Dispatch the (graphics pipeline) layer squasher, on any number of views.

All source layer images needs to be in the correct image layout, no barrier is inserted for them. The target images are barriered from undefined to general so they can be written to, then to the layout defined by transition_to.

Expected layouts:

  • Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
  • Target images: Any

After call layouts:

  • Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
  • Target images: transition_to
Note
Swapchains in the layers must implement comp_swapchain in addition to just xrt_swapchain, as this function downcasts to comp_swapchain !
Parameters
renderGraphics renderer object
[in]layersLayers to render, see note.
[in]layer_countNumber of elements in layers array.
[in]dCommon render dispatch data
[in]transition_toDesired image layout for target images