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