Commit 9aeef376 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Implement swapchains for the Vulkan adapter.

parent a8141ef0
......@@ -421,6 +421,7 @@ vulkan_device_extensions[] =
{VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, ~0u},
{VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_API_VERSION_1_1},
{VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_API_VERSION_1_1},
{VK_KHR_SWAPCHAIN_EXTENSION_NAME, ~0u},
};
static bool enable_vulkan_device_extensions(VkPhysicalDevice physical_device, uint32_t *extension_count,
......@@ -1180,7 +1181,7 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
struct wined3d_swapchain *swapchain_vk;
struct wined3d_swapchain_vk *swapchain_vk;
HRESULT hr;
TRACE("device %p, desc %p, parent %p, parent_ops %p, swapchain %p.\n",
......@@ -1197,15 +1198,17 @@ static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct
}
TRACE("Created swapchain %p.\n", swapchain_vk);
*swapchain = swapchain_vk;
*swapchain = &swapchain_vk->s;
return hr;
}
static void adapter_vk_destroy_swapchain(struct wined3d_swapchain *swapchain)
{
wined3d_swapchain_cleanup(swapchain);
heap_free(swapchain);
struct wined3d_swapchain_vk *swapchain_vk = wined3d_swapchain_vk(swapchain);
wined3d_swapchain_vk_cleanup(swapchain_vk);
heap_free(swapchain_vk);
}
unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk *adapter_vk,
......@@ -1827,6 +1830,8 @@ static const struct
vulkan_instance_extensions[] =
{
{VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_API_VERSION_1_1, FALSE},
{VK_KHR_SURFACE_EXTENSION_NAME, ~0u, TRUE},
{VK_KHR_WIN32_SURFACE_EXTENSION_NAME, ~0u, TRUE},
};
static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count,
......
......@@ -5084,7 +5084,29 @@ HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain *swapchain_vk,
struct wined3d_swapchain_vk
{
struct wined3d_swapchain s;
VkSwapchainKHR vk_swapchain;
VkSurfaceKHR vk_surface;
VkImage *vk_images;
struct
{
VkSemaphore available;
VkSemaphore presentable;
uint64_t command_buffer_id;
} *vk_semaphores;
unsigned int current, image_count;
};
static inline struct wined3d_swapchain_vk *wined3d_swapchain_vk(struct wined3d_swapchain *swapchain)
{
return CONTAINING_RECORD(swapchain, struct wined3d_swapchain_vk, s);
}
void wined3d_swapchain_vk_cleanup(struct wined3d_swapchain_vk *swapchain_vk) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain_vk *swapchain_vk,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
......@@ -41,7 +41,15 @@
VK_INSTANCE_PFN(vkGetPhysicalDeviceSparseImageFormatProperties) \
/* Vulkan 1.1 */ \
VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceFeatures2) \
VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceProperties2)
VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceProperties2) \
/* VK_KHR_surface */ \
VK_INSTANCE_PFN(vkDestroySurfaceKHR) \
VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \
VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceFormatsKHR) \
VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfacePresentModesKHR) \
VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceSupportKHR) \
/* VK_KHR_win32_surface */ \
VK_INSTANCE_PFN(vkCreateWin32SurfaceKHR)
#define VK_DEVICE_FUNCS() \
VK_DEVICE_PFN(vkAllocateCommandBuffers) \
......@@ -163,7 +171,13 @@
VK_DEVICE_PFN(vkSetEvent) \
VK_DEVICE_PFN(vkUnmapMemory) \
VK_DEVICE_PFN(vkUpdateDescriptorSets) \
VK_DEVICE_PFN(vkWaitForFences)
VK_DEVICE_PFN(vkWaitForFences) \
/* VK_KHR_swapchain */ \
VK_DEVICE_PFN(vkAcquireNextImageKHR) \
VK_DEVICE_PFN(vkCreateSwapchainKHR) \
VK_DEVICE_PFN(vkDestroySwapchainKHR) \
VK_DEVICE_PFN(vkGetSwapchainImagesKHR) \
VK_DEVICE_PFN(vkQueuePresentKHR)
#define DECLARE_VK_PFN(name) PFN_##name name;
......
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