mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 20:18:47 +02:00
Examples: Vulkan: Fixed tabs->space, removed extraneous braces and empty lines. (#2071)
This commit is contained in:
@ -15,8 +15,8 @@
|
||||
#define IMGUI_VULKAN_DEBUG_REPORT
|
||||
#endif
|
||||
|
||||
static uint32_t g_MinImageCount = 2;
|
||||
static bool g_PendingSwapchainRebuild = false;
|
||||
static uint32_t g_MinImageCount = 2;
|
||||
static bool g_PendingSwapchainRebuild = false;
|
||||
static VkAllocationCallbacks* g_Allocator = NULL;
|
||||
static VkInstance g_Instance = VK_NULL_HANDLE;
|
||||
static VkPhysicalDevice g_PhysicalDevice = VK_NULL_HANDLE;
|
||||
@ -204,7 +204,7 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR
|
||||
|
||||
// Create SwapChain, RenderPass, Framebuffer, etc.
|
||||
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, wd, g_Allocator, width, height, g_MinImageCount);
|
||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
||||
}
|
||||
|
||||
static void CleanupVulkan()
|
||||
@ -300,16 +300,11 @@ static void FramePresent(ImGui_ImplVulkanH_WindowData* wd)
|
||||
|
||||
static void RebuildSwapChain(int width, int height)
|
||||
{
|
||||
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &g_WindowData, g_Allocator, width, height, g_MinImageCount);
|
||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, &g_WindowData, g_Allocator);
|
||||
ImGui_ImplVulkan_SetQueuedFramesCount(g_WindowData.BackBufferCount);
|
||||
g_WindowData.FrameIndex = 0;
|
||||
g_PendingSwapchainRebuild = false;
|
||||
}
|
||||
|
||||
static void RebuildSwapChain()
|
||||
{
|
||||
RebuildSwapChain(g_WindowData.Width, g_WindowData.Height);
|
||||
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &g_WindowData, g_Allocator, width, height, g_MinImageCount);
|
||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, &g_WindowData, g_Allocator);
|
||||
ImGui_ImplVulkan_SetQueuedFramesCount(g_WindowData.BackBufferCount);
|
||||
g_WindowData.FrameIndex = 0;
|
||||
g_PendingSwapchainRebuild = false;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
@ -370,7 +365,7 @@ int main(int, char**)
|
||||
init_info.PipelineCache = g_PipelineCache;
|
||||
init_info.DescriptorPool = g_DescriptorPool;
|
||||
init_info.Allocator = g_Allocator;
|
||||
init_info.QueuedFrames = wd->BackBufferCount;
|
||||
init_info.QueuedFrames = wd->BackBufferCount;
|
||||
init_info.CheckVkResultFn = check_vk_result;
|
||||
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
|
||||
|
||||
@ -439,11 +434,11 @@ int main(int, char**)
|
||||
if (event.type == SDL_QUIT)
|
||||
done = true;
|
||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED && event.window.windowID == SDL_GetWindowID(window))
|
||||
RebuildSwapChain((int)event.window.data1, (int)event.window.data2);
|
||||
RebuildSwapChain((int)event.window.data1, (int)event.window.data2);
|
||||
}
|
||||
|
||||
if (g_PendingSwapchainRebuild)
|
||||
RebuildSwapChain();
|
||||
if (g_PendingSwapchainRebuild)
|
||||
RebuildSwapChain(g_WindowData.Width, g_WindowData.Height);
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
ImGui_ImplVulkan_NewFrame();
|
||||
@ -485,26 +480,26 @@ int main(int, char**)
|
||||
if (ImGui::Button("Close Me"))
|
||||
show_another_window = false;
|
||||
|
||||
if (ImGui::Button("Increase"))
|
||||
{
|
||||
g_MinImageCount++;
|
||||
g_PendingSwapchainRebuild = true;
|
||||
}
|
||||
if (ImGui::Button("Increase"))
|
||||
{
|
||||
g_MinImageCount++;
|
||||
g_PendingSwapchainRebuild = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Decrease"))
|
||||
{
|
||||
if (g_MinImageCount != 2)
|
||||
{
|
||||
g_MinImageCount--;
|
||||
g_PendingSwapchainRebuild = true;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Decrease"))
|
||||
{
|
||||
if (g_MinImageCount != 2)
|
||||
{
|
||||
g_MinImageCount--;
|
||||
g_PendingSwapchainRebuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Back Buffers: %i", g_MinImageCount);
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Back Buffers: %i", g_MinImageCount);
|
||||
|
||||
ImGui::Text("Frame Index %i", wd->FrameIndex);
|
||||
ImGui::Text("Frame Index %i", wd->FrameIndex);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
Reference in New Issue
Block a user