Monado OpenXR Runtime
comp_render_gfx.c File Reference

Compositor (gfx - graphics shader) rendering code. More...

Include dependency graph for comp_render_gfx.c:

Data Structures

struct  gfx_layer_view_state
 Internal per-view for the layer squashing render step. More...
 
struct  gfx_layer_state
 Internal state for the layer squashing render step, contains all per-view state. More...
 
struct  gfx_mesh_state
 
struct  gfx_mesh_view_data
 
struct  gfx_mesh_data
 

Functions

static void gfx_mesh_add_view (struct gfx_mesh_data *md, uint32_t view_index, const struct xrt_pose *src_pose, const struct xrt_fov *src_fov, const struct xrt_normalized_rect *src_norm_rect, VkSampler src_sampler, VkImageView src_image_view)
 
static void calc_mvp_full (struct gfx_layer_view_state *state, const struct xrt_layer_data *layer_data, const struct xrt_pose *pose, const struct xrt_vec3 *scale, struct xrt_matrix_4x4 *result)
 
static void calc_mv_inv_full (struct gfx_layer_view_state *state, const struct xrt_layer_data *layer_data, const struct xrt_pose *pose, const struct xrt_vec3 *scale, struct xrt_matrix_4x4 *result)
 
static void calc_mvp_rot_only (struct gfx_layer_view_state *state, const struct xrt_layer_data *data, const struct xrt_pose *pose, const struct xrt_vec3 *scale, struct xrt_matrix_4x4 *result)
 
static const struct comp_swapchain_imageget_layer_image (const struct comp_layer *layer, uint32_t swapchain_index, uint32_t image_index)
 
static void add_layer (struct gfx_layer_view_state *state, const struct xrt_layer_data *data, VkDescriptorSet descriptor_set)
 
static VkResult do_cylinder_layer (struct render_gfx *render, const struct comp_layer *layer, uint32_t view_index, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, struct gfx_layer_view_state *state)
 Data setup for a cylinder layer Also allocates and writes a descriptor set! More...
 
static VkResult do_equirect2_layer (struct render_gfx *render, const struct comp_layer *layer, uint32_t view_index, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, struct gfx_layer_view_state *state)
 Data setup for an "equirect2" layer Also allocates and writes a descriptor set! More...
 
static VkResult do_projection_layer (struct render_gfx *render, const struct comp_layer *layer, uint32_t view_index, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, struct gfx_layer_view_state *state)
 Data setup for a projection layer Also allocates and writes a descriptor set! More...
 
static VkResult do_quad_layer (struct render_gfx *render, const struct comp_layer *layer, uint32_t view_index, VkSampler clamp_to_edge, VkSampler clamp_to_border_black, struct gfx_layer_view_state *state)
 Data setup for a quad layer Also allocates and writes a descriptor set! More...
 
static void crg_clear_output (struct render_gfx *render, const struct comp_render_dispatch_data *d)
 
static void crg_distortion_common (struct render_gfx *render, bool do_timewarp, const struct gfx_mesh_data *md, const struct comp_render_dispatch_data *d)
 Used in both fast-path and layer-squashed routes. More...
 
static void crg_distortion_after_squash (struct render_gfx *render, const struct comp_render_dispatch_data *d)
 For use after squashing layers. More...
 
static void crg_distortion_fast_path (struct render_gfx *render, const struct comp_render_dispatch_data *d, const struct comp_layer *layer, const struct xrt_layer_projection_view_data *vds[XRT_MAX_VIEWS])
 Fast path. 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...
 

Variables

static const VkClearColorValue background_color_idle
 
static const VkClearColorValue background_color_active
 

Detailed Description

Compositor (gfx - graphics shader) rendering code.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m
Rylie Pavlik rylie.nosp@m..pav.nosp@m.lik@c.nosp@m.olla.nosp@m.bora..nosp@m.com

Function Documentation

◆ crg_distortion_after_squash()

◆ crg_distortion_common()

static void crg_distortion_common ( struct render_gfx render,
bool  do_timewarp,
const struct gfx_mesh_data md,
const struct comp_render_dispatch_data d 
)
static

Used in both fast-path and layer-squashed routes.

References render_gfx::r, comp_render_dispatch_data::view_count, render_resources::vk, and XRT_STRUCT_INIT.

◆ crg_distortion_fast_path()

static void crg_distortion_fast_path ( struct render_gfx render,
const struct comp_render_dispatch_data d,
const struct comp_layer layer,
const struct xrt_layer_projection_view_data vds[XRT_MAX_VIEWS] 
)
static

Fast path.

◆ do_cylinder_layer()

static VkResult do_cylinder_layer ( struct render_gfx render,
const struct comp_layer layer,
uint32_t  view_index,
VkSampler  clamp_to_edge,
VkSampler  clamp_to_border_black,
struct gfx_layer_view_state state 
)
static

Data setup for a cylinder layer Also allocates and writes a descriptor set!

References xrt_sub_image::array_index, and comp_layer::data.

◆ do_equirect2_layer()

static VkResult do_equirect2_layer ( struct render_gfx render,
const struct comp_layer layer,
uint32_t  view_index,
VkSampler  clamp_to_edge,
VkSampler  clamp_to_border_black,
struct gfx_layer_view_state state 
)
static

Data setup for an "equirect2" layer Also allocates and writes a descriptor set!

References xrt_sub_image::array_index, and comp_layer::data.

◆ do_projection_layer()

static VkResult do_projection_layer ( struct render_gfx render,
const struct comp_layer layer,
uint32_t  view_index,
VkSampler  clamp_to_edge,
VkSampler  clamp_to_border_black,
struct gfx_layer_view_state state 
)
static

Data setup for a projection layer Also allocates and writes a descriptor set!

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

◆ do_quad_layer()

static VkResult do_quad_layer ( struct render_gfx render,
const struct comp_layer layer,
uint32_t  view_index,
VkSampler  clamp_to_edge,
VkSampler  clamp_to_border_black,
struct gfx_layer_view_state state 
)
static

Data setup for a quad layer Also allocates and writes a descriptor set!

References xrt_sub_image::array_index, and comp_layer::data.

Variable Documentation

◆ background_color_active

const VkClearColorValue background_color_active
static
Initial value:
= {
.float32 = {0.0f, 0.0f, 0.0f, 1.0f},
}

◆ background_color_idle

const VkClearColorValue background_color_idle
static
Initial value:
= {
.float32 = {0.1f, 0.1f, 0.1f, 1.0f},
}