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/FrameGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ namespace crg
* Getters.
*/
/**@{*/
CRG_API LayoutState getFinalLayoutState( ImageId image
, VkImageViewType viewType
, VkImageSubresourceRange range )const;
CRG_API LayoutState getFinalLayoutState( ImageViewId view )const;
CRG_API AccessState getFinalAccessState( Buffer const & buffer )const;
CRG_API void addInput( ImageId image
Expand Down
5 changes: 5 additions & 0 deletions include/RenderGraph/RunnablePass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ See LICENSE file in root folder.

namespace crg
{
CRG_API void checkUndefinedInput( std::string const & stepName
, Attachment const & attach
, ImageViewId const & view
, VkImageLayout currentLayout );

template< typename StrongT, typename ValueT >
struct GetValueCallbackT
{
Expand Down
11 changes: 10 additions & 1 deletion source/RenderGraph/FrameGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,18 @@ namespace crg
, context );
}

LayoutState FrameGraph::getFinalLayoutState( ImageId image
, VkImageViewType viewType
, VkImageSubresourceRange range )const
{
return m_finalState.getLayoutState( image, viewType, range );
}

LayoutState FrameGraph::getFinalLayoutState( ImageViewId view )const
{
return m_finalState.getLayoutState( view );
return getFinalLayoutState( view.data->image
, view.data->info.viewType
, view.data->info.subresourceRange );
}

AccessState FrameGraph::getFinalAccessState( Buffer const & buffer )const
Expand Down
16 changes: 16 additions & 0 deletions source/RenderGraph/RunnableGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,22 @@ namespace crg
{
// Lookup in graph's external inputs.
result = m_graph.getInputLayoutState( image, viewType, range );

if ( result.layout != VK_IMAGE_LAYOUT_UNDEFINED )
{
context.setLayoutState( image, viewType, range, result );
}
}

if ( result.layout == VK_IMAGE_LAYOUT_UNDEFINED )
{
// Lookup in graph's previous final state.
result = m_graph.getFinalLayoutState( image, viewType, range );

if ( result.layout != VK_IMAGE_LAYOUT_UNDEFINED )
{
context.setLayoutState( image, viewType, range, result );
}
}

return result;
Expand Down
18 changes: 12 additions & 6 deletions source/RenderGraph/RunnablePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ namespace crg
}
}

void checkUndefinedInput( std::string const & stepName
, Attachment const & attach
, ImageViewId const & view
, VkImageLayout currentLayout )
{
if ( !attach.isTransitionView() && attach.isInput() && currentLayout == VK_IMAGE_LAYOUT_UNDEFINED )
{
Logger::logWarning( stepName + " - [" + attach.pass->getFullName() + "]: Input view [" + view.data->name + "] is currently in undefined layout" );
}
}

void RunnablePass::recordOne( CommandBuffer & enabled
, uint32_t index
, RecordContext & context )
Expand Down Expand Up @@ -400,12 +411,7 @@ namespace crg
{
auto needed = makeLayoutState( attach.getImageLayout( m_context.separateDepthStencilLayouts ) );
auto currentLayout = m_graph.getCurrentLayoutState( context, view );

if ( !( attach.isTransitionView() || !attach.isInput() || currentLayout.layout != VK_IMAGE_LAYOUT_UNDEFINED ) )
{
Logger::logWarning( "Input view [" + view.data->name + "] is currently in undefined layout" );
}

checkUndefinedInput( "Record", attach, view, currentLayout.layout );
context.memoryBarrier( commandBuffer
, view
, currentLayout.layout
Expand Down
6 changes: 1 addition & 5 deletions source/RenderGraph/RunnablePasses/RenderPassHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,7 @@ namespace crg
auto from = ( !attach.isInput()
? crg::makeLayoutState( VK_IMAGE_LAYOUT_UNDEFINED )
: currentLayout );

if ( !( !attach.isInput() || from.layout != VK_IMAGE_LAYOUT_UNDEFINED ) )
{
Logger::logWarning( "Input image in undefined layout" );
}
checkUndefinedInput( "RenderPass", attach, view, from.layout );

if ( attach.isDepthAttach() || attach.isStencilAttach() )
{
Expand Down