Просмотр исходного кода

Vulkan: More renaming. Comments.

omar 6 лет назад
Родитель
Сommit
6bf981c85c

+ 6 - 4
examples/example_glfw_vulkan/main.cpp

@@ -1,10 +1,12 @@
 // dear imgui: standalone example application for Glfw + Vulkan
 // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
 
-// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own application.
+// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
 // - Common ImGui_ImplVulkan_XXXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
-// - Helper ImGui_ImplVulkanH_XXXX functions and structures are used by this example (main.cpp) and by imgui_impl_vulkan.cpp,
-//   but should PROBABLY NOT be used by your own app code. Read comments in imgui_impl_vulkan.h.
+//   You will use those if you want to use this rendering back-end in your engine/app.
+// - Helper ImGui_ImplVulkanH_XXXX functions and structures are only used by this example (main.cpp) and by 
+//   the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
+// Read comments in imgui_impl_vulkan.h.
 
 #include "imgui.h"
 #include "imgui_impl_glfw.h"
@@ -424,7 +426,7 @@ int main(int, char**)
 
         err = vkDeviceWaitIdle(g_Device);
         check_vk_result(err);
-        ImGui_ImplVulkan_InvalidateFontUploadObjects();
+        ImGui_ImplVulkan_DestroyFontUploadObjects();
     }
 
     bool show_demo_window = true;

+ 6 - 4
examples/example_sdl_vulkan/main.cpp

@@ -1,10 +1,12 @@
 // dear imgui: standalone example application for SDL2 + Vulkan
 // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
 
-// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own application.
+// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
 // - Common ImGui_ImplVulkan_XXXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
-// - Helper ImGui_ImplVulkanH_XXXX functions and structures are used by this example (main.cpp) and by imgui_impl_vulkan.cpp,
-//   but should PROBABLY NOT be used by your own app code. Read comments in imgui_impl_vulkan.h.
+//   You will use those if you want to use this rendering back-end in your engine/app.
+// - Helper ImGui_ImplVulkanH_XXXX functions and structures are only used by this example (main.cpp) and by 
+//   the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
+// Read comments in imgui_impl_vulkan.h.
 
 #include "imgui.h"
 #include "imgui_impl_sdl.h"
@@ -407,7 +409,7 @@ int main(int, char**)
 
         err = vkDeviceWaitIdle(g_Device);
         check_vk_result(err);
-        ImGui_ImplVulkan_InvalidateFontUploadObjects();
+        ImGui_ImplVulkan_DestroyFontUploadObjects();
     }
 
     bool show_demo_window = true;

+ 18 - 11
examples/imgui_impl_vulkan.cpp

@@ -11,6 +11,13 @@
 // The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
 // IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
 
+// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
+// - Common ImGui_ImplVulkan_XXXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
+//   You will use those if you want to use this rendering back-end in your engine/app.
+// - Helper ImGui_ImplVulkanH_XXXX functions and structures are only used by this example (main.cpp) and by 
+//   the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
+// Read comments in imgui_impl_vulkan.h.
+
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
 //  2019-XX-XX: Vulkan: Added FramesQueueSize field in ImGui_ImplVulkan_InitInfo, required for initialization (was previously a hard #define IMGUI_VK_QUEUED_FRAMES 2). Added ImGui_ImplVulkan_SetFramesQueueSize() to override FramesQueueSize while running.
@@ -726,7 +733,7 @@ bool ImGui_ImplVulkan_CreateDeviceObjects()
     return true;
 }
 
-void    ImGui_ImplVulkan_InvalidateFontUploadObjects()
+void    ImGui_ImplVulkan_DestroyFontUploadObjects()
 {
     if (g_UploadBuffer)
     {
@@ -753,10 +760,10 @@ static void    ImGui_ImplVulkan_InvalidateFrameDeviceObjects()
     g_FramesDataBuffers.clear();
 }
 
-void    ImGui_ImplVulkan_InvalidateDeviceObjects()
+void    ImGui_ImplVulkan_DestroyDeviceObjects()
 {
     ImGui_ImplVulkan_InvalidateFrameDeviceObjects();
-    ImGui_ImplVulkan_InvalidateFontUploadObjects();
+    ImGui_ImplVulkan_DestroyFontUploadObjects();
 
     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; }
@@ -802,7 +809,7 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
 
 void ImGui_ImplVulkan_Shutdown()
 {
-    ImGui_ImplVulkan_InvalidateDeviceObjects();
+    ImGui_ImplVulkan_DestroyDeviceObjects();
 }
 
 void ImGui_ImplVulkan_NewFrame()
@@ -847,8 +854,8 @@ ImGui_ImplVulkanH_FrameData::ImGui_ImplVulkanH_FrameData()
     Fence = VK_NULL_HANDLE;
     ImageAcquiredSemaphore = VK_NULL_HANDLE;
     RenderCompleteSemaphore = VK_NULL_HANDLE;
-    BackBuffer = VK_NULL_HANDLE;
-    BackBufferView = VK_NULL_HANDLE;
+    Backbuffer = VK_NULL_HANDLE;
+    BackbufferView = VK_NULL_HANDLE;
     Framebuffer = VK_NULL_HANDLE;
 }
 
@@ -1056,7 +1063,7 @@ void ImGui_ImplVulkanH_CreateWindowDataSwapChain(VkPhysicalDevice physical_devic
         for (int i = 0; i < (int)wd->FramesQueueSize; i++)
         {
             wd->Frames.push_back(ImGui_ImplVulkanH_FrameData());
-            wd->Frames[i].BackBuffer = backbuffers[i];
+            wd->Frames[i].Backbuffer = backbuffers[i];
         }
     }
     if (old_swapchain)
@@ -1114,8 +1121,8 @@ void ImGui_ImplVulkanH_CreateWindowDataSwapChain(VkPhysicalDevice physical_devic
         for (uint32_t i = 0; i < wd->FramesQueueSize; i++)
         {
             ImGui_ImplVulkanH_FrameData* fd = &wd->Frames[i];
-            info.image = fd->BackBuffer;
-            err = vkCreateImageView(device, &info, allocator, &fd->BackBufferView);
+            info.image = fd->Backbuffer;
+            err = vkCreateImageView(device, &info, allocator, &fd->BackbufferView);
             check_vk_result(err);
         }
     }
@@ -1134,7 +1141,7 @@ void ImGui_ImplVulkanH_CreateWindowDataSwapChain(VkPhysicalDevice physical_devic
         for (uint32_t i = 0; i < wd->FramesQueueSize; i++)
         {
             ImGui_ImplVulkanH_FrameData* fd = &wd->Frames[i];
-            attachment[0] = fd->BackBufferView;
+            attachment[0] = fd->BackbufferView;
             err = vkCreateFramebuffer(device, &info, allocator, &fd->Framebuffer);
             check_vk_result(err);
         }
@@ -1173,6 +1180,6 @@ void ImGui_ImplVulkanH_DestroyFrameData(VkInstance instance, VkDevice device, Im
     fd->CommandPool = VK_NULL_HANDLE;
     fd->ImageAcquiredSemaphore = fd->RenderCompleteSemaphore = VK_NULL_HANDLE;
 
-    vkDestroyImageView(device, fd->BackBufferView, allocator);
+    vkDestroyImageView(device, fd->BackbufferView, allocator);
     vkDestroyFramebuffer(device, fd->Framebuffer, allocator);
 }

+ 15 - 7
examples/imgui_impl_vulkan.h

@@ -11,11 +11,19 @@
 // The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
 // IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
 
+// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
+// - Common ImGui_ImplVulkan_XXXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
+//   You will use those if you want to use this rendering back-end in your engine/app.
+// - Helper ImGui_ImplVulkanH_XXXX functions and structures are only used by this example (main.cpp) and by 
+//   the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
+// Read comments in imgui_impl_vulkan.h.
+
 #pragma once
 
 #include <vulkan/vulkan.h>
 
-// Please zero-clear before use.
+// Initialization data, for ImGui_ImplVulkan_Init()
+// [Please zero-clear before use!]
 struct ImGui_ImplVulkan_InitInfo
 {
     VkInstance                      Instance;
@@ -37,16 +45,16 @@ IMGUI_IMPL_API void     ImGui_ImplVulkan_NewFrame();
 IMGUI_IMPL_API void     ImGui_ImplVulkan_SetFramesQueueSize(int frames_queue_size); // To override FramesQueueSize after initialization
 IMGUI_IMPL_API void     ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer);
 IMGUI_IMPL_API bool     ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer);
-IMGUI_IMPL_API void     ImGui_ImplVulkan_InvalidateFontUploadObjects();
+IMGUI_IMPL_API void     ImGui_ImplVulkan_DestroyFontUploadObjects();
 
 // Called by ImGui_ImplVulkan_Init(), might be useful elsewhere.
 IMGUI_IMPL_API bool     ImGui_ImplVulkan_CreateDeviceObjects();
-IMGUI_IMPL_API void     ImGui_ImplVulkan_InvalidateDeviceObjects();
+IMGUI_IMPL_API void     ImGui_ImplVulkan_DestroyDeviceObjects();
 
 
 //-------------------------------------------------------------------------
 // Internal / Miscellaneous Vulkan Helpers
-// (Used by example's main.cpp. Used by multi-viewport features. PROBABLY NOT used by your own app.)
+// (Used by example's main.cpp. Used by multi-viewport features. PROBABLY NOT used by your own engine/app.)
 //-------------------------------------------------------------------------
 // You probably do NOT need to use or care about those functions.
 // Those functions only exist because:
@@ -55,7 +63,7 @@ IMGUI_IMPL_API void     ImGui_ImplVulkan_InvalidateDeviceObjects();
 // Generally we avoid exposing any kind of superfluous high-level helpers in the bindings,
 // but it is too much code to duplicate everywhere so we exceptionally expose them.
 //
-// Your application/engine will likely _already_ have code to setup all that stuff (swap chain, render pass, frame buffers, etc.).
+// Your engine/app will likely _already_ have code to setup all that stuff (swap chain, render pass, frame buffers, etc.).
 // You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work.
 // (The ImGui_ImplVulkanH_XXX functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions)
 //-------------------------------------------------------------------------
@@ -78,8 +86,8 @@ struct ImGui_ImplVulkanH_FrameData
     VkFence             Fence;
     VkSemaphore         ImageAcquiredSemaphore;
     VkSemaphore         RenderCompleteSemaphore;
-    VkImage             BackBuffer;
-    VkImageView         BackBufferView;
+    VkImage             Backbuffer;
+    VkImageView         BackbufferView;
     VkFramebuffer       Framebuffer;
 
     IMGUI_IMPL_API ImGui_ImplVulkanH_FrameData();