40 } views[XRT_MAX_VIEWS];
86 const VkFormat format);
112static inline VkImageView
123static inline VkImageView
171 for (uint32_t i = 0; i < scratch->
view_count; i++) {
186 for (uint32_t i = 0; i < scratch->
view_count; i++) {
187 if (scratch_state->views[i].used) {
Helper implementation for native compositors.
#define COMP_SCRATCH_NUM_IMAGES
The number of images for each view, works like a swapchain.
Definition: comp_scratch.h:33
#define U_ZERO(PTR)
Zeroes the correct amount of memory based on the type pointed-to by the argument.
Definition: u_misc.h:68
static VkImageView comp_scratch_single_images_get_sample_view(struct comp_scratch_single_images *cssi, uint32_t index)
Get the image view for sampling, it will apply any automatic linearization, aka sRGB gamma curve corr...
Definition: comp_scratch.h:173
void comp_scratch_single_images_done(struct comp_scratch_single_images *cssi)
After calling get and rendering to the image you call this function to signal that you are done with ...
Definition: comp_scratch.c:390
void comp_scratch_single_images_get(struct comp_scratch_single_images *cssi, uint32_t *out_index)
Get the next free image, after this function has been called you must call either done or discard bef...
Definition: comp_scratch.c:384
static VkImageView comp_scratch_single_images_get_storage_view(struct comp_scratch_single_images *cssi, uint32_t index)
Get the image view for storage or direct value, no linearization will be done.
Definition: comp_scratch.h:195
static VkImage comp_scratch_single_images_get_image(struct comp_scratch_single_images *cssi, uint32_t index)
Get the image for the given index.
Definition: comp_scratch.h:159
void comp_scratch_single_images_discard(struct comp_scratch_single_images *cssi)
Discard a get call, this clears the image debug part causing no image to be shown in the debug UI.
Definition: comp_scratch.c:408
The NEW compositor rendering code header.
Per view frame state tracking which index was gotten and if it was used.
Definition: comp_high_level_scratch.h:142
Used to track the index of images gotten for the images, and if it has been used.
Definition: comp_high_level_scratch.h:155
static void chl_scratch_state_init_and_get(struct chl_scratch_state *scratch_state, struct chl_scratch *scratch)
Zeros out the struct and calls get on all the images, setting the index field on the state for each v...
Definition: comp_high_level_scratch.h:166
static void chl_scratch_state_discard_or_done(struct chl_scratch_state *scratch_state, struct chl_scratch *scratch)
Calls discard or done on all the scratch images, it calls done if the used field is set to true.
Definition: comp_high_level_scratch.h:183
Scratch images that can be used for staging buffers.
Definition: comp_high_level_scratch.h:29
VkFormat format
Format requested.
Definition: comp_high_level_scratch.h:52
struct render_gfx_render_pass render_pass
Shared render passed for the views.
Definition: comp_high_level_scratch.h:31
struct render_gfx_target_resources targets[(4)]
Targets for rendering to the scratch buffer.
Definition: comp_high_level_scratch.h:39
void chl_scratch_init(struct chl_scratch *scratch)
Must becalled before used and before the scratch images are registered with the u_var system.
Definition: comp_high_level_scratch.c:19
static VkImage chl_scratch_get_image(struct chl_scratch *scratch, uint32_t view_index, uint32_t image_index)
Get the image, see comp_scratch_single_images_get_image.
Definition: comp_high_level_scratch.h:102
static VkImageView chl_scratch_get_storage_view(struct chl_scratch *scratch, uint32_t view_index, uint32_t image_index)
Get the storage view, see comp_scratch_single_images_get_storage_view.
Definition: comp_high_level_scratch.h:124
void chl_scratch_fini(struct chl_scratch *scratch)
Resources must be manually called before calling this functions, and the scratch images unregistered ...
Definition: comp_high_level_scratch.c:27
void chl_scratch_free_resources(struct chl_scratch *scratch, struct render_resources *rr)
Free all Vulkan resources that this scratch has created.
Definition: comp_high_level_scratch.c:121
uint32_t view_count
Number of views that has been ensured and have Vulkan resources, all comp_scratch_single_images are a...
Definition: comp_high_level_scratch.h:46
struct comp_scratch_single_images cssi
Per-view scratch images.
Definition: comp_high_level_scratch.h:36
bool render_pass_initialized
Has the render pass been initialized.
Definition: comp_high_level_scratch.h:55
static VkImageView chl_scratch_get_sample_view(struct chl_scratch *scratch, uint32_t view_index, uint32_t image_index)
Get the sample view, see comp_scratch_single_images_get_sample_view.
Definition: comp_high_level_scratch.h:113
VkExtent2D extent
The extent used to create the images.
Definition: comp_high_level_scratch.h:49
bool chl_scratch_ensure(struct chl_scratch *scratch, struct render_resources *rr, uint32_t view_count, VkExtent2D extent, const VkFormat format)
Ensure the scratch images and the render target resources are created.
Definition: comp_high_level_scratch.c:35
Holds scratch images for a single view, designed to work with render code.
Definition: comp_scratch.h:69
A render pass, while not depending on a VkFramebuffer, does depend on the format of the target image(...
Definition: render_interface.h:706
Each rendering (render_gfx) render to one or more targets (render_gfx_target_resources),...
Definition: render_interface.h:785
Holds all pools and static resources for rendering.
Definition: render_interface.h:352