From 1f4a37f8eba586bf9a12f41bbfcc0e9ae5d59249 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 9 Dec 2023 01:43:59 +1000 Subject: [PATCH] VulkanDevice: Fix crash on SW renderer switch --- src/util/vulkan_texture.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/vulkan_texture.cpp b/src/util/vulkan_texture.cpp index b50c3fa48..3c032b1e5 100644 --- a/src/util/vulkan_texture.cpp +++ b/src/util/vulkan_texture.cpp @@ -221,10 +221,12 @@ VkImageLayout VulkanTexture::GetVkLayout() const VkCommandBuffer VulkanTexture::GetCommandBufferForUpdate() { VulkanDevice& dev = VulkanDevice::GetInstance(); - if (m_type != Type::Texture || m_use_fence_counter == dev.GetCurrentFenceCounter()) + if ((m_type != Type::Texture && m_type != Type::DynamicTexture) || + m_use_fence_counter == dev.GetCurrentFenceCounter()) { // Console.WriteLn("Texture update within frame, can't use do beforehand"); - dev.EndRenderPass(); + if (dev.InRenderPass()) + dev.EndRenderPass(); return dev.GetCurrentCommandBuffer(); }