3 * Copyright (c) 2019 Arm Limited.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to
9 * deal in the Software without restriction, including without limitation the
10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * @brief Contains the factory methods for obtaining the specific surface and swapchain implementations.
32 #include "swapchain_base.hpp"
33 #include "surface_properties.hpp"
34 #include <layer/private_data.hpp>
40 * Obtains the surface properties for the specific surface type.
42 * @param surface The surface for which to get the properties.
44 * @return nullptr if surface type is unsupported.
46 surface_properties *get_surface_properties(VkSurfaceKHR surface);
49 * Allocates a surface specific swapchain.
51 * @param surface The surface for which a swapchain is allocated.
52 * @param dev_data The device specific data.
53 * @param pAllocator The allocator from which to allocate any memory.
55 * @return nullptr on failure.
57 swapchain_base *allocate_surface_swapchain(VkSurfaceKHR surface, layer::device_private_data &dev_data,
58 const VkAllocationCallbacks *pAllocator);
61 * Destroys a swapchain and frees memory. Used with @ref allocate_surface_swapchain.
63 * @param swapchain Pointer to the swapchain to destroy.
64 * @param pAllocator The allocator to use for freeing memory.
66 void destroy_surface_swapchain(swapchain_base *swapchain, const VkAllocationCallbacks *pAllocator);