The open source OpenXR runtime

c/main: Allow configurable final_layout in comp renderer render pass

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2490>

authored by

Andrei Aristarkhov and committed by
Jakob Bornecrantz
3ce3f717 adfa1a2b

+13 -6
+6 -6
src/xrt/compositor/main/comp_renderer.c
··· 403 403 if (!use_compute) { 404 404 r->rtr_array = U_TYPED_ARRAY_CALLOC(struct render_gfx_target_resources, r->buffer_count); 405 405 406 - render_gfx_render_pass_init( // 407 - &r->target_render_pass, // rgrp 408 - &r->c->nr, // struct render_resources 409 - r->c->target->format, // 410 - VK_ATTACHMENT_LOAD_OP_CLEAR, // load_op 411 - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR); // final_layout 406 + render_gfx_render_pass_init( // 407 + &r->target_render_pass, // rgrp 408 + &r->c->nr, // struct render_resources 409 + r->c->target->format, // 410 + VK_ATTACHMENT_LOAD_OP_CLEAR, // load_op 411 + r->c->target->final_layout); // final_layout 412 412 413 413 for (uint32_t i = 0; i < r->buffer_count; ++i) { 414 414 renderer_build_rendering_target_resources(r, &r->rtr_array[i], i);
+4
src/xrt/compositor/main/comp_target.h
··· 1 1 // Copyright 2020, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 141 142 142 143 //! The format that the renderpass targeting this target should use. 143 144 VkFormat format; 145 + 146 + //! The final layout that the renderpass should leave this target in. 147 + VkImageLayout final_layout; 144 148 145 149 //! Number of images that this target has. 146 150 uint32_t image_count;
+1
src/xrt/compositor/main/comp_target_swapchain.c
··· 803 803 cts->base.width = extent.width; 804 804 cts->base.height = extent.height; 805 805 cts->base.format = cts->surface.format.format; 806 + cts->base.final_layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; 806 807 cts->base.surface_transform = surface_caps.currentTransform; 807 808 808 809 create_image_views(cts);
+2
src/xrt/compositor/main/comp_window_debug_image.c
··· 160 160 if (use_srgb) { 161 161 dit->base.format = VK_FORMAT_R8G8B8A8_SRGB; 162 162 } 163 + dit->base.final_layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; 163 164 } 164 165 165 166 static bool ··· 313 314 dit->base.width = 0; 314 315 dit->base.height = 0; 315 316 dit->base.format = VK_FORMAT_UNDEFINED; 317 + dit->base.final_layout = VK_IMAGE_LAYOUT_UNDEFINED; 316 318 } 317 319 318 320 // Always free non-Vulkan resources.