c/util: Export the gfx layer squasher.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2380>
This commit is contained in:
Rylie Pavlik 2024-12-06 18:31:23 -06:00
parent 1959448b25
commit 1667b416c7
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1 @@
Add: Expose a `comp_render_gfx_layers` (formerly called `do_layers`) to match the `comp_render_cs_layers` function, which squashes layers.

View file

@ -316,6 +316,39 @@ comp_render_gfx_add_view(struct comp_render_dispatch_data *data,
view->gfx.vertex_rot = *vertex_rot;
}
/*!
* 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 @p 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: @p transition_to
*
* @note Swapchains in the @p layers must implement @ref comp_swapchain in
* addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
*
* @param render Graphics renderer object
* @param[in] layers Layers to render, see note.
* @param[in] layer_count Number of elements in @p layers array.
* @param[in] d Common render dispatch data
* @param[in] transition_to Desired image layout for target images
*/
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);
/*!
* Writes the needed commands to the @ref render_gfx to do a full composition with distortion.
*