Repository: libsdl-org/SDL
File: src/gpu/vulkan/SDL_gpu_vulkan.c (C)

Code before:
                renderer->instance,
                NULL, // FIXME: VAllocationCallbacks
                &windowData->surface)) {
            SET_STRING_ERROR_AND_RETURN("Failed to recreate Vulkan surface!", false);
        }
    }

    // If window data marked as needing swapchain recreate, try to recreate
    if (windowData->needsSwapchainRecreate) {
        Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
        if (!recreateSwapchainResult) {
            return false;
        } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) {
            // Edge case, texture is filled in with NULL but not an error
            if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
                VULKAN_ReleaseFence(
                    (SDL_GPURenderer *)renderer,
                    windowData->inFlightFences[windowData->frameCounter]);
                windowData->inFlightFences[windowData->frameCounter] = NULL;
            }
            return true;
        }

#ifdef SDL_PLATFORM_ANDROID
        windowData->needsSurfaceRecreate = false;
#endif
    }

    if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
        if (block) {
            // If we are blocking, just wait for the fence!
            if (!VULKAN_WaitForFences(
                (SDL_GPURenderer *)renderer,
                true,
                &windowData->inFlightFences[windowData->frameCounter],
                1)) {
                return false;
            }
        } else {
            // If we are not blocking and the least recent fence is not signaled,
            // return true to indicate that there is no error but rendering should be skipped.
            if (!VULKAN_QueryFence(
                    (SDL_GPURenderer *)renderer,
                    windowData->inFlightFences[windowData->frameCounter])) {
                return true;
            }
        }

        VULKAN_ReleaseFence(
            (SDL_GPURenderer *)renderer,
            windowData->inFlightFences[windowData->frameCounter]);

Review comment (suggestion):
```suggestion
        windowData->needsSurfaceRecreate = false;
```

Code after:
                &windowData->surface)) {
            SET_STRING_ERROR_AND_RETURN("Failed to recreate Vulkan surface!", false);
        }
    }

    // If window data marked as needing swapchain recreate, try to recreate
    if (windowData->needsSwapchainRecreate) {
        Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
        if (!recreateSwapchainResult) {
            return false;
        } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) {
            // Edge case, texture is filled in with NULL but not an error
            if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
                VULKAN_ReleaseFence(
                    (SDL_GPURenderer *)renderer,
                    windowData->inFlightFences[windowData->frameCounter]);
                windowData->inFlightFences[windowData->frameCounter] = NULL;
            }
            return true;
        }

        // Unset this flag until after the swapchain has been recreated to let VULKAN_INTERNAL_CreateSwapchain()
        // know whether it needs to pass the old swapchain or not.
        windowData->needsSurfaceRecreate = false;
    }

    if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
        if (block) {
            // If we are blocking, just wait for the fence!
            if (!VULKAN_WaitForFences(
                (SDL_GPURenderer *)renderer,
                true,
                &windowData->inFlightFences[windowData->frameCounter],
                1)) {
                return false;
            }
        } else {
            // If we are not blocking and the least recent fence is not signaled,
            // return true to indicate that there is no error but rendering should be skipped.
            if (!VULKAN_QueryFence(
                    (SDL_GPURenderer *)renderer,
                    windowData->inFlightFences[windowData->frameCounter])) {
                return true;
            }
        }

        VULKAN_ReleaseFence(
            (SDL_GPURenderer *)renderer,
            windowData->inFlightFences[windowData->frameCounter]);

        windowData->inFlightFences[windowData->frameCounter] = NULL;