1 // 2 // Copyright (c) 2017-2021 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 #define NOMINMAX 29 #define WIN32_LEAN_AND_MEAN 30 #include <Windows.h> 31 #if !defined(VK_USE_PLATFORM_WIN32_KHR) 32 #define VK_USE_PLATFORM_WIN32_KHR 33 #endif // #if !defined(VK_USE_PLATFORM_WIN32_KHR) 34 35 #else // #ifdef _WIN32 36 37 #include <vulkan/vulkan.h> 38 39 #endif // #ifdef _WIN32 40 41 #ifdef _MSVC_LANG 42 43 // Uncomment to test including `vulkan.h` on your own before including VMA. 44 //#include <vulkan/vulkan.h> 45 46 /* 47 In every place where you want to use Vulkan Memory Allocator, define appropriate 48 macros if you want to configure the library and then include its header to 49 include all public interface declarations. Example: 50 */ 51 52 //#define VMA_HEAVY_ASSERT(expr) assert(expr) 53 //#define VMA_DEDICATED_ALLOCATION 0 54 //#define VMA_DEBUG_MARGIN 16 55 //#define VMA_DEBUG_DETECT_CORRUPTION 1 56 //#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256 57 //#define VMA_USE_STL_SHARED_MUTEX 0 58 //#define VMA_MEMORY_BUDGET 0 59 #define VMA_STATIC_VULKAN_FUNCTIONS 0 60 #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 61 62 #define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2 63 //#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1 64 //#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0 65 66 /* 67 #define VMA_DEBUG_LOG(format, ...) do { \ 68 printf(format, __VA_ARGS__); \ 69 printf("\n"); \ 70 } while(false) 71 */ 72 73 #pragma warning(push, 4) 74 #pragma warning(disable: 4127) // conditional expression is constant 75 #pragma warning(disable: 4100) // unreferenced formal parameter 76 #pragma warning(disable: 4189) // local variable is initialized but not referenced 77 #pragma warning(disable: 4324) // structure was padded due to alignment specifier 78 79 #endif // #ifdef _MSVC_LANG 80 81 #ifdef __clang__ 82 #pragma clang diagnostic push 83 #pragma clang diagnostic ignored "-Wtautological-compare" // comparison of unsigned expression < 0 is always false 84 #pragma clang diagnostic ignored "-Wunused-private-field" 85 #pragma clang diagnostic ignored "-Wunused-parameter" 86 #pragma clang diagnostic ignored "-Wmissing-field-initializers" 87 #pragma clang diagnostic ignored "-Wnullability-completeness" 88 #endif 89 90 #include "vk_mem_alloc.h" 91 92 #ifdef __clang__ 93 #pragma clang diagnostic pop 94 #endif 95 96 #ifdef _MSVC_LANG 97 #pragma warning(pop) 98 #endif 99 100 #endif 101