rsx: implement android swapchain

This commit is contained in:
DH 2025-02-28 21:22:32 +03:00 committed by Megamouse
parent 7520c09087
commit cac068dad9
4 changed files with 18 additions and 4 deletions

View file

@ -4,6 +4,8 @@
#define VK_USE_PLATFORM_WIN32_KHR
#elif defined(__APPLE__)
#define VK_USE_PLATFORM_MACOS_MVK
#elif defined(ANDROID)
#define VK_USE_PLATFORM_ANDROID_KHR
#elif HAVE_X11
#define VK_USE_PLATFORM_XLIB_KHR
#endif

View file

@ -181,6 +181,13 @@ namespace vk
found_surface_ext = true;
}
#endif //(WAYLAND)
#ifdef VK_USE_PLATFORM_ANDROID_KHR
if (support.is_supported(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME))
{
extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
found_surface_ext = true;
}
#endif
if (!found_surface_ext)
{
rsx_log.error("Could not find a supported Vulkan surface extension");

View file

@ -8,12 +8,17 @@ namespace vk
using swapchain_ANDROID = native_swapchain_base;
using swapchain_NATIVE = swapchain_ANDROID;
// TODO: Implement this
[[maybe_unused]] static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* /*config*/)
{
return VK_NULL_HANDLE;
VkSurfaceKHR result = VK_NULL_HANDLE;
VkWin32SurfaceCreateInfoKHR createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
createInfo.window = std::get<ANativeWindow *>(window_handle);
CHECK_RESULT(vkCreateAndroidSurfaceKHR(this->m_instance, &createInfo, nullptr, &result));
return result;
}
#endif
}

View file

@ -29,7 +29,7 @@ using display_handle_t = std::variant<
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
std::pair<wl_display*, wl_surface*>
#elif defined(ANDROID)
void *
struct ANativeWindow *
#endif
>;
#endif