1 /*
2 * Copyright 2019 Google LLC
3 * SPDX-License-Identifier: MIT
4 *
5 * based in part on anv and radv which are:
6 * Copyright © 2015 Intel Corporation
7 * Copyright © 2016 Red Hat.
8 * Copyright © 2016 Bas Nieuwenhuizen
9 */
10
11 #ifndef VN_WSI_H
12 #define VN_WSI_H
13
14 #include "vn_common.h"
15
16 #include "wsi_common.h"
17
18 #ifdef VN_USE_WSI_PLATFORM
19
20 VkResult
21 vn_wsi_init(struct vn_physical_device *physical_dev);
22
23 void
24 vn_wsi_fini(struct vn_physical_device *physical_dev);
25
26 VkResult
27 vn_wsi_create_image(struct vn_device *dev,
28 const VkImageCreateInfo *create_info,
29 const struct wsi_image_create_info *wsi_info,
30 const VkAllocationCallbacks *alloc,
31 struct vn_image **out_img);
32
33 VkResult
34 vn_wsi_create_image_from_swapchain(
35 struct vn_device *dev,
36 const VkImageCreateInfo *create_info,
37 const VkImageSwapchainCreateInfoKHR *swapchain_info,
38 const VkAllocationCallbacks *alloc,
39 struct vn_image **out_img);
40
41 #else
42
43 static inline VkResult
vn_wsi_init(UNUSED struct vn_physical_device * physical_dev)44 vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
45 {
46 return VK_SUCCESS;
47 }
48
49 static inline void
vn_wsi_fini(UNUSED struct vn_physical_device * physical_dev)50 vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
51 {
52 }
53
54 static inline VkResult
vn_wsi_create_image(struct vn_device * dev,const VkImageCreateInfo * create_info,const struct wsi_image_create_info * wsi_info,const VkAllocationCallbacks * alloc,struct vn_image ** out_img)55 vn_wsi_create_image(struct vn_device *dev,
56 const VkImageCreateInfo *create_info,
57 const struct wsi_image_create_info *wsi_info,
58 const VkAllocationCallbacks *alloc,
59 struct vn_image **out_img)
60 {
61 return VK_ERROR_OUT_OF_HOST_MEMORY;
62 }
63
64 static inline VkResult
vn_wsi_create_image_from_swapchain(struct vn_device * dev,const VkImageCreateInfo * create_info,const VkImageSwapchainCreateInfoKHR * swapchain_info,const VkAllocationCallbacks * alloc,struct vn_image ** out_img)65 vn_wsi_create_image_from_swapchain(
66 struct vn_device *dev,
67 const VkImageCreateInfo *create_info,
68 const VkImageSwapchainCreateInfoKHR *swapchain_info,
69 const VkAllocationCallbacks *alloc,
70 struct vn_image **out_img)
71 {
72 return VK_ERROR_OUT_OF_HOST_MEMORY;
73 }
74
75 #endif /* VN_USE_WSI_PLATFORM */
76
77 #endif /* VN_WSI_H */
78