From ca5d59afb137b85c9d429ae608aa30d87bb9ebef Mon Sep 17 00:00:00 2001 From: cdozdil Date: Sun, 31 May 2026 12:40:50 +0300 Subject: [PATCH] Added device removed reason logging to wrapped swapchain too --- OptiScaler/wrapped/wrapped_swapchain.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/OptiScaler/wrapped/wrapped_swapchain.cpp b/OptiScaler/wrapped/wrapped_swapchain.cpp index a7e8f92d..61a85065 100644 --- a/OptiScaler/wrapped/wrapped_swapchain.cpp +++ b/OptiScaler/wrapped/wrapped_swapchain.cpp @@ -360,14 +360,17 @@ static HRESULT LocalPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT else presentResult = ((IDXGISwapChain1*) pSwapChain)->Present1(SyncInterval, Flags, pPresentParameters); - LOG_DEBUG("Original present result: {:X}", (UINT) presentResult); - if (presentResult == S_OK) - LOG_TRACE("4 {}, Present result: {:X}", _frameCounter, (UINT) presentResult); + { + LOG_DEBUG("Original present result: {:X}", (UINT) presentResult); + } else - LOG_ERROR("4 {:X}", (UINT) presentResult); + { + LOG_ERROR("Original present result: {:X}", (UINT) presentResult); - LOG_DEBUG("Done"); + if (presentResult == DXGI_ERROR_DEVICE_REMOVED && State::Instance().currentD3D12Device != nullptr) + Util::GetDeviceRemovedReason(State::Instance().currentD3D12Device); + } return presentResult; } @@ -812,6 +815,9 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain4::ResizeBuffers(UINT BufferCount result = _real->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags); } + if (result == DXGI_ERROR_DEVICE_REMOVED && State::Instance().currentD3D12Device != nullptr) + Util::GetDeviceRemovedReason(State::Instance().currentD3D12Device); + #ifdef DXGI_DEBUG_ENABLED if (result != S_OK) ReadDxgiInfoQueue(); @@ -1212,6 +1218,9 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain4::ResizeBuffers1(UINT BufferCoun } } + if (result == DXGI_ERROR_DEVICE_REMOVED && State::Instance().currentD3D12Device != nullptr) + Util::GetDeviceRemovedReason(State::Instance().currentD3D12Device); + #ifdef DXGI_DEBUG_ENABLED if (result != S_OK) ReadDxgiInfoQueue();