From c437de9721485c29b241a8c635496696901cf658 Mon Sep 17 00:00:00 2001 From: nmzik Date: Wed, 23 Sep 2026 18:02:42 +0400 Subject: [PATCH] Presenter: avoid lock --- src/graphics/presentation/window/swapchain.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/graphics/presentation/window/swapchain.cpp b/src/graphics/presentation/window/swapchain.cpp index 3fb2b78e8..dff7470c9 100644 --- a/src/graphics/presentation/window/swapchain.cpp +++ b/src/graphics/presentation/window/swapchain.cpp @@ -171,6 +171,13 @@ void Presenter::Frame::Configure(GraphicContext& graphics, vk::Extent2D extent, EXIT("unsupported prepared frame, extent=%ux%u format=%d\n", extent.width, extent.height, static_cast(format)); } + auto& dst = image; + const bool compatible = dst.image != nullptr && dst.extent.width == extent.width && + dst.extent.height == extent.height && dst.format == format; + if (compatible) { + return; + } + const auto features = graphics.GetFormatProperties(format).optimalTilingFeatures; const auto required = vk::FormatFeatureFlagBits::eBlitSrc | vk::FormatFeatureFlagBits::eSampledImageFilterLinear | @@ -180,12 +187,6 @@ void Presenter::Frame::Configure(GraphicContext& graphics, vk::Extent2D extent, static_cast(format), static_cast(features)); } - auto& dst = image; - const bool compatible = dst.image != nullptr && dst.extent.width == extent.width && - dst.extent.height == extent.height && dst.format == format; - if (compatible) { - return; - } if (dst.image != nullptr) { graphics.DeleteImage(dst); }