blob: b8761ad7e3006454cdaba415845a1840f1e09893 [file] [log] [blame]
Adam Sawickiae5c4662019-01-02 10:23:35 +01001//
2// Copyright (c) 2017-2019 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
Adam Sawickif1a793c2018-03-13 15:42:22 +010023#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
Adam Sawickie8b01482018-12-06 14:47:59 +010033// Uncomment to test including `vulkan.h` on your own before including VMA.
34//#include <vulkan/vulkan.h>
Adam Sawickif1a793c2018-03-13 15:42:22 +010035
36/*
37In every place where you want to use Vulkan Memory Allocator, define appropriate
38macros if you want to configure the library and then include its header to
39include all public interface declarations. Example:
40*/
41
Adam Sawicki212a4a62018-06-14 15:44:45 +020042//#define VMA_HEAVY_ASSERT(expr) assert(expr)
Adam Sawicki0a607132018-08-24 11:18:41 +020043//#define VMA_USE_STL_CONTAINERS 1
Adam Sawicki4f919392018-04-03 13:45:39 +020044//#define VMA_DEDICATED_ALLOCATION 0
Adam Sawicki212a4a62018-06-14 15:44:45 +020045//#define VMA_DEBUG_MARGIN 16
46//#define VMA_DEBUG_DETECT_CORRUPTION 1
Adam Sawickie44c6262018-06-15 14:30:39 +020047//#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
Adam Sawickie5d9b012018-08-20 15:50:03 +020048//#define VMA_RECORDING_ENABLED 0
Adam Sawicki0a607132018-08-24 11:18:41 +020049//#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256
Adam Sawickif863a1d2018-10-10 16:43:44 +020050//#define VMA_USE_STL_SHARED_MUTEX 0
51//#define VMA_DEBUG_GLOBAL_MUTEX 1
Adam Sawicki212a4a62018-06-14 15:44:45 +020052
Adam Sawickif1a793c2018-03-13 15:42:22 +010053#pragma warning(push, 4)
54#pragma warning(disable: 4127) // conditional expression is constant
55#pragma warning(disable: 4100) // unreferenced formal parameter
56#pragma warning(disable: 4189) // local variable is initialized but not referenced
57
58#include "vk_mem_alloc.h"
59
60#pragma warning(pop)
61
62#else // #ifdef _WIN32
63
Adam Sawickic7d1b582018-08-27 12:30:53 +020064#ifdef __clang__
65 #pragma clang diagnostic push
66 #pragma clang diagnostic ignored "-Wtautological-compare" // comparison of unsigned expression < 0 is always false
67#endif
68
Adam Sawickif1a793c2018-03-13 15:42:22 +010069#include <vulkan/vulkan.h>
70#include "vk_mem_alloc.h"
71
Adam Sawickic7d1b582018-08-27 12:30:53 +020072#ifdef __clang__
73 #pragma clang diagnostic pop
74#endif
75
Adam Sawickif1a793c2018-03-13 15:42:22 +010076#endif // #ifdef _WIN32
77
78#endif