Made check more readable

This commit is contained in:
cdozdil committed 2026-09-16 23:25:01 +03:00
1 parent a4890db5b3
commit 4291bb9faf
1 file changed
+19 -13
+19 -13
View File
@@ -371,12 +371,29 @@ static HRESULT LocalPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT
{
std::optional<double> upscalerTimeOpt {};
if (cq != nullptr && currentFeature->Api() == API::DX12 && !currentFeature->IsWithDx12())
// If using DX11 with DX12 interop
if (State::Instance().swapchainInteropApi == SwapchainInteropApi::Dx11wDx12)
{
if (State::Instance().currentD3D11Device != nullptr &&
(currentFeature->Api() == API::DX11 || currentFeature->IsWithDx12()))
{
ID3D11DeviceContext* context = nullptr;
State::Instance().currentD3D11Device->GetImmediateContext(&context);
if (upscalerTimeOpt = currentFeature->ReadUpscalerTime(context); upscalerTimeOpt.has_value())
currentFeature->ReadDetailedGpuTimes(context, State::Instance().detailedGpuTimes);
context->Release();
}
}
// If DX12
else if (cq != nullptr && currentFeature->Api() == API::DX12 && !currentFeature->IsWithDx12())
{
if (upscalerTimeOpt = currentFeature->ReadUpscalerTime(cq); upscalerTimeOpt.has_value())
currentFeature->ReadDetailedGpuTimes(cq, State::Instance().detailedGpuTimes);
}
else if (device != nullptr)
// If DX11
else if (device != nullptr && (currentFeature->Api() == API::DX11 || currentFeature->IsWithDx12()))
{
ID3D11DeviceContext* context = nullptr;
device->GetImmediateContext(&context);
@@ -386,17 +403,6 @@ static HRESULT LocalPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT
context->Release();
}
if (State::Instance().swapchainInteropApi == SwapchainInteropApi::Dx11wDx12 &&
State::Instance().currentD3D11Device != nullptr)
{
ID3D11DeviceContext* context = nullptr;
State::Instance().currentD3D11Device->GetImmediateContext(&context);
if (upscalerTimeOpt = currentFeature->ReadUpscalerTime(context); upscalerTimeOpt.has_value())
currentFeature->ReadDetailedGpuTimes(context, State::Instance().detailedGpuTimes);
context->Release();
}
if (upscalerTimeOpt.has_value())
{