Monado OpenXR Runtime
render_gfx.c File Reference

The NEW compositor rendering code header. More...

#include "vk/vk_mini_helpers.h"
#include "render/render_interface.h"
#include <stdio.h>
Include dependency graph for render_gfx.c:

Data Structures

struct  mesh_params
 

Macros

#define ENTRY(ID, FIELD)
 

Functions

static struct vk_bundlevk_from_rtr (struct render_gfx_target_resources *rtr)
 Get the vk_bundle from render_gfx_target_resources. More...
 
static struct vk_bundlevk_from_rr (struct render_gfx *rr)
 
static XRT_CHECK_RESULT VkResult create_implicit_render_pass (struct vk_bundle *vk, VkFormat format, VkAttachmentLoadOp load_op, VkImageLayout final_layout, VkRenderPass *out_render_pass)
 
static XRT_CHECK_RESULT VkResult create_framebuffer (struct vk_bundle *vk, VkImageView image_view, VkRenderPass render_pass, uint32_t width, uint32_t height, VkFramebuffer *out_external_framebuffer)
 
static void begin_render_pass (struct vk_bundle *vk, VkCommandBuffer command_buffer, VkRenderPass render_pass, VkFramebuffer framebuffer, uint32_t width, uint32_t height, const VkClearColorValue *color)
 
static void update_ubo_and_src_descriptor_set (struct vk_bundle *vk, uint32_t ubo_binding, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, uint32_t src_binding, VkSampler sampler, VkImageView image_view, VkDescriptorSet descriptor_set)
 Update descriptor set for a layer to reference the parameter UBO and the source (layer) image. More...
 
static XRT_CHECK_RESULT VkResult do_ubo_and_src_alloc_and_write (struct render_gfx *rr, uint32_t ubo_binding, const void *ubo_ptr, VkDeviceSize ubo_size, uint32_t src_binding, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorPool descriptor_pool, VkDescriptorSetLayout descriptor_set_layout, VkDescriptorSet *out_descriptor_set)
 Sub-allocate a UBO for our layer-specific data, and create a descriptor set for it and the layer image to sample. More...
 
static void dispatch_no_vbo (struct render_gfx *rr, uint32_t vertex_count, VkPipeline pipeline, VkDescriptorSet descriptor_set)
 
static XRT_CHECK_RESULT VkResult create_layer_pipeline (struct vk_bundle *vk, VkRenderPass render_pass, VkPipelineLayout pipeline_layout, VkPipelineCache pipeline_cache, VkBlendFactor src_blend_factor, VkShaderModule module_vert, VkShaderModule module_frag, VkPipeline *out_pipeline)
 
static XRT_CHECK_RESULT VkResult create_mesh_pipeline (struct vk_bundle *vk, VkRenderPass render_pass, VkPipelineLayout pipeline_layout, VkPipelineCache pipeline_cache, uint32_t src_binding, uint32_t mesh_index_count_total, uint32_t mesh_stride, const struct mesh_params *params, VkShaderModule mesh_vert, VkShaderModule mesh_frag, VkPipeline *out_mesh_pipeline)
 
bool render_gfx_render_pass_init (struct render_gfx_render_pass *rgrp, struct render_resources *r, VkFormat format, VkAttachmentLoadOp load_op, VkImageLayout final_layout)
 
void render_gfx_render_pass_close (struct render_gfx_render_pass *rgrp)
 
bool render_gfx_target_resources_init (struct render_gfx_target_resources *rtr, struct render_resources *r, struct render_gfx_render_pass *rgrp, VkImageView target, VkExtent2D extent)
 
void render_gfx_target_resources_close (struct render_gfx_target_resources *rtr)
 
bool render_gfx_init (struct render_gfx *rr, struct render_resources *r)
 
bool render_gfx_begin (struct render_gfx *rr)
 
bool render_gfx_end (struct render_gfx *rr)
 
void render_gfx_fini (struct render_gfx *rr)
 
bool render_gfx_begin_target (struct render_gfx *rr, struct render_gfx_target_resources *rtr, const VkClearColorValue *color)
 
void render_gfx_end_target (struct render_gfx *rr)
 
void render_gfx_begin_view (struct render_gfx *rr, uint32_t view, const struct render_viewport_data *viewport_data)
 
void render_gfx_end_view (struct render_gfx *rr)
 
XRT_CHECK_RESULT VkResult render_gfx_mesh_alloc_and_write (struct render_gfx *rr, const struct render_gfx_mesh_ubo_data *data, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorSet *out_descriptor_set)
 
void render_gfx_mesh_draw (struct render_gfx *rr, uint32_t mesh_index, VkDescriptorSet descriptor_set, bool do_timewarp)
 
XRT_CHECK_RESULT VkResult render_gfx_layer_cylinder_alloc_and_write (struct render_gfx *rr, const struct render_gfx_layer_cylinder_data *data, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorSet *out_descriptor_set)
 
XRT_CHECK_RESULT VkResult render_gfx_layer_equirect2_alloc_and_write (struct render_gfx *rr, const struct render_gfx_layer_equirect2_data *data, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorSet *out_descriptor_set)
 
XRT_CHECK_RESULT VkResult render_gfx_layer_projection_alloc_and_write (struct render_gfx *rr, const struct render_gfx_layer_projection_data *data, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorSet *out_descriptor_set)
 
XRT_CHECK_RESULT VkResult render_gfx_layer_quad_alloc_and_write (struct render_gfx *rr, const struct render_gfx_layer_quad_data *data, VkSampler src_sampler, VkImageView src_image_view, VkDescriptorSet *out_descriptor_set)
 
void render_gfx_layer_cylinder (struct render_gfx *rr, bool premultiplied_alpha, VkDescriptorSet descriptor_set)
 
void render_gfx_layer_equirect2 (struct render_gfx *rr, bool premultiplied_alpha, VkDescriptorSet descriptor_set)
 
void render_gfx_layer_projection (struct render_gfx *rr, bool premultiplied_alpha, VkDescriptorSet descriptor_set)
 
void render_gfx_layer_quad (struct render_gfx *rr, bool premultiplied_alpha, VkDescriptorSet descriptor_set)
 

Detailed Description

Macro Definition Documentation

◆ ENTRY

#define ENTRY (   ID,
  FIELD 
)
Value:
{ \
.constantID = ID, \
.offset = offsetof(struct mesh_params, FIELD), \
.size = sizeof(params->FIELD), \
}
Definition: render_gfx.c:514

Function Documentation

◆ do_ubo_and_src_alloc_and_write()

static XRT_CHECK_RESULT VkResult do_ubo_and_src_alloc_and_write ( struct render_gfx rr,
uint32_t  ubo_binding,
const void *  ubo_ptr,
VkDeviceSize  ubo_size,
uint32_t  src_binding,
VkSampler  src_sampler,
VkImageView  src_image_view,
VkDescriptorPool  descriptor_pool,
VkDescriptorSetLayout  descriptor_set_layout,
VkDescriptorSet *  out_descriptor_set 
)
static

Sub-allocate a UBO for our layer-specific data, and create a descriptor set for it and the layer image to sample.

References XRT_STRUCT_INIT.

◆ render_gfx_end_view()

void render_gfx_end_view ( struct render_gfx rr)

Must have a current target.

References render_gfx::rtr.

◆ update_ubo_and_src_descriptor_set()

static void update_ubo_and_src_descriptor_set ( struct vk_bundle vk,
uint32_t  ubo_binding,
VkBuffer  buffer,
VkDeviceSize  offset,
VkDeviceSize  size,
uint32_t  src_binding,
VkSampler  sampler,
VkImageView  image_view,
VkDescriptorSet  descriptor_set 
)
static

Update descriptor set for a layer to reference the parameter UBO and the source (layer) image.

References ARRAY_SIZE.

◆ vk_from_rtr()