Flutter Impeller
vk.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_VK_H_
7 
8 #include "flutter/fml/build_config.h"
9 #include "flutter/fml/logging.h"
10 
11 #define VK_NO_PROTOTYPES
12 
13 #if FML_OS_IOS
14 
15 // #ifndef VK_USE_PLATFORM_IOS_MVK
16 // #define VK_USE_PLATFORM_IOS_MVK
17 // #endif // VK_USE_PLATFORM_IOS_MVK
18 
19 #ifndef VK_USE_PLATFORM_METAL_EXT
20 #define VK_USE_PLATFORM_METAL_EXT
21 #endif // VK_USE_PLATFORM_METAL_EXT
22 
23 #elif FML_OS_MACOSX
24 
25 // #ifndef VK_USE_PLATFORM_MACOS_MVK
26 // #define VK_USE_PLATFORM_MACOS_MVK
27 // #endif // VK_USE_PLATFORM_MACOS_MVK
28 
29 #ifndef VK_USE_PLATFORM_METAL_EXT
30 #define VK_USE_PLATFORM_METAL_EXT
31 #endif // VK_USE_PLATFORM_METAL_EXT
32 
33 #elif FML_OS_ANDROID
34 
35 #ifndef VK_USE_PLATFORM_ANDROID_KHR
36 #define VK_USE_PLATFORM_ANDROID_KHR
37 #endif // VK_USE_PLATFORM_ANDROID_KHR
38 
39 #elif FML_OS_LINUX
40 
41 // Nothing for now.
42 
43 #elif FML_OS_WIN
44 
45 #ifndef VK_USE_PLATFORM_WIN32_KHR
46 #define VK_USE_PLATFORM_WIN32_KHR
47 #endif // VK_USE_PLATFORM_WIN32_KHR
48 
49 #elif OS_FUCHSIA
50 
51 #ifndef VK_USE_PLATFORM_ANDROID_KHR
52 #define VK_USE_PLATFORM_ANDROID_KHR
53 #endif // VK_USE_PLATFORM_ANDROID_KHR
54 
55 #endif // FML_OS
56 
57 #if !defined(NDEBUG)
58 #define VULKAN_HPP_ASSERT FML_CHECK
59 #else
60 #define VULKAN_HPP_ASSERT(ignored) \
61  { \
62  }
63 #endif
64 
65 #define VULKAN_HPP_NAMESPACE impeller::vk
66 #define VULKAN_HPP_ASSERT_ON_RESULT(ignored) \
67  { \
68  [[maybe_unused]] auto res = (ignored); \
69  }
70 #define VULKAN_HPP_NO_EXCEPTIONS
71 
72 // The spaceship operator behaves differently on 32-bit platforms.
73 #define VULKAN_HPP_NO_SPACESHIP_OPERATOR
74 
75 #include "vulkan/vulkan.hpp" // IWYU pragma: keep.
76 
77 // The Vulkan headers may bring in X11 headers which define some macros that
78 // conflict with other code. Undefine these macros after including Vulkan.
79 #undef Bool
80 #undef None
81 #undef Status
82 #undef Success
83 
84 static_assert(VK_HEADER_VERSION >= 215, "Vulkan headers must not be too old.");
85 
86 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_VK_H_