win-capture: Handle vkCreateSwapchainKHR errors
Fixes behavior for an application reported by AMD.master
parent
95a920d7ee
commit
421f97e68d
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#define HOOK_VER_MAJOR 1
|
#define HOOK_VER_MAJOR 1
|
||||||
#define HOOK_VER_MINOR 1
|
#define HOOK_VER_MINOR 1
|
||||||
#define HOOK_VER_PATCH 1
|
#define HOOK_VER_PATCH 2
|
||||||
|
|
||||||
#define STRINGIFY(s) #s
|
#define STRINGIFY(s) #s
|
||||||
#define MAKE_VERSION_NAME(major, minor, patch) \
|
#define MAKE_VERSION_NAME(major, minor, patch) \
|
||||||
|
|
|
@ -1308,22 +1308,20 @@ OBS_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *cinfo,
|
||||||
struct vk_data *data = get_device_data(device);
|
struct vk_data *data = get_device_data(device);
|
||||||
struct vk_device_funcs *funcs = &data->funcs;
|
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;
|
VkSwapchainCreateInfoKHR info = *cinfo;
|
||||||
info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||||
|
|
||||||
VkResult res = funcs->CreateSwapchainKHR(device, &info, ac, p_sc);
|
VkResult res = funcs->CreateSwapchainKHR(device, &info, ac, p_sc);
|
||||||
|
debug_res("CreateSwapchainKHR", res);
|
||||||
|
if (res != VK_SUCCESS)
|
||||||
|
return res;
|
||||||
VkSwapchainKHR sc = *p_sc;
|
VkSwapchainKHR sc = *p_sc;
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count, NULL);
|
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count, NULL);
|
||||||
debug_res("GetSwapchainImagesKHR", res);
|
debug_res("GetSwapchainImagesKHR", res);
|
||||||
|
|
||||||
|
struct vk_swap_data *swap = get_new_swap_data(data);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (count > OBJ_MAX)
|
if (count > OBJ_MAX)
|
||||||
count = OBJ_MAX;
|
count = OBJ_MAX;
|
||||||
|
@ -1331,11 +1329,15 @@ OBS_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *cinfo,
|
||||||
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count,
|
res = funcs->GetSwapchainImagesKHR(data->device, sc, &count,
|
||||||
swap->swap_images);
|
swap->swap_images);
|
||||||
debug_res("GetSwapchainImagesKHR", res);
|
debug_res("GetSwapchainImagesKHR", res);
|
||||||
swap->image_count = count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
swap->sc = sc;
|
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,
|
static void VKAPI OBS_DestroySwapchainKHR(VkDevice device, VkSwapchainKHR sc,
|
||||||
|
|
Loading…
Reference in New Issue