### Godot version

master [4714e95896c8db02616ea6ec7f9aff92dec1cae4]

### System information

Godot v4.2.dev (4714e9589) - Ubuntu 20.04.6 LTS (Focal Fossa) - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 6800 XT - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

### Issue description

Sometimes when resizing the window on Linux X11 we may get the following validation error:

```
ERROR: VALIDATION - Message Id Number: -370888023 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-01286
	Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0xdcc8fd0000000012, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be currently signaled or in a wait state. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286)
```

I nailed down the problem. In `VulkanContext::prepare_buffers` we have the following loop (I simplified to highlight the problem):

```cpp
do {

err = fpAcquireNextImageKHR(device, w->swapchain, UINT64_MAX,
							w->image_acquired_semaphores[frame_index], VK_NULL_HANDLE, &w->current_buffer);

if (err == VK_SUBOPTIMAL_KHR) {
	// Swapchain is not as optimal as it could be, but the platform's
	// presentation engine will still present the image correctly.
	print_verbose("Vulkan: Early suboptimal swapchain, recreating.");
	Error swap_chain_err = _update_swap_chain(w);
	if (swap_chain_err == ERR_SKIP) {
		break;
	}
} while (err != VK_SUCCESS);
```

The problem is that vkAcquireNextImageKHR returned VK_SUBOPTIMAL_KHR but it already signaled the semaphore (because it is possible to continue normally with a VK_SUBOPTIMAL_KHR result).

Then we recreate the swapchain and reuse the w->image_acquired_semaphores[frame_index] which is in an inconsistent state.

I will handle this bug.

### Steps to reproduce

1. Open the Editor on any project
2. Resize the project until it happens

Reproducibility is much more frequent after applying PR #80566

### Minimal reproduction project

Any.
}
			if (is_device_extension_enabled(VK_KHR_16BIT_STORAGE_EXTENSION_NAME)) {
				storage_buffer_capabilities.storage_buffer_16_bit_access_is_supported = storage_feature.storageBuffer16BitAccess;
				storage_buffer_capabilities.uniform_and_storage_buffer_16_bit_access_is_supported = storage_feature.uniformAndStorageBuffer16BitAccess;
				storage_buffer_capabilities.storage_push_constant_16_is_supported = storage_feature.storagePushConstant16;
				storage_buffer_capabilities.storage_input_output_16 = storage_feature.storageInputOutput16;
			}
		}
		
		PFN_vkGetPhysicalDeviceProperties2 device_properties_func = (PFN_vkGetPhysicalDeviceProperties2)vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2");
		if (device_properties_func == nullptr) {
			
			device_properties_func = (PFN_vkGetPhysicalDeviceProperties2)vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2KHR");
		}
		if (device_properties_func != nullptr) {
			VkPhysicalDeviceFragmentShadingRatePropertiesKHR vrsProperties{};
			VkPhysicalDeviceMultiviewProperties multiviewProperties{};
			VkPhysicalDeviceSubgroupProperties subgroupProperties{};
			VkPhysicalDeviceProperties2 physicalDeviceProperties{};
			void *nextptr = nullptr;
			if (device_api_version >= VK_API_VERSION_1_1) { 
				subgroupProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
				subgroupProperties.pNext = nextptr;
				nextptr = &subgroupProperties;
			}
			if (multiview_capabilities.is_supported) {
				multiviewProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES;
				multiviewProperties.pNext = nextptr;
				nextptr = &multiviewProperties;
			}