| 1 |
/* |
| 2 |
* Copyright (c) 2025 The Khronos Group Inc. |
| 3 |
* Copyright (c) 2025 Valve Corporation |
| 4 |
* Copyright (c) 2025 LunarG, Inc. |
| 5 |
* |
| 6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 |
* of this software and/or associated documentation files (the "Materials"), to |
| 8 |
* deal in the Materials without restriction, including without limitation the |
| 9 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 |
* sell copies of the Materials, and to permit persons to whom the Materials are |
| 11 |
* furnished to do so, subject to the following conditions: |
| 12 |
* |
| 13 |
* The above copyright notice(s) and this permission notice shall be included in |
| 14 |
* all copies or substantial portions of the Materials. |
| 15 |
* |
| 16 |
* THE MATERIALS ARE 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. |
| 19 |
* |
| 20 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 21 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 23 |
* USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
#include "platform_wsi.h" |
| 28 |
|
| 29 |
#include "equality_helpers.h" |
| 30 |
|
| 31 |
const char* get_platform_wsi_extension([[maybe_unused]] const char* api_selection) { |
| 32 |
#if defined(VK_USE_PLATFORM_ANDROID_KHR) |
| 33 |
return "VK_KHR_android_surface"; |
| 34 |
#elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) |
| 35 |
return "VK_EXT_directfb_surface"; |
| 36 |
#elif defined(VK_USE_PLATFORM_FUCHSIA) |
| 37 |
return "VK_FUCHSIA_imagepipe_surface"; |
| 38 |
#elif defined(VK_USE_PLATFORM_GGP) |
| 39 |
return "VK_GGP_stream_descriptor_surface"; |
| 40 |
#elif defined(VK_USE_PLATFORM_IOS_MVK) |
| 41 |
return "VK_MVK_ios_surface"; |
| 42 |
#elif defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) |
| 43 |
#if defined(VK_USE_PLATFORM_MACOS_MVK) |
| 44 |
if (string_eq(api_selection, "VK_USE_PLATFORM_MACOS_MVK")) return "VK_MVK_macos_surface"; |
| 45 |
#endif |
| 46 |
#if defined(VK_USE_PLATFORM_METAL_EXT) |
| 47 |
if (string_eq(api_selection, "VK_USE_PLATFORM_METAL_EXT")) return "VK_EXT_metal_surface"; |
| 48 |
return "VK_EXT_metal_surface"; |
| 49 |
#endif |
| 50 |
#elif defined(VK_USE_PLATFORM_SCREEN_QNX) |
| 51 |
return "VK_QNX_screen_surface"; |
| 52 |
#elif defined(VK_USE_PLATFORM_VI_NN) |
| 53 |
return "VK_NN_vi_surface"; |
| 54 |
#elif defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WAYLAND_KHR) |
| 55 |
#if defined(VK_USE_PLATFORM_XCB_KHR) |
| 56 |
if (string_eq(api_selection, "VK_USE_PLATFORM_XCB_KHR")) return "VK_KHR_xcb_surface"; |
| 57 |
#endif |
| 58 |
#if defined(VK_USE_PLATFORM_XLIB_KHR) |
| 59 |
if (string_eq(api_selection, "VK_USE_PLATFORM_XLIB_KHR")) return "VK_KHR_xlib_surface"; |
| 60 |
#endif |
| 61 |
#if defined(VK_USE_PLATFORM_WAYLAND_KHR) |
| 62 |
if (string_eq(api_selection, "VK_USE_PLATFORM_WAYLAND_KHR")) return "VK_KHR_wayland_surface"; |
| 63 |
#endif |
| 64 |
#if defined(VK_USE_PLATFORM_XCB_KHR) |
| 65 |
return "VK_KHR_xcb_surface"; |
| 66 |
#endif |
| 67 |
#elif defined(VK_USE_PLATFORM_WIN32_KHR) |
| 68 |
return "VK_KHR_win32_surface"; |
| 69 |
#else |
| 70 |
return "VK_KHR_display"; |
| 71 |
#endif |
| 72 |
} |