1 // 2 // Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved. 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a copy 5 // of this software and associated documentation files (the "Software"), to deal 6 // in the Software without restriction, including without limitation the rights 7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 // copies of the Software, and to permit persons to whom the Software is 9 // furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 // THE SOFTWARE. 21 // 22 23 #ifndef VMA_USAGE_H_ 24 #define VMA_USAGE_H_ 25 26 #ifdef _WIN32 27 28 #if !defined(NOMINMAX) 29 #define NOMINMAX 30 #endif 31 32 #if !defined(WIN32_LEAN_AND_MEAN) 33 #define WIN32_LEAN_AND_MEAN 34 #endif 35 36 #include <windows.h> 37 #if !defined(VK_USE_PLATFORM_WIN32_KHR) 38 #define VK_USE_PLATFORM_WIN32_KHR 39 #endif // #if !defined(VK_USE_PLATFORM_WIN32_KHR) 40 41 #else // #ifdef _WIN32 42 43 #include <vulkan/vulkan.h> 44 45 #endif // #ifdef _WIN32 46 47 #ifdef _MSVC_LANG 48 49 // Uncomment to test including `vulkan.h` on your own before including VMA. 50 //#include <vulkan/vulkan.h> 51 52 /* 53 In every place where you want to use Vulkan Memory Allocator, define appropriate 54 macros if you want to configure the library and then include its header to 55 include all public interface declarations. Example: 56 */ 57 58 //#define VMA_HEAVY_ASSERT(expr) assert(expr) 59 //#define VMA_DEDICATED_ALLOCATION 0 60 //#define VMA_DEBUG_MARGIN 16 61 //#define VMA_DEBUG_DETECT_CORRUPTION 1 62 //#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256 63 //#define VMA_USE_STL_SHARED_MUTEX 0 64 //#define VMA_MEMORY_BUDGET 0 65 //#define VMA_STATS_STRING_ENABLED 0 66 //#define VMA_MAPPING_HYSTERESIS_ENABLED 0 67 #define VMA_STATIC_VULKAN_FUNCTIONS 0 68 #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 69 70 //#define VMA_VULKAN_VERSION 1003000 // Vulkan 1.3 71 //#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2 72 //#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1 73 //#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0 74 75 /* 76 #define VMA_DEBUG_LOG(format, ...) do { \ 77 printf(format, __VA_ARGS__); \ 78 printf("\n"); \ 79 } while(false) 80 */ 81 82 #pragma warning(push, 4) 83 #pragma warning(disable: 4127) // conditional expression is constant 84 #pragma warning(disable: 4100) // unreferenced formal parameter 85 #pragma warning(disable: 4189) // local variable is initialized but not referenced 86 #pragma warning(disable: 4324) // structure was padded due to alignment specifier 87 #pragma warning(disable: 4820) // 'X': 'N' bytes padding added after data member 'X' 88 89 #endif // #ifdef _MSVC_LANG 90 91 #ifdef __clang__ 92 #pragma clang diagnostic push 93 #pragma clang diagnostic ignored "-Wtautological-compare" // comparison of unsigned expression < 0 is always false 94 #pragma clang diagnostic ignored "-Wunused-private-field" 95 #pragma clang diagnostic ignored "-Wunused-parameter" 96 #pragma clang diagnostic ignored "-Wmissing-field-initializers" 97 #pragma clang diagnostic ignored "-Wnullability-completeness" 98 #endif 99 100 #include "vk_mem_alloc.h" 101 102 #ifdef __clang__ 103 #pragma clang diagnostic pop 104 #endif 105 106 #ifdef _MSVC_LANG 107 #pragma warning(pop) 108 #endif 109 110 #endif 111