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

Code before:
    }

    // The command buffer is flagged for cleanup when the swapchain is requested as a cleanup timing mechanism
    vulkanCommandBuffer->swapchainRequested = true;

    if (window->flags & SDL_WINDOW_HIDDEN) {
        // Edge case, texture is filled in with NULL but not an error
        return true;
    }

    if (windowData->needsSurfaceRecreate) {
        SDL_VideoDevice *videoDevice = SDL_GetVideoDevice();
        SDL_assert(videoDevice);
        SDL_assert(videoDevice->Vulkan_CreateSurface);
        renderer->vkDestroySurfaceKHR(
                renderer->instance,
                windowData->surface,
                NULL);
        if (!videoDevice->Vulkan_CreateSurface(
                videoDevice,
                windowData->window,
                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;
        }

        windowData->needsSurfaceRecreate = false;
    }

    if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
        if (block) {
            // If we are blocking, just wait for the fence!
            if (!VULKAN_WaitForFences(

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

Code after:
    }

    // The command buffer is flagged for cleanup when the swapchain is requested as a cleanup timing mechanism
    vulkanCommandBuffer->swapchainRequested = true;

    if (window->flags & SDL_WINDOW_HIDDEN) {
        // Edge case, texture is filled in with NULL but not an error
        return true;
    }

    if (windowData->needsSurfaceRecreate) {
        SDL_VideoDevice *videoDevice = SDL_GetVideoDevice();
        SDL_assert(videoDevice);
        SDL_assert(videoDevice->Vulkan_CreateSurface);
        renderer->vkDestroySurfaceKHR(
                renderer->instance,
                windowData->surface,
                NULL);
        if (!videoDevice->Vulkan_CreateSurface(
                videoDevice,
                windowData->window,
                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;
        }

        // 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) {