mirror of
https://github.com/Drezil/imgui.git
synced 2025-03-31 16:32:45 +00:00
Examples: Vulkan: Shallow stylistic changes (following #879)
This commit is contained in:
parent
0449bb98e2
commit
55863dd274
@ -1,4 +1,6 @@
|
|||||||
// ImGui GLFW binding with Vulkan + shaders
|
// ImGui GLFW binding with Vulkan + shaders
|
||||||
|
// FIXME: Changes of ImTextureID aren't supported by this binding! Please, someone add it!
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
@ -713,47 +715,22 @@ void ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects()
|
|||||||
void ImGui_ImplGlfwVulkan_InvalidateDeviceObjects()
|
void ImGui_ImplGlfwVulkan_InvalidateDeviceObjects()
|
||||||
{
|
{
|
||||||
ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects();
|
ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects();
|
||||||
|
|
||||||
for (int i = 0; i < IMGUI_VK_QUEUED_FRAMES; i++)
|
for (int i = 0; i < IMGUI_VK_QUEUED_FRAMES; i++)
|
||||||
{
|
{
|
||||||
if (g_VertexBuffer[i]) {
|
if (g_VertexBuffer[i]) { vkDestroyBuffer(g_Device, g_VertexBuffer[i], g_Allocator); g_VertexBuffer[i] = VK_NULL_HANDLE; }
|
||||||
vkDestroyBuffer(g_Device, g_VertexBuffer[i], g_Allocator);
|
if (g_VertexBufferMemory[i]) { vkFreeMemory(g_Device, g_VertexBufferMemory[i], g_Allocator); g_VertexBufferMemory[i] = VK_NULL_HANDLE; }
|
||||||
g_VertexBuffer[i] = VK_NULL_HANDLE;
|
if (g_IndexBuffer[i]) { vkDestroyBuffer(g_Device, g_IndexBuffer[i], g_Allocator); g_IndexBuffer[i] = VK_NULL_HANDLE; }
|
||||||
}
|
if (g_IndexBufferMemory[i]) { vkFreeMemory(g_Device, g_IndexBufferMemory[i], g_Allocator); g_IndexBufferMemory[i] = VK_NULL_HANDLE; }
|
||||||
if (g_VertexBufferMemory[i]) {
|
|
||||||
vkFreeMemory(g_Device, g_VertexBufferMemory[i], g_Allocator);
|
|
||||||
g_VertexBufferMemory[i] = VK_NULL_HANDLE;
|
|
||||||
}
|
|
||||||
if (g_IndexBuffer[i]) {
|
|
||||||
vkDestroyBuffer(g_Device, g_IndexBuffer[i], g_Allocator);
|
|
||||||
g_IndexBuffer[i] = VK_NULL_HANDLE;
|
|
||||||
}
|
|
||||||
if (g_IndexBufferMemory[i]) {
|
|
||||||
vkFreeMemory(g_Device, g_IndexBufferMemory[i], g_Allocator);
|
|
||||||
g_IndexBufferMemory[i] = VK_NULL_HANDLE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_FontView)
|
if (g_FontView) { vkDestroyImageView(g_Device, g_FontView, g_Allocator); g_FontView = VK_NULL_HANDLE; }
|
||||||
vkDestroyImageView(g_Device, g_FontView, g_Allocator);
|
if (g_FontImage) { vkDestroyImage(g_Device, g_FontImage, g_Allocator); g_FontImage = VK_NULL_HANDLE; }
|
||||||
g_FontView = VK_NULL_HANDLE;
|
if (g_FontMemory) { vkFreeMemory(g_Device, g_FontMemory, g_Allocator); g_FontMemory = VK_NULL_HANDLE; }
|
||||||
if (g_FontImage)
|
if (g_FontSampler) { vkDestroySampler(g_Device, g_FontSampler, g_Allocator); g_FontSampler = VK_NULL_HANDLE; }
|
||||||
vkDestroyImage(g_Device, g_FontImage, g_Allocator);
|
if (g_DescriptorSetLayout) { vkDestroyDescriptorSetLayout(g_Device, g_DescriptorSetLayout, g_Allocator); g_DescriptorSetLayout = VK_NULL_HANDLE; }
|
||||||
g_FontImage = VK_NULL_HANDLE;
|
if (g_PipelineLayout) { vkDestroyPipelineLayout(g_Device, g_PipelineLayout, g_Allocator); g_PipelineLayout = VK_NULL_HANDLE; }
|
||||||
if (g_FontMemory)
|
if (g_Pipeline) { vkDestroyPipeline(g_Device, g_Pipeline, g_Allocator); g_Pipeline = VK_NULL_HANDLE; }
|
||||||
vkFreeMemory(g_Device, g_FontMemory, g_Allocator);
|
|
||||||
g_FontMemory = VK_NULL_HANDLE;
|
|
||||||
if (g_FontSampler)
|
|
||||||
vkDestroySampler(g_Device, g_FontSampler, g_Allocator);
|
|
||||||
g_FontSampler = VK_NULL_HANDLE;
|
|
||||||
if (g_DescriptorSetLayout)
|
|
||||||
vkDestroyDescriptorSetLayout(g_Device, g_DescriptorSetLayout, g_Allocator);
|
|
||||||
g_DescriptorSetLayout = VK_NULL_HANDLE;
|
|
||||||
if (g_PipelineLayout)
|
|
||||||
vkDestroyPipelineLayout(g_Device, g_PipelineLayout, g_Allocator);
|
|
||||||
g_PipelineLayout = VK_NULL_HANDLE;
|
|
||||||
if (g_Pipeline)
|
|
||||||
vkDestroyPipeline(g_Device, g_Pipeline, g_Allocator);
|
|
||||||
g_Pipeline = VK_NULL_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplGlfwVulkan_Init(GLFWwindow* window, bool install_callbacks, ImGui_ImplGlfwVulkan_Init_Data *init_data)
|
bool ImGui_ImplGlfwVulkan_Init(GLFWwindow* window, bool install_callbacks, ImGui_ImplGlfwVulkan_Init_Data *init_data)
|
||||||
@ -861,6 +838,7 @@ void ImGui_ImplGlfwVulkan_NewFrame()
|
|||||||
// Start the frame
|
// Start the frame
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfwVulkan_Render(VkCommandBuffer command_buffer)
|
void ImGui_ImplGlfwVulkan_Render(VkCommandBuffer command_buffer)
|
||||||
{
|
{
|
||||||
g_CommandBuffer = command_buffer;
|
g_CommandBuffer = command_buffer;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
// ImGui GLFW binding with Vulkan + shaders
|
// ImGui GLFW binding with Vulkan + shaders
|
||||||
|
// FIXME: Changes of ImTextureID aren't supported by this binding! Please, someone add it!
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user