diff --git a/src/core/gpu_hw_vulkan.cpp b/src/core/gpu_hw_vulkan.cpp index e22e86e69..62fbb7389 100644 --- a/src/core/gpu_hw_vulkan.cpp +++ b/src/core/gpu_hw_vulkan.cpp @@ -172,6 +172,9 @@ void GPU_HW_Vulkan::ResetGraphicsAPIState() GPU_HW::ResetGraphicsAPIState(); EndRenderPass(); + + if (m_host_display->GetDisplayTextureHandle() == &m_vram_texture) + m_vram_texture.TransitionToLayout(g_vulkan_context->GetCurrentCommandBuffer(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } void GPU_HW_Vulkan::RestoreGraphicsAPIState() @@ -1300,8 +1303,6 @@ void GPU_HW_Vulkan::UpdateDisplay() } else { - m_vram_texture.TransitionToLayout(g_vulkan_context->GetCurrentCommandBuffer(), - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); m_host_display->SetDisplayTexture(&m_vram_texture, HostDisplayPixelFormat::RGBA8, m_vram_texture.GetWidth(), m_vram_texture.GetHeight(), 0, 0, m_vram_texture.GetWidth(), m_vram_texture.GetHeight()); @@ -1337,8 +1338,6 @@ void GPU_HW_Vulkan::UpdateDisplay() } else { - m_vram_texture.TransitionToLayout(g_vulkan_context->GetCurrentCommandBuffer(), - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); m_host_display->SetDisplayTexture(&m_vram_texture, HostDisplayPixelFormat::RGBA8, m_vram_texture.GetWidth(), m_vram_texture.GetHeight(), scaled_vram_offset_x, scaled_vram_offset_y, scaled_display_width, scaled_display_height); diff --git a/src/core/host_display.h b/src/core/host_display.h index 4013586d0..69a285317 100644 --- a/src/core/host_display.h +++ b/src/core/host_display.h @@ -115,6 +115,7 @@ public: virtual bool UpdateImGuiFontTexture() = 0; #endif + const void* GetDisplayTextureHandle() const { return m_display_texture_handle; } const s32 GetDisplayTopMargin() const { return m_display_top_margin; } const s32 GetDisplayWidth() const { return m_display_width; } const s32 GetDisplayHeight() const { return m_display_height; }