Fix: Vulkan: Validation error Wayland+NVIDIA

This PR fixes a validation error about the swapchain semaphores. When
swapchain maintenance 1 is supported the semaphores can be reused, but
requires a fence. We didn't implement the fence. This PR doesn't reuse
the semaphores as introducing the fence leads to more changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/141066
This commit is contained in:
Jeroen Bakker
2025-06-27 08:58:37 +02:00
parent a20f367379
commit d67b705d1c

View File

@@ -1075,13 +1075,10 @@ GHOST_TSuccess GHOST_ContextVK::recreateSwapchain()
GHOST_FrameDiscard &discard_pile = m_frame_data[m_render_frame].discard_pile;
for (GHOST_SwapchainImage &swapchain_image : m_swapchain_images) {
swapchain_image.vk_image = VK_NULL_HANDLE;
if (!vulkan_device->use_vk_ext_swapchain_maintenance_1 &&
swapchain_image.present_semaphore != VK_NULL_HANDLE)
{
if (swapchain_image.present_semaphore != VK_NULL_HANDLE) {
discard_pile.semaphores.push_back(swapchain_image.present_semaphore);
swapchain_image.present_semaphore = VK_NULL_HANDLE;
}
swapchain_image.vk_image = VK_NULL_HANDLE;
}
m_swapchain_images.resize(actual_image_count);
std::vector<VkImage> swapchain_images(actual_image_count);
@@ -1106,11 +1103,9 @@ GHOST_TSuccess GHOST_ContextVK::recreateSwapchain()
/* Construct new semaphores. It can be that image_count is larger than previously. We only need
* to fill in where the handle is `VK_NULL_HANDLE`. */
/* Previous handles from the frame data cannot be used and should be discarded. */
if (!vulkan_device->use_vk_ext_swapchain_maintenance_1) {
for (GHOST_Frame &frame : m_frame_data) {
discard_pile.semaphores.push_back(frame.acquire_semaphore);
frame.acquire_semaphore = VK_NULL_HANDLE;
}
for (GHOST_Frame &frame : m_frame_data) {
discard_pile.semaphores.push_back(frame.acquire_semaphore);
frame.acquire_semaphore = VK_NULL_HANDLE;
}
if (old_swapchain) {
discard_pile.swapchains.push_back(old_swapchain);