From 2f483373355f77a1591c6ee70eb1d5b77537ba9a Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 19 Jan 2024 14:47:56 +0100 Subject: [PATCH] Examples: Vulkan: Rename compile-time defies for the examples to remove misleading IMGUI_ prefixes. --- examples/example_glfw_vulkan/main.cpp | 18 +++++++++--------- examples/example_sdl2_vulkan/main.cpp | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp index e8027c442..7374ebfa6 100644 --- a/examples/example_glfw_vulkan/main.cpp +++ b/examples/example_glfw_vulkan/main.cpp @@ -31,9 +31,9 @@ #pragma comment(lib, "legacy_stdio_definitions") #endif -//#define IMGUI_UNLIMITED_FRAME_RATE +//#define APP_USE_UNLIMITED_FRAME_RATE #ifdef _DEBUG -#define IMGUI_VULKAN_DEBUG_REPORT +#define APP_USE_VULKAN_DEBUG_REPORT #endif // Data @@ -64,14 +64,14 @@ static void check_vk_result(VkResult err) abort(); } -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT static VKAPI_ATTR VkBool32 VKAPI_CALL debug_report(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData) { (void)flags; (void)object; (void)location; (void)messageCode; (void)pUserData; (void)pLayerPrefix; // Unused arguments fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage); return VK_FALSE; } -#endif // IMGUI_VULKAN_DEBUG_REPORT +#endif // APP_USE_VULKAN_DEBUG_REPORT static bool IsExtensionAvailable(const ImVector& properties, const char* extension) { @@ -139,7 +139,7 @@ static void SetupVulkan(ImVector instance_extensions) #endif // Enabling validation layers -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; create_info.enabledLayerCount = 1; create_info.ppEnabledLayerNames = layers; @@ -153,7 +153,7 @@ static void SetupVulkan(ImVector instance_extensions) check_vk_result(err); // Setup the debug report callback -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); VkDebugReportCallbackCreateInfoEXT debug_report_ci = {}; @@ -258,7 +258,7 @@ static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); // Select Present Mode -#ifdef IMGUI_UNLIMITED_FRAME_RATE +#ifdef APP_USE_UNLIMITED_FRAME_RATE VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; #else VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; @@ -275,11 +275,11 @@ static void CleanupVulkan() { vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT // Remove the debug report callback auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); -#endif // IMGUI_VULKAN_DEBUG_REPORT +#endif // APP_USE_VULKAN_DEBUG_REPORT vkDestroyDevice(g_Device, g_Allocator); vkDestroyInstance(g_Instance, g_Allocator); diff --git a/examples/example_sdl2_vulkan/main.cpp b/examples/example_sdl2_vulkan/main.cpp index bbd9eec42..0b91b1289 100644 --- a/examples/example_sdl2_vulkan/main.cpp +++ b/examples/example_sdl2_vulkan/main.cpp @@ -23,9 +23,9 @@ #include //#include -//#define IMGUI_UNLIMITED_FRAME_RATE +//#define APP_USE_UNLIMITED_FRAME_RATE #ifdef _DEBUG -#define IMGUI_VULKAN_DEBUG_REPORT +#define APP_USE_VULKAN_DEBUG_REPORT #endif // Data @@ -52,14 +52,14 @@ static void check_vk_result(VkResult err) abort(); } -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT static VKAPI_ATTR VkBool32 VKAPI_CALL debug_report(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData) { (void)flags; (void)object; (void)location; (void)messageCode; (void)pUserData; (void)pLayerPrefix; // Unused arguments fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage); return VK_FALSE; } -#endif // IMGUI_VULKAN_DEBUG_REPORT +#endif // APP_USE_VULKAN_DEBUG_REPORT static bool IsExtensionAvailable(const ImVector& properties, const char* extension) { @@ -127,7 +127,7 @@ static void SetupVulkan(ImVector instance_extensions) #endif // Enabling validation layers -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; create_info.enabledLayerCount = 1; create_info.ppEnabledLayerNames = layers; @@ -141,7 +141,7 @@ static void SetupVulkan(ImVector instance_extensions) check_vk_result(err); // Setup the debug report callback -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); VkDebugReportCallbackCreateInfoEXT debug_report_ci = {}; @@ -246,7 +246,7 @@ static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); // Select Present Mode -#ifdef IMGUI_UNLIMITED_FRAME_RATE +#ifdef APP_UNLIMITED_FRAME_RATE VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; #else VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; @@ -263,11 +263,11 @@ static void CleanupVulkan() { vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); -#ifdef IMGUI_VULKAN_DEBUG_REPORT +#ifdef APP_USE_VULKAN_DEBUG_REPORT // Remove the debug report callback auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); -#endif // IMGUI_VULKAN_DEBUG_REPORT +#endif // APP_USE_VULKAN_DEBUG_REPORT vkDestroyDevice(g_Device, g_Allocator); vkDestroyInstance(g_Instance, g_Allocator);