Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/RenderGraph/RunnablePasses/RenderPassHolder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,8 @@ namespace crg
VkPipelineColorBlendAttachmentStateArray m_blendAttachs;
uint32_t m_layers{};
uint32_t m_index{};
PipelineState m_srcState;
PipelineState m_dstState;
uint32_t m_count{ 1u };
};
}
2 changes: 1 addition & 1 deletion source/RenderGraph/Attachment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ namespace crg
{
result |= VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
}
else if ( !isTransitionView() )
else
{
result |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
}
Expand Down
7 changes: 7 additions & 0 deletions source/RenderGraph/RunnablePasses/PipelineHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ namespace crg
void PipelineHolder::resetPipeline( VkPipelineShaderStageCreateInfoArray config
, uint32_t index )
{
assert( m_pipelines.size() == 1u || index < m_pipelines.size() );

if ( m_pipelines.size() == 1u )
{
index = 0u;
}

if ( m_pipelines[index] )
{
crgUnregisterObject( m_context, m_pipelines[index] );
Expand Down
16 changes: 14 additions & 2 deletions source/RenderGraph/RunnablePasses/RenderPassHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ namespace crg
} );
return it == attaches.end();
}

static bool operator==( PipelineState const & lhs, PipelineState const & rhs )
{
return lhs.access == rhs.access
&& lhs.pipelineStage == rhs.pipelineStage;
}
}

//*********************************************************************************************
Expand Down Expand Up @@ -147,10 +153,14 @@ namespace crg
, crg::RunnablePass const & runnable
, uint32_t passIndex )
{
using rpHolder::operator==;

auto & renderPass = m_passes[passIndex].renderPass;

if ( renderPass
&& rpHolder::checkAttaches( context, m_passes[passIndex].attaches ) )
&& rpHolder::checkAttaches( context, m_passes[passIndex].attaches )
&& m_srcState == context.getPrevPipelineState()
&& m_dstState == context.getNextPipelineState() )
{
return false;
}
Expand Down Expand Up @@ -275,6 +285,8 @@ namespace crg
, depthReference.layout ? &depthReference : nullptr
, 0u
, nullptr };
m_srcState = previousState;
m_dstState = nextState;
VkSubpassDependencyArray dependencies{
{ VK_SUBPASS_EXTERNAL
, 0u
Expand Down Expand Up @@ -304,7 +316,7 @@ namespace crg
, m_context.allocator
, &data.renderPass );
checkVkResult( res, m_pass.getGroupName() + " - RenderPass creation" );
crgRegisterObject( m_context, m_pass.getGroupName(), data.renderPass );
crgRegisterObject( m_context, m_pass.getGroupName() + std::to_string( m_count++ ), data.renderPass );
}

VkPipelineColorBlendStateCreateInfo RenderPassHolder::createBlendState()
Expand Down
9 changes: 8 additions & 1 deletion source/RenderGraph/RunnablePasses/RenderQuadHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ namespace crg
doPreparePipelineStates( renderSize, renderPass, std::move( blendState ) );
}

doCreatePipeline( index );
if ( m_renderPass && m_renderPass != renderPass )
{
resetRenderPass( renderSize, renderPass, blendState, index );
}
else
{
doCreatePipeline( index );
}
}

void RenderQuadHolder::resetRenderPass( VkExtent2D const & renderSize
Expand Down