Skip to content

Commit

Permalink
Hot-fix: Added an overload taking a std::optional<std::reference_wrap…
Browse files Browse the repository at this point in the history
…per<const avk::renderpass_t>> aRenderpass also for begin_render_pass_for_framebuffer
  • Loading branch information
johannesugb committed Apr 23, 2024
1 parent 180578c commit fc77af8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/avk/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,17 @@ namespace avk
*/
extern action_type_command begin_render_pass_for_framebuffer(const renderpass_t& aRenderpass, const framebuffer_t& aFramebuffer, vk::Offset2D aRenderAreaOffset = { 0, 0 }, std::optional<vk::Extent2D> aRenderAreaExtent = {}, bool aSubpassesInline = true);

/** Begins a render pass for a given framebuffer
* @param aRenderpass Renderpass which shall begin (auto lifetime handling not supported by this command).
* Optional parameter serves as a convenience-overload for the changes introduced during dynamic rendering pull request,
* namely the change of the return type of graphics_pipeline_t::renderpass_reference(), which returns an optional now.
* @param aFramebuffer Framebuffer to use with the renderpass (auto lifetime handling not supported by this command)
* @param aRenderAreaOffset Render area offset (default is (0,0), i.e., no offset)
* @param aRenderAreaExtent Render area extent (default is full extent)
* @param aSubpassesInline Whether or not subpasses are inline (default is true)
*/
extern action_type_command begin_render_pass_for_framebuffer(std::optional<std::reference_wrapper<const avk::renderpass_t>> aRenderpass, const framebuffer_t& aFramebuffer, vk::Offset2D aRenderAreaOffset = { 0, 0 }, std::optional<vk::Extent2D> aRenderAreaExtent = {}, bool aSubpassesInline = true);


/** Ends a render pass
*/
Expand Down
13 changes: 13 additions & 0 deletions src/avk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8625,6 +8625,19 @@ namespace avk
};
}

action_type_command begin_render_pass_for_framebuffer(std::optional<std::reference_wrapper<const avk::renderpass_t>> aRenderpass, const framebuffer_t& aFramebuffer, vk::Offset2D aRenderAreaOffset, std::optional<vk::Extent2D> aRenderAreaExtent, bool aSubpassesInline)
{
auto result = action_type_command{};

if (!aRenderpass.has_value()) {
AVK_LOG_ERROR("The renderpass passed to command::render_pass via the std::optional parameter does not conatin a value, i.e., no Vulkan render pass handle.");
}

result = begin_render_pass_for_framebuffer(aRenderpass.value().get(), aFramebuffer, aRenderAreaOffset, aRenderAreaExtent, aSubpassesInline);

return result;
}

action_type_command end_render_pass()
{
return action_type_command{
Expand Down

0 comments on commit fc77af8

Please sign in to comment.