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
10 changes: 5 additions & 5 deletions include/RenderGraph/FrameGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,27 @@ namespace crg
, VkImageSubresourceRange range )const;
CRG_API LayoutState getOutputLayoutState( ImageViewId view )const;

ResourceHandler & getHandler()
ResourceHandler & getHandler()noexcept
{
return m_handler;
}

std::string const & getName()const
std::string const & getName()const noexcept
{
return m_name;
}

FrameGraphArray const & getDependencies()const
FrameGraphArray const & getDependencies()const noexcept
{
return m_depends;
}

RecordContext const & getFinalStates()const
RecordContext const & getFinalStates()const noexcept
{
return m_finalState;
}

FramePassGroup & getDefaultGroup()const
FramePassGroup & getDefaultGroup()const noexcept
{
return *m_defaultGroup;
}
Expand Down
27 changes: 27 additions & 0 deletions include/RenderGraph/GraphContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,32 @@ namespace crg
std::array< float, 4 > colour;
};

struct DeletionQueue
{
using CDtorFunc = void( GraphContext & );
using DtorFunc = std::function< CDtorFunc >;
using DtorFuncArray = std::vector< DtorFunc >;

public:
void push( DtorFunc func )
{
m_toDelete.push_back( func );
}

void clear( GraphContext & context )
{
DtorFuncArray tmp{ std::move( m_toDelete ) };

for ( auto func : tmp )
{
func( context );
}
}

private:
DtorFuncArray m_toDelete;
};

struct GraphContext
{
CRG_API GraphContext( GraphContext const & ) = delete;
Expand All @@ -468,6 +494,7 @@ namespace crg
VkPhysicalDeviceProperties properties{};
VkPhysicalDeviceFeatures features{};
bool separateDepthStencilLayouts;
DeletionQueue delQueue;

#define DECL_vkFunction( name )\
PFN_vk##name vk##name{ nullptr }
Expand Down
39 changes: 32 additions & 7 deletions include/RenderGraph/RunnableGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace crg
, GraphNodePtrArray nodes
, RootNode rootNode
, GraphContext & context );
CRG_API ~RunnableGraph()noexcept;

CRG_API void record();

Expand Down Expand Up @@ -85,41 +86,61 @@ namespace crg
, ImageViewId view )const;
CRG_API LayoutState getOutputLayoutState( ImageViewId view )const;

ConstGraphAdjacentNode getGraph()const
ConstGraphAdjacentNode getGraph()const noexcept
{
return &m_rootNode;
}

std::string const & getName()const
std::string const & getName()const noexcept
{
return m_graph.getName();
}

AttachmentTransitions const & getTransitions()const
AttachmentTransitions const & getTransitions()const noexcept
{
return m_transitions;
}

VkCommandPool getCommandPool()const
VkCommandPool getCommandPool()const noexcept
{
return m_commandPool.object;
}

VkQueryPool getTimerQueryPool()const
VkQueryPool getTimerQueryPool()const noexcept
{
return m_timerQueries.object;
}

uint32_t & getTimerQueryOffset()
uint32_t & getTimerQueryOffset()noexcept
{
return m_timerQueryOffset;
}

ContextResourcesCache & getResources()
ContextResourcesCache & getResources()noexcept
{
return m_resources;
}

Fence & getFence()noexcept
{
return m_fence;
}

Fence const & getFence()const noexcept
{
return m_fence;
}

FramePassTimer const & getTimer()const
{
return m_timer;
}

FramePassTimer & getTimer()
{
return m_timer;
}

private:
FrameGraph & m_graph;
GraphContext & m_context;
Expand All @@ -134,5 +155,9 @@ namespace crg
ContextObjectT< VkCommandPool > m_commandPool;
std::vector< RunnablePassPtr > m_passes;
RecordContext::GraphIndexMap m_states;
VkCommandBuffer m_commandBuffer{};
VkSemaphore m_semaphore{};
Fence m_fence;
FramePassTimer m_timer;
};
}
23 changes: 17 additions & 6 deletions include/RenderGraph/RunnablePass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,37 @@ namespace crg
CRG_API virtual ~RunnablePass();
/**
*\brief
* Initialises the descriptor set.
* Initialises the pass GPU data for given index.
*\param[in] passIndex
* The index of the pass to initialise.
*/
CRG_API void initialise( uint32_t passIndex );
/**
*\brief
* Records the pass commands into its command buffer.
*\param[in] index
* The pass index.
*\param[in,out] context
* Stores the states.
*/
CRG_API void recordAll( RecordContext & context );
/**
*\brief
* Records the pass commands into its command buffer.
*\param[in] index
* The pass index.
*\param[in,out] context
* Stores the states.
*/
CRG_API uint32_t recordCurrent( RecordContext & context );
/**
*\brief
* Records the pass commands into the given command buffer.
*\param[in,out] context
* Stores the states.
*\param[in] commandBuffer
* Receives the commands.
*/
CRG_API uint32_t recordCurrentInto( RecordContext & context
, VkCommandBuffer commandBuffer );
/**
*\brief
* Re-records the pass commands into its command buffer.
*/
CRG_API uint32_t reRecordCurrent();
Expand Down Expand Up @@ -248,7 +260,6 @@ namespace crg
* Resets the command buffer to initial state.
*/
CRG_API void resetCommandBuffer( uint32_t passIndex );
CRG_API void resetCommandBuffers();
CRG_API void setToReset( uint32_t passIndex );

LayoutState getLayoutState( crg::ImageViewId view )const
Expand Down
4 changes: 2 additions & 2 deletions include/RenderGraph/RunnablePasses/RenderPassHolder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ namespace crg
std::vector< Attachment const * > attachments;
std::vector< VkClearValue > clearValues;
std::vector< Entry > attaches;
PipelineState previousState;
PipelineState nextState;

void cleanup( crg::GraphContext & context );
};
Expand All @@ -94,8 +96,6 @@ namespace crg
VkPipelineColorBlendAttachmentStateArray m_blendAttachs;
uint32_t m_layers{};
uint32_t m_index{};
PipelineState m_srcState;
PipelineState m_dstState;
uint32_t m_count{ 1u };
};
}
Loading