win-capture/graphics-hook: Fix reacquire bug

Sometimes the width/height would initially be at 0x0 when the swap chain
was alt-tabbing, causing the capture to fail full-stop when trying to
reacquire.
master
jp9000 2020-03-09 02:46:22 -07:00
parent e9b41e5fc5
commit 229f8d37cb
1 changed files with 6 additions and 1 deletions

View File

@ -935,6 +935,11 @@ static inline HWND get_swap_window(struct vk_swap_data *swap)
return NULL;
}
static inline bool valid_rect(struct vk_swap_data *swap)
{
return !!swap->image_extent.width && !!swap->image_extent.height;
}
static void vk_capture(struct vk_data *data, VkQueue queue,
const VkPresentInfoKHR *info)
{
@ -965,7 +970,7 @@ static void vk_capture(struct vk_data *data, VkQueue queue,
vk_shtex_free(data);
}
if (capture_should_init()) {
if (!vk_shtex_init(data, window, swap)) {
if (valid_rect(swap) && !vk_shtex_init(data, window, swap)) {
vk_shtex_free(data);
data->valid = false;
}