mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user