mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 05:19:02 +08:00
Examples: Vulkan: Fixed tabs->space, removed extraneous braces and empty lines. (#2071)
This commit is contained in:
parent
b88a3b2711
commit
c7eef99a33
@ -307,11 +307,6 @@ static void RebuildSwapChain(int width, int height)
|
|||||||
g_PendingSwapchainRebuild = false;
|
g_PendingSwapchainRebuild = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RebuildSwapChain()
|
|
||||||
{
|
|
||||||
RebuildSwapChain(g_WindowData.Width, g_WindowData.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
@ -443,7 +438,7 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_PendingSwapchainRebuild)
|
if (g_PendingSwapchainRebuild)
|
||||||
RebuildSwapChain();
|
RebuildSwapChain(g_WindowData.Width, g_WindowData.Height);
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplVulkan_NewFrame();
|
ImGui_ImplVulkan_NewFrame();
|
||||||
|
@ -773,9 +773,7 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
|
|||||||
g_CheckVkResultFn = info->CheckVkResultFn;
|
g_CheckVkResultFn = info->CheckVkResultFn;
|
||||||
g_FramesDataBuffers.resize(info->QueuedFrames);
|
g_FramesDataBuffers.resize(info->QueuedFrames);
|
||||||
for (int i = 0; i < g_FramesDataBuffers.size(); i++)
|
for (int i = 0; i < g_FramesDataBuffers.size(); i++)
|
||||||
{
|
|
||||||
g_FramesDataBuffers[i] = FrameDataForRender();
|
g_FramesDataBuffers[i] = FrameDataForRender();
|
||||||
}
|
|
||||||
|
|
||||||
ImGui_ImplVulkan_CreateDeviceObjects();
|
ImGui_ImplVulkan_CreateDeviceObjects();
|
||||||
|
|
||||||
@ -795,18 +793,13 @@ void ImGui_ImplVulkan_NewFrame()
|
|||||||
void ImGui_ImplVulkan_SetQueuedFramesCount(uint32_t count)
|
void ImGui_ImplVulkan_SetQueuedFramesCount(uint32_t count)
|
||||||
{
|
{
|
||||||
if (count == g_FramesDataBuffers.size())
|
if (count == g_FramesDataBuffers.size())
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
ImGui_ImplVulkan_InvalidateFrameDeviceObjects();
|
ImGui_ImplVulkan_InvalidateFrameDeviceObjects();
|
||||||
|
|
||||||
uint32_t old_size = g_FramesDataBuffers.size();
|
uint32_t old_size = g_FramesDataBuffers.size();
|
||||||
g_FramesDataBuffers.resize(count);
|
g_FramesDataBuffers.resize(count);
|
||||||
for (uint32_t i = old_size; i < count; i++)
|
for (uint32_t i = old_size; i < count; i++)
|
||||||
{
|
|
||||||
|
|
||||||
g_FramesDataBuffers[i] = FrameDataForRender();
|
g_FramesDataBuffers[i] = FrameDataForRender();
|
||||||
}
|
|
||||||
g_FrameIndex = 0;
|
g_FrameIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,16 +1036,12 @@ void ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(VkPhysicalDevice
|
|||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < wd->Frames.size(); i++)
|
for (uint32_t i = 0; i < wd->Frames.size(); i++)
|
||||||
{
|
|
||||||
ImGui_ImplVulkanH_DestroyFrameData(g_Instance, device, &wd->Frames[i], allocator);
|
ImGui_ImplVulkanH_DestroyFrameData(g_Instance, device, &wd->Frames[i], allocator);
|
||||||
}
|
|
||||||
uint32_t old_size = wd->Frames.size();
|
uint32_t old_size = wd->Frames.size();
|
||||||
wd->Frames.resize(wd->BackBufferCount);
|
wd->Frames.resize(wd->BackBufferCount);
|
||||||
for (uint32_t i = 0; i < wd->Frames.size(); i++)
|
for (uint32_t i = 0; i < wd->Frames.size(); i++)
|
||||||
{
|
|
||||||
wd->Frames[i] = ImGui_ImplVulkanH_FrameData();
|
wd->Frames[i] = ImGui_ImplVulkanH_FrameData();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (old_swapchain)
|
if (old_swapchain)
|
||||||
vkDestroySwapchainKHR(device, old_swapchain, allocator);
|
vkDestroySwapchainKHR(device, old_swapchain, allocator);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user