win-capture: Handle vkCreateSwapchainKHR errors

Fixes behavior for an application reported by AMD.
master
jpark37 2020-03-10 21:13:03 -07:00
parent 95a920d7ee
commit 421f97e68d
2 changed files with 11 additions and 9 deletions

View File

@ -13,7 +13,7 @@
#define HOOK_VER_MAJOR 1
#define HOOK_VER_MINOR 1
#define HOOK_VER_PATCH 1
#define HOOK_VER_PATCH 2
#define STRINGIFY(s) #s
#define MAKE_VERSION_NAME(major, minor, patch) \

View File

@ -1308,22 +1308,20 @@ OBS_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *cinfo,
struct vk_data *data = get_device_data(device);
struct vk_device_funcs *funcs = &data->funcs;
struct vk_swap_data *swap = get_new_swap_data(data);
swap->surf = cinfo->surface;
swap->image_extent = cinfo->imageExtent;
swap->format = cinfo->imageFormat;
VkSwapchainCreateInfoKHR info = *cinfo;
info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
VkResult res = funcs->CreateSwapchainKHR(device, &info, ac, p_sc);
debug_res("CreateSwapchainKHR", res);
if (res != VK_SUCCESS)
return res;
VkSwapchainKHR sc = *p_sc;
uint32_t count = 0;
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count, NULL);
debug_res("GetSwapchainImagesKHR", res);
struct vk_swap_data *swap = get_new_swap_data(data);
if (count > 0) {
if (count > OBJ_MAX)
count = OBJ_MAX;
@ -1331,11 +1329,15 @@ OBS_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *cinfo,
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count,
swap->swap_images);
debug_res("GetSwapchainImagesKHR", res);
swap->image_count = count;
}
swap->sc = sc;
return res;
swap->image_extent = cinfo->imageExtent;
swap->format = cinfo->imageFormat;
swap->surf = cinfo->surface;
swap->image_count = count;
return VK_SUCCESS;
}
static void VKAPI OBS_DestroySwapchainKHR(VkDevice device, VkSwapchainKHR sc,