blob: ef6eb60f54269d84f3713ea54ee139f3cab31de0 [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 Sawicki2024cc52019-07-02 15:19:05 +020048//#define VMA_RECORDING_ENABLED 1
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 Sawicki4ac8ff82019-11-18 14:47:33 +010052//#define VMA_MEMORY_BUDGET 0
Adam Sawickifd366b62019-01-24 15:26:43 +010053/*
54#define VMA_DEBUG_LOG(format, ...) do { \
55 printf(format, __VA_ARGS__); \
56 printf("\n"); \
57 } while(false)
58*/
Adam Sawicki212a4a62018-06-14 15:44:45 +020059
Adam Sawickif1a793c2018-03-13 15:42:22 +010060#pragma warning(push, 4)
61#pragma warning(disable: 4127) // conditional expression is constant
62#pragma warning(disable: 4100) // unreferenced formal parameter
63#pragma warning(disable: 4189) // local variable is initialized but not referenced
Adam Sawicki5afe7842019-07-26 15:09:07 +020064#pragma warning(disable: 4324) // structure was padded due to alignment specifier
Adam Sawickif1a793c2018-03-13 15:42:22 +010065
66#include "vk_mem_alloc.h"
67
68#pragma warning(pop)
69
70#else // #ifdef _WIN32
71
Adam Sawickic7d1b582018-08-27 12:30:53 +020072#ifdef __clang__
73 #pragma clang diagnostic push
74 #pragma clang diagnostic ignored "-Wtautological-compare" // comparison of unsigned expression < 0 is always false
75#endif
76
Adam Sawickif1a793c2018-03-13 15:42:22 +010077#include <vulkan/vulkan.h>
78#include "vk_mem_alloc.h"
79
Adam Sawickic7d1b582018-08-27 12:30:53 +020080#ifdef __clang__
81 #pragma clang diagnostic pop
82#endif
83
Adam Sawickif1a793c2018-03-13 15:42:22 +010084#endif // #ifdef _WIN32
85
86#endif