1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef LIBVULKAN_SWAPCHAIN_H 16 #define LIBVULKAN_SWAPCHAIN_H 1 17 18 #include <vulkan/vulkan.h> 19 #include "driver.h" 20 21 namespace vulkan { 22 namespace driver { 23 const VkAllocationCallbacks& GetDefaultAllocator(); 24 VKAPI_ATTR VkResult CreateOHOSSurfaceOpenHarmony(VkInstance instance, 25 const VkOHOSSurfaceCreateInfoOpenHarmony* pCreateInfo, 26 const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); 27 VKAPI_ATTR void DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* allocator); 28 VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice pdev, 29 uint32_t queue_family, VkSurfaceKHR surface, VkBool32* pSupported); 30 VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice pdev, VkSurfaceKHR surface, 31 VkSurfaceCapabilitiesKHR* capabilities); 32 VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev, 33 VkSurfaceKHR surface_handle, uint32_t* count, VkSurfaceFormatKHR* formats); 34 VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice pdev, 35 VkSurfaceKHR surface, uint32_t* count, VkPresentModeKHR* modes); 36 VKAPI_ATTR VkResult GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain_handle, 37 uint32_t* count, VkImage* images); 38 VKAPI_ATTR VkResult CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* create_info, 39 const VkAllocationCallbacks* allocator, VkSwapchainKHR* swapchain_handle); 40 VKAPI_ATTR void DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain_handle, 41 const VkAllocationCallbacks* allocator); 42 VKAPI_ATTR VkResult AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain_handle, 43 uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* image_index); 44 VKAPI_ATTR VkResult AcquireNextImage2KHR(VkDevice device, 45 const VkAcquireNextImageInfoKHR* pAcquireInfo, uint32_t* pImageIndex); 46 47 VKAPI_ATTR VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info); 48 } // namespace driver 49 } // namespace vulkan 50 51 #endif // LIBVULKAN_SWAPCHAIN_H 52