Skip to content

Commit

Permalink
Fix some minor issues with the api samples base class (KhronosGroup#1196
Browse files Browse the repository at this point in the history
)

* Fix some minor issues with the api samples base class

* Added missing code comment

* Add missing break statement
  • Loading branch information
SaschaWillems authored Nov 4, 2024
1 parent bc61227 commit 58ba96a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions framework/api_vulkan_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ void ApiVulkanSample::input_event(const vkb::InputEvent &input_event)
{
get_gui().visible = !get_gui().visible;
}
break;
default:
break;
}
Expand Down Expand Up @@ -703,7 +704,7 @@ void ApiVulkanSample::setup_depth_stencil()

void ApiVulkanSample::setup_framebuffer()
{
VkImageView attachments[2];
VkImageView attachments[2]{};

// Depth/Stencil attachment is the same for all frame buffers
attachments[1] = depth_stencil.view;
Expand Down Expand Up @@ -781,7 +782,7 @@ void ApiVulkanSample::setup_render_pass()
subpass_description.pResolveAttachments = nullptr;

// Subpass dependencies for layout transitions
std::array<VkSubpassDependency, 2> dependencies;
std::array<VkSubpassDependency, 2> dependencies{};

dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
dependencies[0].dstSubpass = 0;
Expand Down Expand Up @@ -866,7 +867,7 @@ void ApiVulkanSample::update_render_pass_flags(uint32_t flags)
subpass_description.pResolveAttachments = nullptr;

// Subpass dependencies for layout transitions
std::array<VkSubpassDependency, 2> dependencies;
std::array<VkSubpassDependency, 2> dependencies{};

dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
dependencies[0].dstSubpass = 0;
Expand Down
5 changes: 2 additions & 3 deletions framework/api_vulkan_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ class ApiVulkanSample : public vkb::VulkanSampleC

virtual void update(float delta_time) override;

virtual void update_overlay(float delta_time, const std::function<void()> &additional_ui) override;

virtual bool resize(const uint32_t width, const uint32_t height) override;

virtual void render(float delta_time) = 0;
Expand Down Expand Up @@ -363,8 +361,9 @@ class ApiVulkanSample : public vkb::VulkanSampleC
/**
* @brief Updates the overlay
* @param delta_time The time taken since the last frame
* @param additional_ui Function that implements an additional Gui
*/
void update_overlay(float delta_time);
void update_overlay(float delta_time, const std::function<void()> &additional_ui) override;

/**
* @brief If the gui is enabled, then record the drawing commands to a command buffer
Expand Down
1 change: 1 addition & 0 deletions framework/hpp_api_vulkan_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void HPPApiVulkanSample::input_event(const vkb::InputEvent &input_event)
{
get_gui().visible = !get_gui().visible;
}
break;
default:
break;
}
Expand Down

0 comments on commit 58ba96a

Please sign in to comment.