OSDN Git Service

anv/pipeline: Add support for caching the push constant map
[android-x86/external-mesa.git] / src / intel / vulkan / anv_wsi.h
1 /*
2  * Copyright © 2015 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23
24 #pragma once
25
26 #include "anv_private.h"
27
28 struct anv_swapchain;
29
30 struct anv_wsi_interface {
31    VkResult (*get_support)(VkIcdSurfaceBase *surface,
32                            struct anv_physical_device *device,
33                            uint32_t queueFamilyIndex,
34                            VkBool32* pSupported);
35    VkResult (*get_capabilities)(VkIcdSurfaceBase *surface,
36                                 struct anv_physical_device *device,
37                                 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
38    VkResult (*get_formats)(VkIcdSurfaceBase *surface,
39                            struct anv_physical_device *device,
40                            uint32_t* pSurfaceFormatCount,
41                            VkSurfaceFormatKHR* pSurfaceFormats);
42    VkResult (*get_present_modes)(VkIcdSurfaceBase *surface,
43                                  struct anv_physical_device *device,
44                                  uint32_t* pPresentModeCount,
45                                  VkPresentModeKHR* pPresentModes);
46    VkResult (*create_swapchain)(VkIcdSurfaceBase *surface,
47                                 struct anv_device *device,
48                                 const VkSwapchainCreateInfoKHR* pCreateInfo,
49                                 const VkAllocationCallbacks* pAllocator,
50                                 struct anv_swapchain **swapchain);
51 };
52
53 struct anv_swapchain {
54    struct anv_device *device;
55
56    VkAllocationCallbacks alloc;
57
58    VkFence fences[3];
59
60    VkResult (*destroy)(struct anv_swapchain *swapchain,
61                        const VkAllocationCallbacks *pAllocator);
62    VkResult (*get_images)(struct anv_swapchain *swapchain,
63                           uint32_t *pCount, VkImage *pSwapchainImages);
64    VkResult (*acquire_next_image)(struct anv_swapchain *swap_chain,
65                                   uint64_t timeout, VkSemaphore semaphore,
66                                   uint32_t *image_index);
67    VkResult (*queue_present)(struct anv_swapchain *swap_chain,
68                              struct anv_queue *queue,
69                              uint32_t image_index);
70 };
71
72 ANV_DEFINE_NONDISP_HANDLE_CASTS(_VkIcdSurfaceBase, VkSurfaceKHR)
73 ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_swapchain, VkSwapchainKHR)
74
75 VkResult anv_x11_init_wsi(struct anv_physical_device *physical_device);
76 void anv_x11_finish_wsi(struct anv_physical_device *physical_device);
77 VkResult anv_wl_init_wsi(struct anv_physical_device *physical_device);
78 void anv_wl_finish_wsi(struct anv_physical_device *physical_device);