Skip to content

Commit

Permalink
Hot fix: Added overload to command::render_pass in order to re-establ…
Browse files Browse the repository at this point in the history
…ish compatibility with the way of passing renderpass-es (before the merge of dynamic rendering)
  • Loading branch information
johannesugb committed Apr 12, 2024
1 parent 2e437e0 commit 180578c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
20 changes: 20 additions & 0 deletions include/avk/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,26 @@ namespace avk
bool aSubpassesInline = true
);


/** Begins and ends a render pass for a given framebuffer, and supports some nested commands to be recorded in between
* @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 aNestedCommands Nested commands to be recorded between begin and end
* @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 render_pass(
std::optional<std::reference_wrapper<const avk::renderpass_t>> aRenderpass,
const framebuffer_t& aFramebuffer,
std::vector<recorded_commands_t> aNestedCommands = {},
vk::Offset2D aRenderAreaOffset = { 0, 0 },
std::optional<vk::Extent2D> aRenderAreaExtent = {},
bool aSubpassesInline = true
);

/** Begins dynamic rendering and supports nested commands in between
* @param aNestedCommands Nested commands to be recorded between begin and end
* @param aRenderAreaOffset Render area offset (default is (0,0), i.e., no offset)
Expand Down
19 changes: 19 additions & 0 deletions src/avk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8674,6 +8674,25 @@ namespace avk
};
}

action_type_command render_pass(
std::optional<std::reference_wrapper<const avk::renderpass_t>> aRenderpass,
const framebuffer_t& aFramebuffer,
std::vector<recorded_commands_t> aNestedCommands,
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 = render_pass(aRenderpass.value().get(), aFramebuffer, std::move(aNestedCommands), aRenderAreaOffset, aRenderAreaExtent, aSubpassesInline);

return result;
}

action_type_command next_subpass(bool aSubpassesInline)
{
return action_type_command{
Expand Down

0 comments on commit 180578c

Please sign in to comment.