Skip to content

Commit

Permalink
Vulkan: add switch IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
Browse files Browse the repository at this point in the history
#if IMGUI_VERSION_NUM  >= 19030
// The API changed with this commit
// ocornut/imgui@f80e65a
#define IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
#endif
  • Loading branch information
pthom committed Mar 11, 2024
1 parent bcd4e59 commit 9674785
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/hello_imgui/internal/backend_impls/rendering_vulkan_glfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#include "hello_imgui/hello_imgui_logger.h"
#include "hello_imgui/hello_imgui.h"

#if IMGUI_VERSION_NUM >= 19030
// The API changed with this commit
// https://github.com/ocornut/imgui/commit/f80e65a406885beedf68856057b278343d5c1407
#define IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
#endif


namespace HelloImGui
{
Expand Down Expand Up @@ -60,14 +66,19 @@ namespace HelloImGui
init_info.Queue = gVkGlobals.Queue;
init_info.PipelineCache = gVkGlobals.PipelineCache;
init_info.DescriptorPool = gVkGlobals.DescriptorPool;
init_info.RenderPass = wd->RenderPass;
init_info.Subpass = 0;
init_info.MinImageCount = gVkGlobals.MinImageCount;
init_info.ImageCount = wd->ImageCount;
init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
init_info.Allocator = gVkGlobals.Allocator;
init_info.CheckVkResultFn = HelloImGui::VulkanSetup::check_vk_result;

#ifdef IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
init_info.RenderPass = wd->RenderPass;
ImGui_ImplVulkan_Init(&init_info);
#else
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
#endif
}
}

Expand Down
12 changes: 11 additions & 1 deletion src/hello_imgui/internal/backend_impls/rendering_vulkan_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "hello_imgui/hello_imgui_logger.h"
#include "hello_imgui/hello_imgui.h"

#if IMGUI_VERSION_NUM >= 19030
// The API changed with this commit
// https://github.com/ocornut/imgui/commit/f80e65a406885beedf68856057b278343d5c1407
#define IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
#endif

namespace HelloImGui
{
Expand Down Expand Up @@ -55,14 +60,19 @@ namespace HelloImGui
init_info.Queue = gVkGlobals.Queue;
init_info.PipelineCache = gVkGlobals.PipelineCache;
init_info.DescriptorPool = gVkGlobals.DescriptorPool;
init_info.RenderPass = wd->RenderPass;
init_info.Subpass = 0;
init_info.MinImageCount = gVkGlobals.MinImageCount;
init_info.ImageCount = wd->ImageCount;
init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
init_info.Allocator = gVkGlobals.Allocator;
init_info.CheckVkResultFn = HelloImGui::VulkanSetup::check_vk_result;

#ifdef IMGUI_VULKAN_RENDER_PASS_IN_STRUCTURE
init_info.RenderPass = wd->RenderPass;
ImGui_ImplVulkan_Init(&init_info);
#else
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
#endif
}
}

Expand Down

0 comments on commit 9674785

Please sign in to comment.