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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ if ( MSVC OR NOT "${CMAKE_BUILD_TYPE}" STREQUAL "" )
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/DotExport.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/Exception.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraph.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraphBase.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraphEnums.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraphFunctions.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraphPrerequisites.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FrameGraphStructs.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FramePass.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FramePassGroup.hpp
${CRG_SOURCE_DIR}/include/${PROJECT_NAME}/FramePassTimer.hpp
Expand Down Expand Up @@ -249,7 +253,7 @@ if ( MSVC OR NOT "${CMAKE_BUILD_TYPE}" STREQUAL "" )
)
set_target_properties( ${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD 20
FOLDER "${CRG_BASE_DIR}/Core"
DEBUG_POSTFIX "d"
UNITY_BUILD "${PROJECTS_UNITY_BUILD}"
Expand Down
117 changes: 67 additions & 50 deletions include/RenderGraph/Attachment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ namespace crg
, maxLod{ maxLod }
{
}

private:
friend bool operator==( SamplerDesc const & lhs, SamplerDesc const & rhs ) = default;
};
CRG_API bool operator==( SamplerDesc const & lhs
, SamplerDesc const & rhs );
/**
*\brief
* An image attachment.
Expand Down Expand Up @@ -85,7 +86,6 @@ namespace crg
*/
/**@{*/
CRG_API ImageViewId view( uint32_t index = 0u )const;
CRG_API VkDescriptorType getDescriptorType()const;
CRG_API ImageLayout getImageLayout( bool separateDepthStencilLayouts
, bool isInput
, bool isOutput )const;
Expand Down Expand Up @@ -171,37 +171,50 @@ namespace crg

public:
ImageViewIdArray views{};
VkAttachmentLoadOp loadOp{};
VkAttachmentStoreOp storeOp{};
VkAttachmentLoadOp stencilLoadOp{};
VkAttachmentStoreOp stencilStoreOp{};
AttachmentLoadOp loadOp{};
AttachmentStoreOp storeOp{};
AttachmentLoadOp stencilLoadOp{};
AttachmentStoreOp stencilStoreOp{};
SamplerDesc samplerDesc{};
VkClearValue clearValue{};
VkPipelineColorBlendAttachmentState blendState = DefaultBlendState;
ClearValue clearValue{};
PipelineColorBlendAttachmentState blendState = DefaultBlendState;
ImageLayout wantedLayout{};

private:
CRG_API ImageAttachment() = default;
CRG_API explicit ImageAttachment( ImageViewId view );
CRG_API ImageAttachment( FlagKind flags
, ImageViewIdArray views
, VkAttachmentLoadOp loadOp
, VkAttachmentStoreOp storeOp
, VkAttachmentLoadOp stencilLoadOp
, VkAttachmentStoreOp stencilStoreOp
, AttachmentLoadOp loadOp
, AttachmentStoreOp storeOp
, AttachmentLoadOp stencilLoadOp
, AttachmentStoreOp stencilStoreOp
, SamplerDesc samplerDesc
, VkClearValue clearValue
, VkPipelineColorBlendAttachmentState blendState
, ClearValue clearValue
, PipelineColorBlendAttachmentState blendState
, ImageLayout wantedLayout );

FlagKind flags{};

friend CRG_API bool operator==( ImageAttachment const & lhs, ImageAttachment const & rhs );
friend bool operator==( ImageAttachment const & lhs
, ImageAttachment const & rhs )
{
return lhs.flags == rhs.flags
&& lhs.views == rhs.views
&& lhs.loadOp == rhs.loadOp
&& lhs.storeOp == rhs.storeOp
&& lhs.stencilLoadOp == rhs.stencilLoadOp
&& lhs.stencilStoreOp == rhs.stencilStoreOp
&& lhs.samplerDesc == rhs.samplerDesc
&& lhs.clearValue == rhs.clearValue
&& lhs.blendState == rhs.blendState;
}

};
struct BufferSubresourceRange
{
VkDeviceSize offset{};
VkDeviceSize size{};
DeviceSize offset{};
DeviceSize size{};
};
/**
*\brief
Expand Down Expand Up @@ -229,10 +242,6 @@ namespace crg
TransitionView = Transition | View,
};

CRG_API VkDescriptorType getDescriptorType()const;
CRG_API WriteDescriptorSet getWrite( uint32_t binding
, uint32_t count
, uint32_t index )const;
CRG_API AccessFlags getAccessMask( bool isInput
, bool isOutput )const;
CRG_API PipelineStageFlags getPipelineStageFlags( bool isCompute )const;
Expand Down Expand Up @@ -301,20 +310,27 @@ namespace crg
CRG_API explicit BufferAttachment( Buffer buffer );
CRG_API BufferAttachment( FlagKind flags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range
, DeviceSize offset
, DeviceSize range
, AccessState access = {} );
CRG_API BufferAttachment( FlagKind flags
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range
, DeviceSize offset
, DeviceSize range
, AccessState access = {} );

FlagKind flags{};
AccessState wantedAccess{};

friend CRG_API bool operator==( BufferAttachment const & lhs, BufferAttachment const & rhs );
friend bool operator==( BufferAttachment const & lhs, BufferAttachment const & rhs )
{
return lhs.flags == rhs.flags
&& lhs.buffer == rhs.buffer
&& lhs.view == rhs.view
&& lhs.range.offset == rhs.range.offset
&& lhs.range.size == rhs.range.size;
}
};
/**
*\brief
Expand Down Expand Up @@ -349,8 +365,6 @@ namespace crg
CRG_API ImageViewId view( uint32_t index = 0u )const;
CRG_API VkBuffer buffer( uint32_t index = 0u )const;
CRG_API ImageLayout getImageLayout( bool separateDepthStencilLayouts )const;
CRG_API VkDescriptorType getDescriptorType()const;
CRG_API WriteDescriptorSet getBufferWrite( uint32_t index = 0u )const;
CRG_API AccessFlags getAccessMask()const;
CRG_API PipelineStageFlags getPipelineStageFlags( bool isCompute )const;

Expand Down Expand Up @@ -598,32 +612,32 @@ namespace crg
return imageAttach.samplerDesc;
}

VkClearValue const & getClearValue()const
ClearValue const & getClearValue()const
{
return imageAttach.clearValue;
}

VkAttachmentLoadOp getLoadOp()const
AttachmentLoadOp getLoadOp()const
{
return imageAttach.loadOp;
}

VkAttachmentLoadOp getStencilLoadOp()const
AttachmentLoadOp getStencilLoadOp()const
{
return imageAttach.stencilLoadOp;
}

VkAttachmentStoreOp getStoreOp()const
AttachmentStoreOp getStoreOp()const
{
return imageAttach.storeOp;
}

VkAttachmentStoreOp getStencilStoreOp()const
AttachmentStoreOp getStencilStoreOp()const
{
return imageAttach.stencilStoreOp;
}

VkPipelineColorBlendAttachmentState getBlendState()const
PipelineColorBlendAttachmentState getBlendState()const
{
return imageAttach.blendState;
}
Expand Down Expand Up @@ -664,22 +678,22 @@ namespace crg
, std::string name
, ImageAttachment::FlagKind imageFlags
, ImageViewIdArray views
, VkAttachmentLoadOp loadOp
, VkAttachmentStoreOp storeOp
, VkAttachmentLoadOp stencilLoadOp
, VkAttachmentStoreOp stencilStoreOp
, AttachmentLoadOp loadOp
, AttachmentStoreOp storeOp
, AttachmentLoadOp stencilLoadOp
, AttachmentStoreOp stencilStoreOp
, SamplerDesc samplerDesc
, VkClearValue clearValue
, VkPipelineColorBlendAttachmentState blendState
, ClearValue clearValue
, PipelineColorBlendAttachmentState blendState
, ImageLayout wantedLayout );
CRG_API Attachment( FlagKind flags
, FramePass & pass
, uint32_t binding
, std::string name
, BufferAttachment::FlagKind bufferFlags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range
, DeviceSize offset
, DeviceSize range
, AccessState wantedAccess );
CRG_API Attachment( FlagKind flags
, FramePass & pass
Expand All @@ -688,16 +702,19 @@ namespace crg
, BufferAttachment::FlagKind bufferFlags
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range
, DeviceSize offset
, DeviceSize range
, AccessState wantedAccess );

FlagKind flags{};

friend CRG_API bool operator==( Attachment const & lhs, Attachment const & rhs );
friend bool operator==( Attachment const & lhs
, Attachment const & rhs )
{
return lhs.pass == rhs.pass
&& lhs.flags == rhs.flags
&& lhs.imageAttach == rhs.imageAttach
&& lhs.bufferAttach == rhs.bufferAttach;
}
};

CRG_API bool operator==( BufferAttachment const & lhs, BufferAttachment const & rhs );
CRG_API bool operator==( ImageAttachment const & lhs, ImageAttachment const & rhs );
CRG_API bool operator==( Attachment const & lhs, Attachment const & rhs );
}
11 changes: 8 additions & 3 deletions include/RenderGraph/AttachmentTransition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ namespace crg
DataT data;
Attachment outputAttach;
Attachment inputAttach;
};

bool operator==( ViewTransition const & lhs, ViewTransition const & rhs );
bool operator==( BufferTransition const & lhs, BufferTransition const & rhs );
private:
friend bool operator==( DataTransitionT const & lhs, DataTransitionT const & rhs )
{
return match( lhs.data, rhs.data )
&& lhs.outputAttach == rhs.outputAttach
&& lhs.inputAttach == rhs.inputAttach;
}
};

struct AttachmentTransitions
{
Expand Down
10 changes: 5 additions & 5 deletions include/RenderGraph/FrameGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,30 @@ namespace crg
/**@{*/
CRG_API LayoutState getFinalLayoutState( ImageId image
, ImageViewType viewType
, VkImageSubresourceRange const & range )const;
, ImageSubresourceRange const & range )const;
CRG_API LayoutState getFinalLayoutState( ImageViewId view
, uint32_t passIndex = 0u )const;
CRG_API AccessState const & getFinalAccessState( Buffer const & buffer
, uint32_t passIndex = 0u )const;
CRG_API void addInput( ImageId image
, ImageViewType viewType
, VkImageSubresourceRange const & range
, ImageSubresourceRange const & range
, LayoutState const & outputLayout );
CRG_API void addInput( ImageViewId view
, LayoutState const & outputLayout );
CRG_API LayoutState getInputLayoutState( ImageId image
, ImageViewType viewType
, VkImageSubresourceRange const & range )const;
, ImageSubresourceRange const & range )const;
CRG_API LayoutState getInputLayoutState( ImageViewId view )const;
CRG_API void addOutput( ImageId image
, ImageViewType viewType
, VkImageSubresourceRange const & range
, ImageSubresourceRange const & range
, LayoutState const & outputLayout );
CRG_API void addOutput( ImageViewId view
, LayoutState const & outputLayout );
CRG_API LayoutState getOutputLayoutState( ImageId image
, ImageViewType viewType
, VkImageSubresourceRange const & range )const;
, ImageSubresourceRange const & range )const;
CRG_API LayoutState getOutputLayoutState( ImageViewId view )const;
CRG_API LayerLayoutStatesMap const & getOutputLayoutStates()const;

Expand Down
Loading