From da6a06a2163f01a574c16376327ac1fe8cd4847c Mon Sep 17 00:00:00 2001 From: Sylvain Doremus Date: Thu, 17 Jul 2025 18:07:13 +0200 Subject: [PATCH] RenderPass: Fixed handling of clear values. --- include/RenderGraph/RunnableGraph.hpp | 9 +++++++-- .../RenderGraph/RunnablePasses/RenderPassHolder.hpp | 4 ++-- .../RenderGraph/RunnablePasses/RenderPassHolder.cpp | 11 +++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/RenderGraph/RunnableGraph.hpp b/include/RenderGraph/RunnableGraph.hpp index e7e3546..1963435 100644 --- a/include/RenderGraph/RunnableGraph.hpp +++ b/include/RenderGraph/RunnableGraph.hpp @@ -130,16 +130,21 @@ namespace crg return m_fence; } - FramePassTimer const & getTimer()const + FramePassTimer const & getTimer()const noexcept { return m_timer; } - FramePassTimer & getTimer() + FramePassTimer & getTimer()noexcept { return m_timer; } + GraphContext & getContext()const noexcept + { + return m_context; + } + private: FrameGraph & m_graph; GraphContext & m_context; diff --git a/include/RenderGraph/RunnablePasses/RenderPassHolder.hpp b/include/RenderGraph/RunnablePasses/RenderPassHolder.hpp index a2028bc..fc977ef 100644 --- a/include/RenderGraph/RunnablePasses/RenderPassHolder.hpp +++ b/include/RenderGraph/RunnablePasses/RenderPassHolder.hpp @@ -57,7 +57,7 @@ namespace crg return m_passes[index].renderArea; } - std::vector< ClearValue > const & getClearValues( uint32_t index )const + std::vector< VkClearValue > const & getClearValues( uint32_t index )const { return m_passes[index].clearValues; } @@ -83,7 +83,7 @@ namespace crg mutable VkFramebuffer frameBuffer{}; Rect2D renderArea{}; std::vector< Attachment const * > attachments; - std::vector< ClearValue > clearValues; + std::vector< VkClearValue > clearValues; std::vector< Entry > attaches; PipelineState previousState; PipelineState nextState; diff --git a/source/RenderGraph/RunnablePasses/RenderPassHolder.cpp b/source/RenderGraph/RunnablePasses/RenderPassHolder.cpp index 28c1b4e..c0871f9 100644 --- a/source/RenderGraph/RunnablePasses/RenderPassHolder.cpp +++ b/source/RenderGraph/RunnablePasses/RenderPassHolder.cpp @@ -22,7 +22,7 @@ namespace crg , ImageViewId view , VkAttachmentDescriptionArray & attaches , std::vector< RenderPassHolder::Entry > & viewAttaches - , std::vector< ClearValue > & clearValues + , std::vector< VkClearValue > & clearValues , LayoutState initialLayout , LayoutState finalLayout , bool separateDepthStencilLayouts ) @@ -41,7 +41,7 @@ namespace crg , convert( initialLayout.layout ) , convert( finalLayout.layout ) } ); viewAttaches.push_back( { view, initialLayout, finalLayout } ); - clearValues.push_back( attach.getClearValue() ); + clearValues.push_back( convert( attach.getClearValue() ) ); if ( view.data->source.empty() ) { @@ -63,7 +63,7 @@ namespace crg , ImageViewId view , VkAttachmentDescriptionArray & attaches , std::vector< RenderPassHolder::Entry > & viewAttaches - , std::vector< ClearValue > & clearValues + , std::vector< VkClearValue > & clearValues , VkPipelineColorBlendAttachmentStateArray & blendAttachs , LayoutState initialLayout , LayoutState finalLayout @@ -190,14 +190,13 @@ namespace crg VkRenderPassBeginInfo RenderPassHolder::getBeginInfo( uint32_t index )const { auto frameBuffer = getFramebuffer( index ); - auto clearValues = convert( getClearValues( index ) ); return VkRenderPassBeginInfo{ VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO , nullptr , getRenderPass( index ) , frameBuffer , convert( getRenderArea( index ) ) - , uint32_t( clearValues.size() ) - , clearValues.data() }; + , uint32_t( getClearValues( index ).size() ) + , getClearValues( index ).data() }; } void RenderPassHolder::begin( RecordContext & context