From fe48594481901df375ed091140df2bfbc3aabf99 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 2cf0fe44..8714a53f 100644 --- a/OptiScaler/wrapped/wrapped_swapchain.cpp +++ b/OptiScaler/wrapped/wrapped_swapchain.cpp @@ -401,14 +401,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; } @@ -857,6 +860,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(); @@ -1254,6 +1260,9 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain4::ResizeBuffers1(UINT BufferCoun ppPresentQueue); } + if (result == DXGI_ERROR_DEVICE_REMOVED && State::Instance().currentD3D12Device != nullptr) + Util::GetDeviceRemovedReason(State::Instance().currentD3D12Device); + #ifdef DXGI_DEBUG_ENABLED if (result != S_OK) ReadDxgiInfoQueue();