From 1667b416c746f95b296929031aac74273ff31a24 Mon Sep 17 00:00:00 2001 From: Rylie Pavlik Date: Fri, 6 Dec 2024 18:31:23 -0600 Subject: [PATCH] c/util: Export the gfx layer squasher. Part-of: --- doc/changes/compositor/mr.2380.md | 1 + src/xrt/compositor/util/comp_render.h | 33 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/changes/compositor/mr.2380.md diff --git a/doc/changes/compositor/mr.2380.md b/doc/changes/compositor/mr.2380.md new file mode 100644 index 000000000..fc0f8d5d3 --- /dev/null +++ b/doc/changes/compositor/mr.2380.md @@ -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. diff --git a/src/xrt/compositor/util/comp_render.h b/src/xrt/compositor/util/comp_render.h index a19b2f08b..579b91413 100644 --- a/src/xrt/compositor/util/comp_render.h +++ b/src/xrt/compositor/util/comp_render.h @@ -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. *