summaryrefslogtreecommitdiff
path: root/chromium/gpu/vulkan/vulkan_platform.h
blob: 471b65ed1ffb0d82e09524c7603d83fd25905264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file is used so we only include platform specific headers when
// necessary. Otherwise some headers such as for X11 define extra macros which
// can conflict with other headers.

#ifndef GPU_VULKAN_VULKAN_H_
#define GPU_VULKAN_VULKAN_H_

#ifdef __cplusplus
extern "C" {
#endif

#if defined(USE_X11)
#define VK_USE_PLATFORM_XLIB_KHR
#endif

// This section below is taken from <vulkan/vulkan.h>
#ifdef VK_USE_PLATFORM_XLIB_KHR
#define VK_KHR_xlib_surface 1
#include <X11/Xlib.h>

#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"

typedef VkFlags VkXlibSurfaceCreateFlagsKHR;

typedef struct VkXlibSurfaceCreateInfoKHR {
  VkStructureType sType;
  const void* pNext;
  VkXlibSurfaceCreateFlagsKHR flags;
  Display* dpy;
  Window window;
} VkXlibSurfaceCreateInfoKHR;

typedef VkResult(VKAPI_PTR* PFN_vkCreateXlibSurfaceKHR)(
    VkInstance instance,
    const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
    const VkAllocationCallbacks* pAllocator,
    VkSurfaceKHR* pSurface);
typedef VkBool32(VKAPI_PTR* PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(
    VkPhysicalDevice physicalDevice,
    uint32_t queueFamilyIndex,
    Display* dpy,
    VisualID visualID);

#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL
vkCreateXlibSurfaceKHR(VkInstance instance,
                       const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
                       const VkAllocationCallbacks* pAllocator,
                       VkSurfaceKHR* pSurface);

VKAPI_ATTR VkBool32 VKAPI_CALL
vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
                                              uint32_t queueFamilyIndex,
                                              Display* dpy,
                                              VisualID visualID);
#endif
#endif /* VK_USE_PLATFORM_XLIB_KHR */

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // GPU_VULKAN_VULKAN_H_