From 0bc0e7555e4c406b9861595c75e129c7532ec871 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 19 Oct 2024 13:28:12 +0200 Subject: [PATCH 1/3] Fix some minor issues with the api samples base class --- framework/api_vulkan_sample.cpp | 7 ++++--- framework/api_vulkan_sample.h | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/api_vulkan_sample.cpp b/framework/api_vulkan_sample.cpp index 5a8ae55a5..80302c65f 100644 --- a/framework/api_vulkan_sample.cpp +++ b/framework/api_vulkan_sample.cpp @@ -304,6 +304,7 @@ void ApiVulkanSample::input_event(const vkb::InputEvent &input_event) { get_gui().visible = !get_gui().visible; } + break; default: break; } @@ -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; @@ -781,7 +782,7 @@ void ApiVulkanSample::setup_render_pass() subpass_description.pResolveAttachments = nullptr; // Subpass dependencies for layout transitions - std::array dependencies; + std::array dependencies{}; dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL; dependencies[0].dstSubpass = 0; @@ -866,7 +867,7 @@ void ApiVulkanSample::update_render_pass_flags(uint32_t flags) subpass_description.pResolveAttachments = nullptr; // Subpass dependencies for layout transitions - std::array dependencies; + std::array dependencies{}; dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL; dependencies[0].dstSubpass = 0; diff --git a/framework/api_vulkan_sample.h b/framework/api_vulkan_sample.h index 1cda25340..0d1bfd5ec 100644 --- a/framework/api_vulkan_sample.h +++ b/framework/api_vulkan_sample.h @@ -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 &additional_ui) override; - virtual bool resize(const uint32_t width, const uint32_t height) override; virtual void render(float delta_time) = 0; @@ -364,7 +362,7 @@ class ApiVulkanSample : public vkb::VulkanSampleC * @brief Updates the overlay * @param delta_time The time taken since the last frame */ - void update_overlay(float delta_time); + void update_overlay(float delta_time, const std::function &additional_ui) override; /** * @brief If the gui is enabled, then record the drawing commands to a command buffer From 11535c34e923edeef4fdf166fd7551b7c0a0aa94 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 19 Oct 2024 14:59:26 +0200 Subject: [PATCH 2/3] Added missing code comment --- framework/api_vulkan_sample.h | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/api_vulkan_sample.h b/framework/api_vulkan_sample.h index 0d1bfd5ec..ba6d704d3 100644 --- a/framework/api_vulkan_sample.h +++ b/framework/api_vulkan_sample.h @@ -361,6 +361,7 @@ 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, const std::function &additional_ui) override; From 3d46fa14af6dcbf143750c5e6f827252ad0248a9 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Tue, 22 Oct 2024 19:00:40 +0200 Subject: [PATCH 3/3] Add missing break statement --- framework/hpp_api_vulkan_sample.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/hpp_api_vulkan_sample.cpp b/framework/hpp_api_vulkan_sample.cpp index bd8303fbf..35e1ef5cd 100644 --- a/framework/hpp_api_vulkan_sample.cpp +++ b/framework/hpp_api_vulkan_sample.cpp @@ -300,6 +300,7 @@ void HPPApiVulkanSample::input_event(const vkb::InputEvent &input_event) { get_gui().visible = !get_gui().visible; } + break; default: break; }