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
32 changes: 28 additions & 4 deletions include/RenderGraph/RunnablePass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,43 @@ namespace crg
struct Config
{
/**
*\param[in] config
* The callback to recording the pass.
*\param[in] view
* The action's target viex.
*\param[in] action
* The implicit action.
*/
auto & implicitAction( ImageViewId view
, RecordContext::ImplicitAction action )
{
actions.emplace( view, action );
implicitActions.emplace( view, action );
return *this;
}

/**
*\param[in] action
* The action to run before the pass recording.
*/
auto & prePassAction( RecordContext::ImplicitAction action )
{
prePassActions.emplace_back( action );
return *this;
}

/**
*\param[in] action
* The action to run after the pass recording.
*/
auto & postPassAction( RecordContext::ImplicitAction action )
{
postPassActions.emplace_back( action );
return *this;
}

uint32_t maxPassCount{ 1u };
bool resettable{ false };
std::map< ImageViewId, RecordContext::ImplicitAction > actions{};
std::vector< RecordContext::ImplicitAction > prePassActions{};
std::vector< RecordContext::ImplicitAction > postPassActions{};
std::map< ImageViewId, RecordContext::ImplicitAction > implicitActions{};
};
}

Expand Down
12 changes: 11 additions & 1 deletion source/RenderGraph/RunnablePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,23 @@ namespace crg
}
}

for ( auto & action : m_ruConfig.prePassActions )
{
action( context, commandBuffer, index );
}

m_callbacks.record( context, commandBuffer, index );

for ( auto & action : m_ruConfig.postPassActions )
{
action( context, commandBuffer, index );
}

m_timer.endPass( commandBuffer );
m_context.vkCmdEndDebugBlock( commandBuffer );
}

for ( auto & action : m_ruConfig.actions )
for ( auto & action : m_ruConfig.implicitActions )
{
context.registerImplicitTransition( *this
, action.first
Expand Down
4 changes: 3 additions & 1 deletion source/RenderGraph/RunnablePasses/RenderMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace crg
, IsEnabledCallback( [this](){ return m_renderMesh.isEnabled(); } ) }
, { ruConfig.maxPassCount
, true /*resettable*/
, ruConfig.actions } }
, ruConfig.prePassActions
, ruConfig.postPassActions
, ruConfig.implicitActions } }
, m_renderMesh{ pass
, context
, graph
Expand Down
4 changes: 3 additions & 1 deletion source/RenderGraph/RunnablePasses/RenderQuad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace crg
, IsEnabledCallback( [this](){ return m_renderQuad.isEnabled(); } ) }
, { ruConfig.maxPassCount
, true /*resettable*/
, ruConfig.actions } }
, ruConfig.prePassActions
, ruConfig.postPassActions
, ruConfig.implicitActions } }
, m_renderQuad{ pass
, context
, graph
Expand Down