From 89c99de598c6a51205e4e6f853c813b3cc5752b3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 6 Oct 2023 22:42:57 +0100 Subject: [PATCH] c/render: Remove unused render_gfx_view and other fields on render_gfx --- src/xrt/compositor/render/render_gfx.c | 30 ++----------------- src/xrt/compositor/render/render_interface.h | 31 ++------------------ 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/src/xrt/compositor/render/render_gfx.c b/src/xrt/compositor/render/render_gfx.c index 726869d53..c4d0113fa 100644 --- a/src/xrt/compositor/render/render_gfx.c +++ b/src/xrt/compositor/render/render_gfx.c @@ -512,29 +512,9 @@ render_gfx_target_resources_close(struct render_gfx_target_resources *rtr) bool render_gfx_init(struct render_gfx *rr, struct render_resources *r) { - struct vk_bundle *vk = r->vk; - VkResult ret; + // Init fields. rr->r = r; - - /* - * Mesh per view - */ - - ret = vk_create_descriptor_set( // - vk, // vk_bundle - r->mesh.descriptor_pool, // descriptor_pool - r->mesh.descriptor_set_layout, // descriptor_set_layout - &rr->views[0].mesh.descriptor_set); // descriptor_set - VK_CHK_WITH_RET(ret, "vk_create_descriptor_set", false); - - ret = vk_create_descriptor_set( // - vk, // vk_bundle - r->mesh.descriptor_pool, // descriptor_pool - r->mesh.descriptor_set_layout, // descriptor_set_layout - &rr->views[1].mesh.descriptor_set); // descriptor_set - VK_CHK_WITH_RET(ret, "vk_create_descriptor_set", false); - // Used to sub-allocate UBOs from, restart from scratch each frame. render_sub_alloc_tracker_init(&rr->ubo_tracker, &r->gfx.shared_ubo); @@ -600,15 +580,13 @@ render_gfx_close(struct render_gfx *rr) struct vk_bundle *vk = vk_from_rr(rr); struct render_resources *r = rr->r; - // Reclaimed by vkResetDescriptorPool. - rr->views[0].mesh.descriptor_set = VK_NULL_HANDLE; - rr->views[1].mesh.descriptor_set = VK_NULL_HANDLE; - + // Reclaim all descriptor sets. vk->vkResetDescriptorPool( // vk->device, // r->mesh.descriptor_pool, // 0); // + // This "reclaims" the allocated UBOs. U_ZERO(rr); } @@ -663,8 +641,6 @@ render_gfx_begin_view(struct render_gfx *rr, uint32_t view, const struct render_ assert(view == 0 || view == 1); assert(rr->rtr != NULL); - rr->current_view = view; - /* * Viewport diff --git a/src/xrt/compositor/render/render_interface.h b/src/xrt/compositor/render/render_interface.h index 3939ec744..5389f6c85 100644 --- a/src/xrt/compositor/render/render_interface.h +++ b/src/xrt/compositor/render/render_interface.h @@ -720,14 +720,9 @@ render_gfx_render_pass_close(struct render_gfx_render_pass *rgrp); /*! * Each rendering (@ref render_gfx) render to one or more targets - * (@ref render_gfx_target_resources), each target can have one or more - * views (@ref render_gfx_view), this struct holds all the vulkan resources - * that is specific to the target. - * - * Technically the framebuffer could be moved out of this struct and all of this - * state be turned into a CSO object that depends only only the format and - * external status of the target, but is combined to reduce the number of - * objects needed to render. + * (@ref render_gfx_target_resources), the target points to one render pass and + * it's pipelines (@ref render_gfx_render_pass). It is up to the code using + * these to do reuse of render passes and ensure they match. */ struct render_gfx_target_resources { @@ -771,20 +766,6 @@ render_gfx_target_resources_close(struct render_gfx_target_resources *rtr); * */ -/*! - * Each rendering (@ref render_gfx) render to one or more targets - * (@ref render_gfx_target_resources), each target can have one or more - * views (@ref render_gfx_view), this struct holds all the vulkan resources - * that is specific to the view. - */ -struct render_gfx_view -{ - struct - { - VkDescriptorSet descriptor_set; - } mesh; -}; - /*! * A rendering is used to create command buffers needed to do one frame of * compositor rendering, it holds onto resources used by the command buffer. @@ -799,12 +780,6 @@ struct render_gfx //! The current target we are rendering too, can change during command building. struct render_gfx_target_resources *rtr; - - //! Holds per view data. - struct render_gfx_view views[2]; - - //! The current view we are rendering to. - uint32_t current_view; }; /*!