Fix up swapchain creation

Things are working again.
This commit is contained in:
Bill Currie 2019-07-12 14:09:12 +09:00
parent 66e7336b62
commit b2e12d701b
2 changed files with 14 additions and 3 deletions

View file

@ -94,10 +94,10 @@ DEVICE_LEVEL_VULKAN_FUNCTION (vkGetDeviceQueue)
#endif
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateSwapchainKHR, VK_KHR_SURFACE_EXTENSION_NAME)
(vkCreateSwapchainKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkDestroySwapchainKHR, VK_KHR_SURFACE_EXTENSION_NAME)
(vkDestroySwapchainKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetSwapchainImagesKHR, VK_KHR_SURFACE_EXTENSION_NAME)
(vkGetSwapchainImagesKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
#undef DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION

View file

@ -51,6 +51,7 @@
#include "QF/Vulkan/qf_vid.h"
#include "QF/Vulkan/device.h"
#include "QF/Vulkan/instance.h"
#include "QF/Vulkan/swapchain.h"
#include "compat.h"
#include "d_iface.h"
@ -129,4 +130,14 @@ Vulkan_CreateDevice (vulkan_ctx_t *ctx)
void
Vulkan_CreateSwapchain (vulkan_ctx_t *ctx)
{
VkSwapchainKHR old_swapchain = 0;
if (ctx->swapchain) {
old_swapchain = ctx->swapchain->swapchain;
free (ctx->swapchain);
}
ctx->swapchain = QFV_CreateSwapchain (ctx, old_swapchain);
if (ctx->swapchain->swapchain == old_swapchain) {
ctx->device->funcs->vkDestroySwapchainKHR (ctx->device->dev,
old_swapchain, 0);
}
}