mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Examples: Vulkan: Rename compile-time defies for the examples to remove misleading IMGUI_ prefixes.
This commit is contained in:
		| @@ -31,9 +31,9 @@ | |||||||
| #pragma comment(lib, "legacy_stdio_definitions") | #pragma comment(lib, "legacy_stdio_definitions") | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| //#define IMGUI_UNLIMITED_FRAME_RATE | //#define APP_USE_UNLIMITED_FRAME_RATE | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
| #define IMGUI_VULKAN_DEBUG_REPORT | #define APP_USE_VULKAN_DEBUG_REPORT | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Data | // Data | ||||||
| @@ -64,14 +64,14 @@ static void check_vk_result(VkResult err) | |||||||
|         abort(); |         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) | 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 |     (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); |     fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage); | ||||||
|     return VK_FALSE; |     return VK_FALSE; | ||||||
| } | } | ||||||
| #endif // IMGUI_VULKAN_DEBUG_REPORT | #endif // APP_USE_VULKAN_DEBUG_REPORT | ||||||
|  |  | ||||||
| static bool IsExtensionAvailable(const ImVector<VkExtensionProperties>& properties, const char* extension) | static bool IsExtensionAvailable(const ImVector<VkExtensionProperties>& properties, const char* extension) | ||||||
| { | { | ||||||
| @@ -139,7 +139,7 @@ static void SetupVulkan(ImVector<const char*> instance_extensions) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|         // Enabling validation layers |         // Enabling validation layers | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|         const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; |         const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; | ||||||
|         create_info.enabledLayerCount = 1; |         create_info.enabledLayerCount = 1; | ||||||
|         create_info.ppEnabledLayerNames = layers; |         create_info.ppEnabledLayerNames = layers; | ||||||
| @@ -153,7 +153,7 @@ static void SetupVulkan(ImVector<const char*> instance_extensions) | |||||||
|         check_vk_result(err); |         check_vk_result(err); | ||||||
|  |  | ||||||
|         // Setup the debug report callback |         // Setup the debug report callback | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|         auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); |         auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); | ||||||
|         IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); |         IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); | ||||||
|         VkDebugReportCallbackCreateInfoEXT debug_report_ci = {}; |         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); |     wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); | ||||||
|  |  | ||||||
|     // Select Present Mode |     // 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 }; |     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; | ||||||
| #else | #else | ||||||
|     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; |     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; | ||||||
| @@ -275,11 +275,11 @@ static void CleanupVulkan() | |||||||
| { | { | ||||||
|     vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); |     vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); | ||||||
|  |  | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|     // Remove the debug report callback |     // Remove the debug report callback | ||||||
|     auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); |     auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); | ||||||
|     vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); |     vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); | ||||||
| #endif // IMGUI_VULKAN_DEBUG_REPORT | #endif // APP_USE_VULKAN_DEBUG_REPORT | ||||||
|  |  | ||||||
|     vkDestroyDevice(g_Device, g_Allocator); |     vkDestroyDevice(g_Device, g_Allocator); | ||||||
|     vkDestroyInstance(g_Instance, g_Allocator); |     vkDestroyInstance(g_Instance, g_Allocator); | ||||||
|   | |||||||
| @@ -23,9 +23,9 @@ | |||||||
| #include <vulkan/vulkan.h> | #include <vulkan/vulkan.h> | ||||||
| //#include <vulkan/vulkan_beta.h> | //#include <vulkan/vulkan_beta.h> | ||||||
|  |  | ||||||
| //#define IMGUI_UNLIMITED_FRAME_RATE | //#define APP_USE_UNLIMITED_FRAME_RATE | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
| #define IMGUI_VULKAN_DEBUG_REPORT | #define APP_USE_VULKAN_DEBUG_REPORT | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Data | // Data | ||||||
| @@ -52,14 +52,14 @@ static void check_vk_result(VkResult err) | |||||||
|         abort(); |         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) | 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 |     (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); |     fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage); | ||||||
|     return VK_FALSE; |     return VK_FALSE; | ||||||
| } | } | ||||||
| #endif // IMGUI_VULKAN_DEBUG_REPORT | #endif // APP_USE_VULKAN_DEBUG_REPORT | ||||||
|  |  | ||||||
| static bool IsExtensionAvailable(const ImVector<VkExtensionProperties>& properties, const char* extension) | static bool IsExtensionAvailable(const ImVector<VkExtensionProperties>& properties, const char* extension) | ||||||
| { | { | ||||||
| @@ -127,7 +127,7 @@ static void SetupVulkan(ImVector<const char*> instance_extensions) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|         // Enabling validation layers |         // Enabling validation layers | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|         const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; |         const char* layers[] = { "VK_LAYER_KHRONOS_validation" }; | ||||||
|         create_info.enabledLayerCount = 1; |         create_info.enabledLayerCount = 1; | ||||||
|         create_info.ppEnabledLayerNames = layers; |         create_info.ppEnabledLayerNames = layers; | ||||||
| @@ -141,7 +141,7 @@ static void SetupVulkan(ImVector<const char*> instance_extensions) | |||||||
|         check_vk_result(err); |         check_vk_result(err); | ||||||
|  |  | ||||||
|         // Setup the debug report callback |         // Setup the debug report callback | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|         auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); |         auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT"); | ||||||
|         IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); |         IM_ASSERT(vkCreateDebugReportCallbackEXT != nullptr); | ||||||
|         VkDebugReportCallbackCreateInfoEXT debug_report_ci = {}; |         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); |     wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); | ||||||
|  |  | ||||||
|     // Select Present Mode |     // 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 }; |     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; | ||||||
| #else | #else | ||||||
|     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; |     VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; | ||||||
| @@ -263,11 +263,11 @@ static void CleanupVulkan() | |||||||
| { | { | ||||||
|     vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); |     vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator); | ||||||
|  |  | ||||||
| #ifdef IMGUI_VULKAN_DEBUG_REPORT | #ifdef APP_USE_VULKAN_DEBUG_REPORT | ||||||
|     // Remove the debug report callback |     // Remove the debug report callback | ||||||
|     auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); |     auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT"); | ||||||
|     vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); |     vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator); | ||||||
| #endif // IMGUI_VULKAN_DEBUG_REPORT | #endif // APP_USE_VULKAN_DEBUG_REPORT | ||||||
|  |  | ||||||
|     vkDestroyDevice(g_Device, g_Allocator); |     vkDestroyDevice(g_Device, g_Allocator); | ||||||
|     vkDestroyInstance(g_Instance, g_Allocator); |     vkDestroyInstance(g_Instance, g_Allocator); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user