Commit c7da2450 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winevulkan: Introduce a new get_host_surface_extension driver entry.

parent 5db24dbb
......@@ -361,6 +361,11 @@ static VkResult macdrv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
return res;
}
static const char *macdrv_get_host_surface_extension(void)
{
return pvkCreateMetalSurfaceEXT ? "VK_EXT_metal_surface" : "VK_MVK_macos_surface";
}
static VkSurfaceKHR macdrv_wine_get_host_surface(VkSurfaceKHR surface)
{
struct wine_vk_surface *mac_surface = surface_from_handle(surface);
......@@ -384,6 +389,7 @@ static const struct vulkan_funcs vulkan_funcs =
macdrv_vkGetSwapchainImagesKHR,
macdrv_vkQueuePresentKHR,
macdrv_get_host_surface_extension,
macdrv_wine_get_host_surface,
};
......
......@@ -571,6 +571,7 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context *
{
VkDebugUtilsMessengerCreateInfoEXT *debug_utils_messenger;
VkDebugReportCallbackCreateInfoEXT *debug_report_callback;
const char **new_extensions;
VkBaseInStructure *header;
unsigned int i;
......@@ -614,39 +615,46 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context *
return VK_ERROR_LAYER_NOT_PRESENT;
}
TRACE("Enabled %u instance extensions.\n", dst->enabledExtensionCount);
for (i = 0; i < dst->enabledExtensionCount; i++)
for (i = 0; i < src->enabledExtensionCount; i++)
{
const char *extension_name = dst->ppEnabledExtensionNames[i];
const char *extension_name = src->ppEnabledExtensionNames[i];
TRACE("Extension %u: %s.\n", i, debugstr_a(extension_name));
if (!wine_vk_instance_extension_supported(extension_name))
{
WARN("Extension %s is not supported.\n", debugstr_a(extension_name));
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
}
new_extensions = conversion_context_alloc(ctx, (src->enabledExtensionCount + 2) *
sizeof(*src->ppEnabledExtensionNames));
memcpy(new_extensions, src->ppEnabledExtensionNames,
dst->enabledExtensionCount * sizeof(*dst->ppEnabledExtensionNames));
dst->ppEnabledExtensionNames = new_extensions;
dst->enabledExtensionCount = src->enabledExtensionCount;
for (i = 0; i < dst->enabledExtensionCount; i++)
{
const char *extension_name = dst->ppEnabledExtensionNames[i];
if (!strcmp(extension_name, "VK_EXT_debug_utils") || !strcmp(extension_name, "VK_EXT_debug_report"))
{
object->enable_wrapper_list = VK_TRUE;
}
if (!strcmp(extension_name, "VK_KHR_win32_surface"))
{
new_extensions[i] = vk_funcs->p_get_host_surface_extension();
object->enable_win32_surface = VK_TRUE;
}
}
if (use_external_memory())
{
const char **new_extensions;
new_extensions = conversion_context_alloc(ctx, (dst->enabledExtensionCount + 2) *
sizeof(*dst->ppEnabledExtensionNames));
memcpy(new_extensions, src->ppEnabledExtensionNames,
dst->enabledExtensionCount * sizeof(*dst->ppEnabledExtensionNames));
new_extensions[dst->enabledExtensionCount++] = "VK_KHR_get_physical_device_properties2";
new_extensions[dst->enabledExtensionCount++] = "VK_KHR_external_memory_capabilities";
dst->ppEnabledExtensionNames = new_extensions;
}
TRACE("Enabled %u instance extensions.\n", dst->enabledExtensionCount);
return VK_SUCCESS;
}
......
......@@ -469,6 +469,11 @@ static VkResult wayland_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR
return check_queue_present(present_info, res);
}
static const char *wayland_get_host_surface_extension(void)
{
return "VK_KHR_wayland_surface";
}
static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface)
{
return wine_vk_surface_from_handle(surface)->host_surface;
......@@ -485,6 +490,7 @@ static const struct vulkan_funcs vulkan_funcs =
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR,
.p_vkGetSwapchainImagesKHR = wayland_vkGetSwapchainImagesKHR,
.p_vkQueuePresentKHR = wayland_vkQueuePresentKHR,
.p_get_host_surface_extension = wayland_get_host_surface_extension,
.p_wine_get_host_surface = wayland_wine_get_host_surface,
};
......
......@@ -396,6 +396,11 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
return res;
}
static const char *X11DRV_get_host_surface_extension(void)
{
return "VK_KHR_xlib_surface";
}
static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface )
{
struct wine_vk_surface *x11_surface = surface_from_handle(surface);
......@@ -419,6 +424,7 @@ static const struct vulkan_funcs vulkan_funcs =
X11DRV_vkGetSwapchainImagesKHR,
X11DRV_vkQueuePresentKHR,
X11DRV_get_host_surface_extension,
X11DRV_wine_get_host_surface,
};
......
......@@ -42,6 +42,7 @@ struct vulkan_funcs
VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *);
/* winevulkan specific functions */
const char *(*p_get_host_surface_extension)(void);
VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment