Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: 100% coverage #134

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<p align="center">
<img alt="Vcpkg Version" src="https://img.shields.io/vcpkg/v/rendergraph">
<a href="https://github.com/DragonJoker/RenderGraph/actions?query=workflow%3ABuild+event%3Apush"><img alt="Build status" src="https://github.com/DragonJoker/RenderGraph/workflows/Build/badge.svg?event=push"></a>
<a href="https://codecov.io/gh/DragonJoker/RenderGraph" ><img src="https://codecov.io/gh/DragonJoker/RenderGraph/graph/badge.svg?token=E0IGAPHLJO"/></a>
</p>
Expand Down
40 changes: 36 additions & 4 deletions include/RenderGraph/Attachment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ namespace crg
Storage = 0x01 << 1,
Transfer = 0x01 << 2,
View = 0x01 << 3,
Transition = 0x01 << 4,
UniformView = Uniform | View,
StorageView = Storage | View,
TransitionView = Transition | View,
};

CRG_API VkDescriptorType getDescriptorType()const;
Expand Down Expand Up @@ -265,6 +267,11 @@ namespace crg
return hasFlag( Flag::Transfer );
}

bool isTransition()const
{
return hasFlag( Flag::Transition );
}

bool isView()const
{
return hasFlag( Flag::View );
Expand All @@ -280,6 +287,11 @@ namespace crg
return isStorage() && isView();
}

bool isTransitionView()const
{
return isTransition() && isView();
}

Buffer buffer{ {}, std::string{} };
VkBufferView view{};
BufferSubresourceRange range{};
Expand All @@ -290,14 +302,17 @@ namespace crg
CRG_API BufferAttachment( FlagKind flags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range );
, VkDeviceSize range
, AccessState access = {} );
CRG_API BufferAttachment( FlagKind flags
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range );
, VkDeviceSize range
, AccessState access = {} );

FlagKind flags{};
AccessState wantedAccess{};

friend CRG_API bool operator==( BufferAttachment const & lhs, BufferAttachment const & rhs );
};
Expand Down Expand Up @@ -364,6 +379,11 @@ namespace crg
return hasFlag( Flag::Output );
}

bool isInOut()const
{
return isInput() && isOutput();
}

bool isImage()const
{
return hasFlag( Flag::Image );
Expand Down Expand Up @@ -428,6 +448,16 @@ namespace crg
return isBuffer() && bufferAttach.isStorageView();
}

bool isTransitionBuffer()const
{
return isBuffer() && bufferAttach.isTransition();
}

bool isTransitionBufferView()const
{
return isBuffer() && bufferAttach.isTransitionView();
}

bool isBufferView()const
{
return isBuffer() && bufferAttach.isView();
Expand Down Expand Up @@ -649,7 +679,8 @@ namespace crg
, BufferAttachment::FlagKind bufferFlags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range );
, VkDeviceSize range
, AccessState wantedAccess );
CRG_API Attachment( FlagKind flags
, FramePass & pass
, uint32_t binding
Expand All @@ -658,7 +689,8 @@ namespace crg
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range );
, VkDeviceSize range
, AccessState wantedAccess );

FlagKind flags{};

Expand Down
2 changes: 1 addition & 1 deletion include/RenderGraph/FrameGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace crg
/**@{*/
CRG_API FrameGraph( FrameGraph const & ) = delete;
CRG_API FrameGraph & operator=( FrameGraph const & ) = delete;
CRG_API FrameGraph( FrameGraph && )noexcept = delete;
CRG_API FrameGraph( FrameGraph && )noexcept = default;
CRG_API FrameGraph & operator=( FrameGraph && )noexcept = delete;
CRG_API ~FrameGraph()noexcept = default;
CRG_API explicit FrameGraph( ResourceHandler & handler
Expand Down
21 changes: 21 additions & 0 deletions include/RenderGraph/FramePass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ namespace crg
/**@{*/
/**
*\brief
* Creates an implicit buffer attachment.
*\remarks
* This buffer will only be used to compute dependencies, and is considered an input, in that goal.
*/
CRG_API void addImplicitBuffer( Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range
, AccessState wantedAccess );
/**
*\brief
* Creates a uniform buffer attachment.
*/
CRG_API void addUniformBuffer( Buffer buffer
Expand Down Expand Up @@ -126,6 +136,17 @@ namespace crg
, VkDeviceSize range );
/**
*\brief
* Creates an implicit buffer view attachment.
*\remarks
* This buffer will only be used to compute dependencies, and is considered an input, in that goal.
*/
CRG_API void addImplicitBufferView( Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range
, AccessState wantedAccess );
/**
*\brief
* Creates a uniform texel buffer view attachment.
*/
CRG_API void addUniformBufferView( Buffer buffer
Expand Down
3 changes: 2 additions & 1 deletion include/RenderGraph/RecordContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ namespace crg

CRG_API static ImplicitAction copyImage( ImageViewId srcView
, ImageViewId dstView
, VkExtent2D extent );
, VkExtent2D extent
, VkImageLayout finalLayout = VK_IMAGE_LAYOUT_UNDEFINED );
CRG_API static ImplicitAction blitImage( ImageViewId srcView
, ImageViewId dstView
, VkOffset2D srcOffset
Expand Down
30 changes: 22 additions & 8 deletions source/RenderGraph/Attachment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,26 @@ namespace crg
BufferAttachment::BufferAttachment( FlagKind flags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range )
, VkDeviceSize range
, AccessState access )
: buffer{ std::move( buffer ) }
, range{ offset, range }
, flags{ flags }
, wantedAccess{ std::move( access ) }
{
}

BufferAttachment::BufferAttachment( FlagKind flags
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range )
, VkDeviceSize range
, AccessState access )
: buffer{ std::move( buffer ) }
, view{ view }
, range{ offset, range }
, flags{ flags }
, wantedAccess{ std::move( access ) }
{
}

Expand Down Expand Up @@ -109,7 +113,11 @@ namespace crg
{
VkAccessFlags result{ 0u };

if ( isStorage() )
if ( isTransition() )
{
result = wantedAccess.access;
}
else if ( isStorage() )
{
if ( isInput )
{
Expand Down Expand Up @@ -145,7 +153,11 @@ namespace crg
{
VkPipelineStageFlags result{ 0u };

if ( isTransfer() )
if ( isTransition() )
{
result = wantedAccess.pipelineStage;
}
else if ( isTransfer() )
{
result |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
Expand Down Expand Up @@ -489,11 +501,12 @@ namespace crg
, BufferAttachment::FlagKind bufferFlags
, Buffer buffer
, VkDeviceSize offset
, VkDeviceSize range )
, VkDeviceSize range
, AccessState wantedAccess )
: pass{ &pass }
, binding{ binding }
, name{ std::move( name ) }
, bufferAttach{ bufferFlags, std::move( buffer ), offset, range }
, bufferAttach{ bufferFlags, std::move( buffer ), offset, range, std::move( wantedAccess ) }
, flags{ FlagKind( flags
| FlagKind( Flag::Buffer ) ) }
{
Expand All @@ -507,11 +520,12 @@ namespace crg
, Buffer buffer
, VkBufferView view
, VkDeviceSize offset
, VkDeviceSize range )
, VkDeviceSize range
, AccessState wantedAccess )
: pass{ &pass }
, binding{ binding }
, name{ std::move( name ) }
, bufferAttach{ bufferFlags, std::move( buffer ), view, offset, range }
, bufferAttach{ bufferFlags, std::move( buffer ), view, offset, range, std::move( wantedAccess ) }
, flags{ FlagKind( flags
| FlagKind( Flag::Buffer ) ) }
{
Expand Down
6 changes: 4 additions & 2 deletions source/RenderGraph/AttachmentTransition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ namespace crg

AttachmentTransitions mergeIdenticalTransitions( AttachmentTransitions transitions )
{
return { attTran::mergeIdenticalTransitionsT( std::move( transitions.viewTransitions ) )
, attTran::mergeIdenticalTransitionsT( std::move( transitions.bufferTransitions ) ) };
AttachmentTransitions result{};
result.viewTransitions = attTran::mergeIdenticalTransitionsT( std::move( transitions.viewTransitions ) );
result.bufferTransitions = attTran::mergeIdenticalTransitionsT( std::move( transitions.bufferTransitions ) );
return result;
}
}
39 changes: 17 additions & 22 deletions source/RenderGraph/FrameGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

for ( auto & pass : currentPasses )
{
bool processed = false;

Check failure on line 53 in source/RenderGraph/FrameGraph.cpp

View workflow job for this annotation

GitHub Actions / build-macos (macos-latest, x64-osx, clang, Release)

variable 'processed' set but not used [-Werror,-Wunused-but-set-variable]

Check failure on line 53 in source/RenderGraph/FrameGraph.cpp

View workflow job for this annotation

GitHub Actions / build-linux-gcc (ubuntu-latest, x64-linux, gcc, Release)

variable ‘processed’ set but not used [-Werror=unused-but-set-variable]

Check failure on line 53 in source/RenderGraph/FrameGraph.cpp

View workflow job for this annotation

GitHub Actions / build-linux-clang (ubuntu-latest, x64-linux, clang, Release)

variable 'processed' set but not used [-Werror,-Wunused-but-set-variable]
// Only process this pass if all its dependencies have been processed.
if ( !std::all_of( pass->passDepends.begin()
, pass->passDepends.end()
Expand All @@ -61,40 +62,34 @@
} ) )
{
unsortedPasses.push_back( pass );
continue;
processed = true;
}

auto it = std::find_if( sortedPasses.begin()
else if ( auto it = std::find_if( sortedPasses.begin()
, sortedPasses.end()
, [&pass]( FramePass const * lookup )
{
return lookup->dependsOn( *pass );
} );

if ( it != sortedPasses.end() )
it != sortedPasses.end() )
{
sortedPasses.insert( it, pass );
added = true;
processed = true;
}
else
{
auto rit = std::find_if( sortedPasses.rbegin()
, sortedPasses.rend()
, [&pass]( FramePass const * lookup )
{
return pass->dependsOn( *lookup );
} );

if ( rit != sortedPasses.rend() )
{
sortedPasses.insert( rit.base(), pass );
added = true;
}
else
else if ( auto rit = std::find_if( sortedPasses.rbegin()
, sortedPasses.rend()
, [&pass]( FramePass const * lookup )
{
unsortedPasses.push_back( pass );
}
return pass->dependsOn( *lookup );
} );
rit != sortedPasses.rend() )
{
sortedPasses.insert( rit.base(), pass );
added = true;
processed = true;
}

assert( processed && "Couldn't process pass" );
}

if ( !added )
Expand Down
5 changes: 3 additions & 2 deletions source/RenderGraph/FrameGraph.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@
<DisplayString Condition="(flags &amp; crg::BufferAttachment::Flag::Uniform) != 0">Uniform {buffer}</DisplayString>
<DisplayString Condition="(flags &amp; crg::BufferAttachment::Flag::Storage) != 0">Storage {buffer}</DisplayString>
<DisplayString Condition="(flags &amp; crg::BufferAttachment::Flag::Transfer) != 0">Transfer {buffer}</DisplayString>
<DisplayString Condition="(flags &amp; crg::BufferAttachment::Flag::Transition) != 0">Transition {buffer}</DisplayString>
<Expand>
<Item Name="buffer">buffer</Item>
<Item Condition="(flags &amp; crg::BufferAttachment::Flag::View)" Name="view">view</Item>
<Item Name="offset">offset</Item>
<Item Name="range">range</Item>
<Item Name="offset">range.offset</Item>
<Item Name="range">range.size</Item>
</Expand>
</Type>

Expand Down
Loading
Loading