From 2ef10efb7dfc6913c435932d20a90088bf6ca571 Mon Sep 17 00:00:00 2001 From: FakeMichau <49685661+FakeMichau@users.noreply.github.com> Date: Fri, 1 May 2026 20:05:30 +0200 Subject: [PATCH] Use DelayedDestroy for DX11 and VK upscalers Should speed up upscaler switching for those backends --- OptiScaler/upscalers/FeatureProvider_Dx11.cpp | 10 ++++++---- OptiScaler/upscalers/FeatureProvider_Vk.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/OptiScaler/upscalers/FeatureProvider_Dx11.cpp b/OptiScaler/upscalers/FeatureProvider_Dx11.cpp index ab5fbed7..6bc75b67 100644 --- a/OptiScaler/upscalers/FeatureProvider_Dx11.cpp +++ b/OptiScaler/upscalers/FeatureProvider_Dx11.cpp @@ -141,11 +141,13 @@ bool FeatureProvider_Dx11::ChangeFeature(Upscaler upscaler, ID3D11Device* device State::Instance().currentFeature = nullptr; - LOG_TRACE("sleeping before reset of current feature for 1000ms"); - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + Util::DelayedDestroy(std::move(contextData->feature)); - contextData->feature.reset(); - contextData->feature = nullptr; + // LOG_TRACE("sleeping before reset of current feature for 1000ms"); + // std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + + // contextData->feature.reset(); + // contextData->feature = nullptr; } else { diff --git a/OptiScaler/upscalers/FeatureProvider_Vk.cpp b/OptiScaler/upscalers/FeatureProvider_Vk.cpp index 279108ec..2baf4fa7 100644 --- a/OptiScaler/upscalers/FeatureProvider_Vk.cpp +++ b/OptiScaler/upscalers/FeatureProvider_Vk.cpp @@ -142,11 +142,13 @@ bool FeatureProvider_Vk::ChangeFeature(Upscaler upscaler, VkInstance instance, V State::Instance().currentFeature = nullptr; - LOG_DEBUG("sleeping before reset of current feature for 1000ms"); - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + Util::DelayedDestroy(std::move(contextData->feature)); - contextData->feature.reset(); - contextData->feature = nullptr; + // LOG_DEBUG("sleeping before reset of current feature for 1000ms"); + // std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + + // contextData->feature.reset(); + // contextData->feature = nullptr; } else {