2 * Copyright (c) 2016-2017, 2019 Arm Limited.
4 * SPDX-License-Identifier: MIT
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #include <wsi/wsi_factory.hpp>
29 #include "private_data.hpp"
30 #include "surface_api.hpp"
36 * @brief Implements vkGetPhysicalDeviceSurfaceCapabilitiesKHR Vulkan entrypoint.
38 VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
39 VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
41 wsi::surface_properties *props = wsi::get_surface_properties(surface);
44 return props->get_surface_capabilities(physicalDevice, surface, pSurfaceCapabilities);
47 return layer::instance_private_data::get(layer::get_key(physicalDevice))
48 .disp.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
52 * @brief Implements vkGetPhysicalDeviceSurfaceFormatsKHR Vulkan entrypoint.
54 VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice,
56 uint32_t *pSurfaceFormatCount,
57 VkSurfaceFormatKHR *pSurfaceFormats)
59 wsi::surface_properties *props = wsi::get_surface_properties(surface);
62 return props->get_surface_formats(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
65 return layer::instance_private_data::get(layer::get_key(physicalDevice))
66 .disp.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
70 * @brief Implements vkGetPhysicalDeviceSurfacePresentModesKHR Vulkan entrypoint.
72 VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
74 uint32_t *pPresentModeCount,
75 VkPresentModeKHR *pPresentModes)
77 wsi::surface_properties *props = wsi::get_surface_properties(surface);
80 return props->get_surface_present_modes(physicalDevice, surface, pPresentModeCount, pPresentModes);
83 return layer::instance_private_data::get(layer::get_key(physicalDevice))
84 .disp.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
88 * @brief Implements vkGetPhysicalDeviceSurfaceSupportKHR Vulkan entrypoint.
90 VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
91 uint32_t queueFamilyIndex, VkSurfaceKHR surface,
94 wsi::surface_properties *props = wsi::get_surface_properties(surface);
95 /* We assume that presentation to surface is supported by default */
98 *pSupported = VK_TRUE;
102 return layer::instance_private_data::get(layer::get_key(physicalDevice))
103 .disp.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);