1
0
mirror of https://github.com/libretro/RetroArch synced 2025-04-03 01:21:10 +00:00

Start implementing more WSI variants

This commit is contained in:
twinaphex 2016-02-19 12:15:16 +01:00
parent 353c421a5c
commit db074e1c1a

@ -66,6 +66,9 @@ typedef struct gfx_ctx_vulkan_data
PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR; PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR; PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR;
PFN_vkQueuePresentKHR fpQueuePresentKHR; PFN_vkQueuePresentKHR fpQueuePresentKHR;
#ifdef _WIN32
PFN_vkCreateWin32SurfaceKHR fpCreateWin32SurfaceKHR;
#endif
#ifdef ANDROID #ifdef ANDROID
PFN_vkCreateAndroidSurfaceKHR fpCreateAndroidSurfaceKHR; PFN_vkCreateAndroidSurfaceKHR fpCreateAndroidSurfaceKHR;
#endif #endif
@ -622,6 +625,12 @@ static bool vulkan_init_context(gfx_ctx_vulkan_data_t *vk,
#ifdef ANDROID #ifdef ANDROID
VK_GET_INSTANCE_PROC_ADDR(vk, VK_GET_INSTANCE_PROC_ADDR(vk,
vk->context.instance, CreateAndroidSurfaceKHR); vk->context.instance, CreateAndroidSurfaceKHR);
#endif
break;
case VULKAN_WSI_WIN32:
#ifdef _WIN32
VK_GET_INSTANCE_PROC_ADDR(vk,
vk->context.instance, CreateWin32SurfaceKHR);
#endif #endif
break; break;
case VULKAN_WSI_NONE: case VULKAN_WSI_NONE:
@ -979,6 +988,29 @@ static bool vulkan_surface_create(gfx_ctx_vulkan_data_t *vk,
return true; return true;
#else #else
break; break;
#endif
case VULKAN_WSI_WIN32:
#ifdef _WIN32
{
VkWin32SurfaceCreateInfoKHR surf_info;
memset(&surf_info, 0, sizeof(VkWin32SurfaceCreateInfoKHR));
surf_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
surf_info.flags = 0;
surf_info.hinstance = display;
surf_info.hwnd = surface;
if (vk->fpCreateWin32SurfaceKHR(vk->context.instance,
&surf_info, NULL, &vk->vk_surface) != VK_SUCCESS)
return false;
if (!vulkan_create_swapchain(
vk, width, height, swap_interval))
return false;
}
#else
break;
#endif #endif
case VULKAN_WSI_NONE: case VULKAN_WSI_NONE:
default: default: