### Godot version

master [75f9c97deaa8378477441e07ea1782ecab6d2eca]

### System information

Godot v4.2.dev (262d1eaa6) - 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

I get SSIL spams in the log with:

```
ERROR: VALIDATION - Message Id Number: -564812795 | Message Id Name: VUID-VkDescriptorImageInfo-imageLayout-00344
	Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0xdc9e5a0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | vkCmdDispatch: Cannot use VkImage 0xc3e06d00000048ea[RenderBuffer render_buffers/depth] (layer=0 mip=0) with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the previous known layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL. The Vulkan spec states: imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed as defined by the image layout matching rules (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_COMMAND_BUFFER, Handle 231335328
	Command Buffer Labels - 1
		Label[0] - Downsample Depth{ 1, 1, 1, 1 }
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -439258052 | Message Id Name: VUID-vkCmdDispatch-None-02699
	Validation Error: [ VUID-vkCmdDispatch-None-02699 ] Object 0: handle = 0x22f9750000004c6b, name = RID:572218492846533, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xe5d1743c | Descriptor set VkDescriptorSet 0x22f9750000004c6b[RID:572218492846533] encountered the following validation error at vkCmdDispatch time: Image layout specified at vkUpdateDescriptorSet* or vkCmdPushDescriptorSet* time doesn't match actual image layout at time descriptor is used. See previous error callback for specific details. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkCmdDispatch-None-02699)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_DESCRIPTOR_SET, Handle 2520174109350972523, Name "RID:572218492846533"
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -564812795 | Message Id Name: VUID-VkDescriptorImageInfo-imageLayout-00344
	Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0xd9da440, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | vkCmdDispatch: Cannot use VkImage 0xc3e06d00000048ea[RenderBuffer render_buffers/depth] (layer=0 mip=0) with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the previous known layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL. The Vulkan spec states: imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed as defined by the image layout matching rules (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_COMMAND_BUFFER, Handle 228435008
	Command Buffer Labels - 1
		Label[0] - Downsample Depth{ 1, 1, 1, 1 }
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -439258052 | Message Id Name: VUID-vkCmdDispatch-None-02699
	Validation Error: [ VUID-vkCmdDispatch-None-02699 ] Object 0: handle = 0x22f9750000004c6b, name = RID:572218492846533, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xe5d1743c | Descriptor set VkDescriptorSet 0x22f9750000004c6b[RID:572218492846533] encountered the following validation error at vkCmdDispatch time: Image layout specified at vkUpdateDescriptorSet* or vkCmdPushDescriptorSet* time doesn't match actual image layout at time descriptor is used. See previous error callback for specific details. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkCmdDispatch-None-02699)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_DESCRIPTOR_SET, Handle 2520174109350972523, Name "RID:572218492846533"
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -564812795 | Message Id Name: VUID-VkDescriptorImageInfo-imageLayout-00344
	Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0xdd1e910, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | vkCmdDispatch: Cannot use VkImage 0xc3e06d00000048ea[RenderBuffer render_buffers/depth] (layer=0 mip=0) with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the previous known layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL. The Vulkan spec states: imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed as defined by the image layout matching rules (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_COMMAND_BUFFER, Handle 231860496
	Command Buffer Labels - 1
		Label[0] - Downsample Depth{ 1, 1, 1, 1 }
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -439258052 | Message Id Name: VUID-vkCmdDispatch-None-02699
	Validation Error: [ VUID-vkCmdDispatch-None-02699 ] Object 0: handle = 0x22f9750000004c6b, name = RID:572218492846533, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xe5d1743c | Descriptor set VkDescriptorSet 0x22f9750000004c6b[RID:572218492846533] encountered the following validation error at vkCmdDispatch time: Image layout specified at vkUpdateDescriptorSet* or vkCmdPushDescriptorSet* time doesn't match actual image layout at time descriptor is used. See previous error callback for specific details. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkCmdDispatch-None-02699)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_DESCRIPTOR_SET, Handle 2520174109350972523, Name "RID:572218492846533"
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -564812795 | Message Id Name: VUID-VkDescriptorImageInfo-imageLayout-00344
	Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0xdd13710, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | vkCmdDispatch: Cannot use VkImage 0xc3e06d00000048ea[RenderBuffer render_buffers/depth] (layer=0 mip=0) with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the previous known layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL. The Vulkan spec states: imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed as defined by the image layout matching rules (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_COMMAND_BUFFER, Handle 231814928
	Command Buffer Labels - 1
		Label[0] - Downsample Depth{ 1, 1, 1, 1 }
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -439258052 | Message Id Name: VUID-vkCmdDispatch-None-02699
	Validation Error: [ VUID-vkCmdDispatch-None-02699 ] Object 0: handle = 0x22f9750000004c6b, name = RID:572218492846533, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xe5d1743c | Descriptor set VkDescriptorSet 0x22f9750000004c6b[RID:572218492846533] encountered the following validation error at vkCmdDispatch time: Image layout specified at vkUpdateDescriptorSet* or vkCmdPushDescriptorSet* time doesn't match actual image layout at time descriptor is used. See previous error callback for specific details. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command (https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkCmdDispatch-None-02699)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_DESCRIPTOR_SET, Handle 2520174109350972523, Name "RID:572218492846533"
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
```

### Steps to reproduce

1. Create an empty project
2. Create a WorldEnvironment node
3. Add a custom color background (unknown if this has an effect)
4. Enable SSIL

### Minimal reproduction project

I will handle this bug myself during the weekend. I'm reporting it for tracking purposes.

[EmptyGodotProject.zip](https://github.com/godotengine/godot/files/12224010/EmptyGodotProject.zip)

pipeline = &shader->pipelines[cull_variant][primitive][pipeline_version];
		}
		RD::VertexFormatID vertex_format = -1;
		RID vertex_array_rd;
		RID index_array_rd;
		
		if (surf->owner->mesh_instance.is_valid()) {
			mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(surf->owner->mesh_instance, surf->surface_index, pipeline->get_vertex_input_mask(), vertex_array_rd, vertex_format);
		} else {
			mesh_storage->mesh_surface_get_vertex_arrays_and_format(mesh_surface, pipeline->get_vertex_input_mask(), vertex_array_rd, vertex_format);
		}
		index_array_rd = mesh_storage->mesh_surface_get_index_array(mesh_surface, element_info.lod_index);
		if (prev_vertex_array_rd != vertex_array_rd) {
			RD::get_singleton()->draw_list_bind_vertex_array(draw_list, vertex_array_rd);
			prev_vertex_array_rd = vertex_array_rd;
		}
		if (prev_index_array_rd != index_array_rd) {
			if (index_array_rd.is_valid()) {
				RD::get_singleton()->draw_list_bind_index_array(draw_list, index_array_rd);
			}
			prev_index_array_rd = index_array_rd;
		}
		RID pipeline_rd = pipeline->get_render_pipeline(vertex_format, framebuffer_format, p_params->force_wireframe, 0, pipeline_specialization);
		if (pipeline_rd != prev_pipeline_rd) {
			
			
			RD::get_singleton()->draw_list_bind_render_pipeline(draw_list, pipeline_rd);
			prev_pipeline_rd = pipeline_rd;
		}
		if (xforms_uniform_set.is_valid() && prev_xforms_uniform_set != xforms_uniform_set) {