1 
2 /*
3  * Copyright 2016 Google Inc.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 #ifndef GrVkDefines_DEFINED
10 #define GrVkDefines_DEFINED
11 
12 #ifdef SK_VULKAN
13 
14 #ifdef SK_VULKAN_HEADER
15 #include SK_VULKAN_HEADER
16 #else
17 // This is deprecated and all clients should define their own custum header shim that sets up
18 // defines and includes the vulkan.h header. Then they should define SK_VULKAN_HEADER or set the
19 // skia_vulkan_header in gn to point to their custom header.
20 #  if defined(SK_BUILD_FOR_WIN)
21 #     if !defined(VK_USE_PLATFORM_WIN32_KHR)
22 #        define VK_USE_PLATFORM_WIN32_KHR
23 #     endif
24 #  elif defined(SK_BUILD_FOR_ANDROID)
25 #     if !defined(VK_USE_PLATFORM_ANDROID_KHR)
26 #        define VK_USE_PLATFORM_ANDROID_KHR
27 #     endif
28 #  elif defined(SK_BUILD_FOR_UNIX)
29 #     if defined(__Fuchsia__)
30 #       if !defined(VK_USE_PLATFORM_MAGMA_KHR)
31 #         define VK_USE_PLATFORM_MAGMA_KHR
32 #       endif
33 #     else
34 #       if !defined(VK_USE_PLATFORM_XCB_KHR)
35 #          define VK_USE_PLATFORM_XCB_KHR
36 #       endif
37 #     endif
38 #  endif
39 
40 // We create our own function table and never directly call any functions via vk*(). So no need to
41 // include the prototype functions.
42 #  if !defined(VK_NO_PROTOTYPES) && !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
43 #    define VK_NO_PROTOTYPES
44 #  endif
45 
46 #  include <vulkan/vulkan.h>
47 #endif // SK_VULKAN_HEADER
48 
49 #define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17
50 #if VK_HEADER_VERSION < SKIA_REQUIRED_VULKAN_HEADER_VERSION
51 #error "Vulkan header version is too low"
52 #endif
53 
54 #endif
55 
56 #endif
57