Flutter Engine
 
Loading...
Searching...
No Matches
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_PROCS_VULKAN_INTERFACE_H_
6#define FLUTTER_VULKAN_PROCS_VULKAN_INTERFACE_H_
7
8#include <string>
9
11#include "flutter/fml/logging.h"
12
13#if FML_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 // FML_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#include <vulkan/vulkan.h>
29
30// The Vulkan headers may bring in X11 headers which define some macros that
31// conflict with other code. Undefine these macros after including Vulkan.
32#undef Bool
33#undef None
34#undef Status
35#undef Success
36
37#define VK_CALL_LOG_ERROR(expression) VK_CALL_LOG(expression, ERROR)
38
39#define VK_CALL_LOG_FATAL(expression) VK_CALL_LOG(expression, FATAL)
40
41#define VK_CALL_LOG(expression, severity) \
42 ({ \
43 __typeof__(expression) _rc = (expression); \
44 if (_rc != VK_SUCCESS) { \
45 FML_LOG(severity) << "Vulkan call '" << #expression \
46 << "' failed with error " \
47 << vulkan::VulkanResultToString(_rc); \
48 } \
49 _rc; \
50 })
51
52namespace vulkan {
53
54std::string VulkanResultToString(VkResult result);
55
56} // namespace vulkan
57
58#endif // FLUTTER_VULKAN_PROCS_VULKAN_INTERFACE_H_
std::string VulkanResultToString(VkResult result)