• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 static inline const struct wsi_image_create_info *
vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo * create_info)27 vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
28 {
29    return vk_find_struct_const(create_info->pNext,
30                                WSI_IMAGE_CREATE_INFO_MESA);
31 }
32 
33 VkResult
34 vn_wsi_create_image(struct vn_device *dev,
35                     const VkImageCreateInfo *create_info,
36                     const struct wsi_image_create_info *wsi_info,
37                     const VkAllocationCallbacks *alloc,
38                     struct vn_image **out_img);
39 
40 VkResult
41 vn_wsi_create_image_from_swapchain(
42    struct vn_device *dev,
43    const VkImageCreateInfo *create_info,
44    const VkImageSwapchainCreateInfoKHR *swapchain_info,
45    const VkAllocationCallbacks *alloc,
46    struct vn_image **out_img);
47 
48 #else
49 
50 static inline VkResult
vn_wsi_init(UNUSED struct vn_physical_device * physical_dev)51 vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
52 {
53    return VK_SUCCESS;
54 }
55 
56 static inline void
vn_wsi_fini(UNUSED struct vn_physical_device * physical_dev)57 vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
58 {
59 }
60 
61 static inline const struct wsi_image_create_info *
vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo * create_info)62 vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
63 {
64    return NULL;
65 }
66 
67 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)68 vn_wsi_create_image(struct vn_device *dev,
69                     const VkImageCreateInfo *create_info,
70                     const struct wsi_image_create_info *wsi_info,
71                     const VkAllocationCallbacks *alloc,
72                     struct vn_image **out_img)
73 {
74    return VK_ERROR_OUT_OF_HOST_MEMORY;
75 }
76 
77 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)78 vn_wsi_create_image_from_swapchain(
79    struct vn_device *dev,
80    const VkImageCreateInfo *create_info,
81    const VkImageSwapchainCreateInfoKHR *swapchain_info,
82    const VkAllocationCallbacks *alloc,
83    struct vn_image **out_img)
84 {
85    return VK_ERROR_OUT_OF_HOST_MEMORY;
86 }
87 
88 #endif /* VN_USE_WSI_PLATFORM */
89 
90 #endif /* VN_WSI_H */
91