diff --git a/Backends/RmlUi_Include_Vulkan.h b/Backends/RmlUi_Include_Vulkan.h new file mode 100644 index 000000000..bc59afc99 --- /dev/null +++ b/Backends/RmlUi_Include_Vulkan.h @@ -0,0 +1,32 @@ +#ifndef RMLUI_BACKENDS_INCLUDE_VULKAN_H + #define RMLUI_BACKENDS_INCLUDE_VULKAN_H + + #if defined RMLUI_PLATFORM_UNIX + #define VK_USE_PLATFORM_XCB_KHR 1 + #endif + #define VMA_STATIC_VULKAN_FUNCTIONS 0 + #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 +#endif + +#if defined _MSC_VER + #pragma warning(push, 0) +#elif defined __clang__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wall" + #pragma clang diagnostic ignored "-Wextra" + #pragma clang diagnostic ignored "-Wnullability-extension" + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + #pragma clang diagnostic ignored "-Wnullability-completeness" +#elif defined __GNUC__ + #pragma GCC system_header +#endif + +#include "RmlUi_Vulkan/vulkan.h" +// Always include "vulkan.h" first, this comment prevents clang-format from reordering the includes. +#include "RmlUi_Vulkan/vk_mem_alloc.h" + +#if defined _MSC_VER + #pragma warning(pop) +#elif defined __clang__ + #pragma clang diagnostic pop +#endif diff --git a/Backends/RmlUi_Renderer_VK.cpp b/Backends/RmlUi_Renderer_VK.cpp index 85d38fb7a..8e728aff3 100644 --- a/Backends/RmlUi_Renderer_VK.cpp +++ b/Backends/RmlUi_Renderer_VK.cpp @@ -3038,12 +3038,6 @@ void RenderInterface_VK::MemoryPool::Free_GeometryHandle_ShaderDataOnly(geometry p_valid_geometry_handle->m_p_shader_allocation = nullptr; } -RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH - #define GLAD_VULKAN_IMPLEMENTATION -#include "RmlUi_Vulkan/vulkan.h" - #define VMA_IMPLEMENTATION -#include "RmlUi_Vulkan/vk_mem_alloc.h" - -RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP +#include "RmlUi_Include_Vulkan.h" diff --git a/Backends/RmlUi_Renderer_VK.h b/Backends/RmlUi_Renderer_VK.h index d1f7f916b..a8181f5dd 100644 --- a/Backends/RmlUi_Renderer_VK.h +++ b/Backends/RmlUi_Renderer_VK.h @@ -31,50 +31,12 @@ #include -/** - * Include third-party dependencies. - */ #ifdef RMLUI_PLATFORM_WIN32 #include "RmlUi_Include_Windows.h" #define VK_USE_PLATFORM_WIN32_KHR #endif -#if (_MSC_VER > 0) - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH _Pragma("warning(push, 0)") - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP _Pragma("warning(pop)") -#elif __clang__ - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH \ - _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wall\"") _Pragma("clang diagnostic ignored \"-Wextra\"") \ - _Pragma("clang diagnostic ignored \"-Wnullability-extension\"") \ - _Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"") \ - _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP _Pragma("clang diagnostic pop") -#elif __GNUC__ - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH \ - _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") \ - _Pragma("GCC diagnostic ignored \"-Wunused-function\"") _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \ - _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \ - _Pragma("GCC diagnostic ignored \"-Wswitch\"") _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ - _Pragma("GCC diagnostic ignored \"-Wattributes\"") _Pragma("GCC diagnostic ignored \"-Wignored-qualifiers\"") \ - _Pragma("GCC diagnostic ignored \"-Wparentheses\"") - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP _Pragma("GCC diagnostic pop") -#else - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH - #define RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP -#endif - -RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH - -#if defined(RMLUI_PLATFORM_UNIX) - #define VK_USE_PLATFORM_XCB_KHR 1 -#endif -#include "RmlUi_Vulkan/vulkan.h" - -#define VMA_STATIC_VULKAN_FUNCTIONS 0 -#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 -#include "RmlUi_Vulkan/vk_mem_alloc.h" - -RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP +#include "RmlUi_Include_Vulkan.h" #ifdef RMLUI_DEBUG #define RMLUI_VK_ASSERTMSG(statement, msg) RMLUI_ASSERTMSG(statement, msg)