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#pragma once
6
7#include <string>
8
9#include "flutter/fml/build_config.h"
10#include "flutter/fml/logging.h"
11
12#if FML_OS_ANDROID
13#ifndef VK_USE_PLATFORM_ANDROID_KHR
14#define VK_USE_PLATFORM_ANDROID_KHR 1
15#endif // VK_USE_PLATFORM_ANDROID_KHR
16#endif // FML_OS_ANDROID
17
18#if OS_FUCHSIA
19#ifndef VK_USE_PLATFORM_MAGMA_KHR
20#define VK_USE_PLATFORM_MAGMA_KHR 1
21#endif // VK_USE_PLATFORM_MAGMA_KHR
22#ifndef VK_USE_PLATFORM_FUCHSIA
23#define VK_USE_PLATFORM_FUCHSIA 1
24#endif // VK_USE_PLATFORM_FUCHSIA
25#endif // OS_FUCHSIA
26
27#include <vulkan/vulkan.h>
28
29#define VK_CALL_LOG_ERROR(expression) \
30 ({ \
31 __typeof__(expression) _rc = (expression); \
32 if (_rc != VK_SUCCESS) { \
33 FML_LOG(INFO) << "Vulkan call '" << #expression \
34 << "' failed with error " \
35 << vulkan::VulkanResultToString(_rc); \
36 } \
37 _rc; \
38 })
39
40namespace vulkan {
41
42std::string VulkanResultToString(VkResult result);
43
44} // namespace vulkan
45

source code of flutter_engine/flutter/vulkan/procs/vulkan_interface.h