mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +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
|
||||
// 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.
|
||||
// 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.
|
||||
@ -713,47 +715,22 @@ void ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects()
|
||||
void ImGui_ImplGlfwVulkan_InvalidateDeviceObjects()
|
||||
{
|
||||
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]) {
|
||||
vkDestroyBuffer(g_Device, g_VertexBuffer[i], g_Allocator);
|
||||
g_VertexBuffer[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_VertexBuffer[i]) { vkDestroyBuffer(g_Device, g_VertexBuffer[i], g_Allocator); g_VertexBuffer[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)
|
||||
vkDestroyImageView(g_Device, g_FontView, g_Allocator);
|
||||
g_FontView = VK_NULL_HANDLE;
|
||||
if (g_FontImage)
|
||||
vkDestroyImage(g_Device, g_FontImage, g_Allocator);
|
||||
g_FontImage = VK_NULL_HANDLE;
|
||||
if (g_FontMemory)
|
||||
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;
|
||||
if (g_FontView) { vkDestroyImageView(g_Device, g_FontView, g_Allocator); g_FontView = VK_NULL_HANDLE; }
|
||||
if (g_FontImage) { vkDestroyImage(g_Device, g_FontImage, g_Allocator); g_FontImage = VK_NULL_HANDLE; }
|
||||
if (g_FontMemory) { 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)
|
||||
@ -861,6 +838,7 @@ void ImGui_ImplGlfwVulkan_NewFrame()
|
||||
// Start the frame
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwVulkan_Render(VkCommandBuffer command_buffer)
|
||||
{
|
||||
g_CommandBuffer = command_buffer;
|
||||
|
@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
// 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.
|
||||
|
@ -61,10 +61,10 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
|
||||
check_vk_result(err);
|
||||
|
||||
// Destroy old Framebuffer:
|
||||
for (uint32_t i=0; i<g_BackBufferCount; i++)
|
||||
for (uint32_t i = 0; i < g_BackBufferCount; i++)
|
||||
if (g_BackBufferView[i])
|
||||
vkDestroyImageView(g_Device, g_BackBufferView[i], g_Allocator);
|
||||
for(uint32_t i=0; i<g_BackBufferCount; i++)
|
||||
for (uint32_t i = 0; i < g_BackBufferCount; i++)
|
||||
if (g_Framebuffer[i])
|
||||
vkDestroyFramebuffer(g_Device, g_Framebuffer[i], g_Allocator);
|
||||
if (g_RenderPass)
|
||||
@ -155,7 +155,7 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
|
||||
info.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||
info.components.a = VK_COMPONENT_SWIZZLE_A;
|
||||
info.subresourceRange = g_ImageRange;
|
||||
for (uint32_t i = 0; i<g_BackBufferCount; i++)
|
||||
for (uint32_t i = 0; i < g_BackBufferCount; i++)
|
||||
{
|
||||
info.image = g_BackBuffer[i];
|
||||
err = vkCreateImageView(g_Device, &info, g_Allocator, &g_BackBufferView[i]);
|
||||
@ -174,7 +174,7 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
|
||||
info.width = fb_width;
|
||||
info.height = fb_height;
|
||||
info.layers = 1;
|
||||
for (uint32_t i = 0; i<g_BackBufferCount; i++)
|
||||
for (uint32_t i = 0; i < g_BackBufferCount; i++)
|
||||
{
|
||||
attachment[0] = g_BackBufferView[i];
|
||||
err = vkCreateFramebuffer(g_Device, &info, g_Allocator, &g_Framebuffer[i]);
|
||||
@ -244,7 +244,7 @@ static void setup_vulkan(GLFWwindow* window)
|
||||
}
|
||||
|
||||
// Create Command Buffers
|
||||
for (int i=0; i<IMGUI_VK_QUEUED_FRAMES; i++)
|
||||
for (int i = 0; i < IMGUI_VK_QUEUED_FRAMES; i++)
|
||||
{
|
||||
{
|
||||
VkCommandPoolCreateInfo info = {};
|
||||
|
Loading…
Reference in New Issue
Block a user