Flutter Engine
vulkan_interface.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_VULKAN_VULKAN_INTERFACE_H_
6 #define FLUTTER_VULKAN_VULKAN_INTERFACE_H_
7 
8 #include <string>
9 
10 #include "flutter/fml/build_config.h"
11 #include "flutter/fml/logging.h"
12 
13 #if OS_ANDROID
14 #ifndef VK_USE_PLATFORM_ANDROID_KHR
15 #define VK_USE_PLATFORM_ANDROID_KHR 1
16 #endif // VK_USE_PLATFORM_ANDROID_KHR
17 #endif // OS_ANDROID
18 
19 #if OS_FUCHSIA
20 #ifndef VK_USE_PLATFORM_MAGMA_KHR
21 #define VK_USE_PLATFORM_MAGMA_KHR 1
22 #endif // VK_USE_PLATFORM_MAGMA_KHR
23 #ifndef VK_USE_PLATFORM_FUCHSIA
24 #define VK_USE_PLATFORM_FUCHSIA 1
25 #endif // VK_USE_PLATFORM_FUCHSIA
26 #endif // OS_FUCHSIA
27 
28 #if !VULKAN_LINK_STATICALLY
29 #define VK_NO_PROTOTYPES 1
30 #endif // !VULKAN_LINK_STATICALLY
31 
32 #include <vulkan/vulkan.h>
33 
34 #ifndef NDEBUG
35 
36 #define VK_CALL_LOG_ERROR(expression) \
37  ({ \
38  __typeof__(expression) _rc = (expression); \
39  if (_rc != VK_SUCCESS) { \
40  FML_DLOG(INFO) << "Vulkan call '" << #expression \
41  << "' failed with error " \
42  << vulkan::VulkanResultToString(_rc); \
43  } \
44  _rc; \
45  })
46 
47 #else // NDEBUG
48 
49 #define VK_CALL_LOG_ERROR(expression) (expression)
50 
51 #endif // NDEBUG
52 
53 namespace vulkan {
54 
55 std::string VulkanResultToString(VkResult result);
56 
57 } // namespace vulkan
58 
59 #endif // FLUTTER_VULKAN_VULKAN_INTERFACE_H_
std::string VulkanResultToString(VkResult result)