From 0551f6f4577bb79d7082377e6414c089d8e4cd4e Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 13 May 2022 11:24:49 -0700 Subject: [PATCH] A few DXUT /analyze fixes --- DXUT/Core/DXUT.cpp | 2 +- DXUT/Core/DXUTDevice11.cpp | 4 ++-- DXUT/Optional/DXUTsettingsdlg.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DXUT/Core/DXUT.cpp b/DXUT/Core/DXUT.cpp index 66492f7b..30db403d 100644 --- a/DXUT/Core/DXUT.cpp +++ b/DXUT/Core/DXUT.cpp @@ -4476,7 +4476,7 @@ HRESULT DXUTSnapDeviceSettingsToEnumDevice( DXUTDeviceSettings* pDeviceSettings, } if (pDeviceSettingsCombo->pOutputInfo) { - auto bestDisplayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ bestModeIndex ]; + const auto& bestDisplayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ bestModeIndex ]; if (!pDeviceSettingsCombo->Windowed) { pDeviceSettings->d3d11.sd.BufferDesc.Height = bestDisplayMode.Height; diff --git a/DXUT/Core/DXUTDevice11.cpp b/DXUT/Core/DXUTDevice11.cpp index 5e7a766e..d6d4589f 100644 --- a/DXUT/Core/DXUTDevice11.cpp +++ b/DXUT/Core/DXUTDevice11.cpp @@ -1113,7 +1113,7 @@ float DXUTRankD3D11DeviceCombo( CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCo // Match both Resolution & Refresh Rate for( size_t idm = 0; idm < pDeviceSettingsCombo->pOutputInfo->displayModeList.size() && !bResolutionFound; idm++ ) { - auto displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ]; + const auto& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ]; float refreshDiff = fabsf( ( float( displayMode.RefreshRate.Numerator ) / float( displayMode.RefreshRate.Denominator ) ) - ( float( pOptimalDeviceSettings->sd.BufferDesc.RefreshRate.Numerator ) / float( pOptimalDeviceSettings->sd.BufferDesc.RefreshRate.Denominator ) ) ); @@ -1143,7 +1143,7 @@ float DXUTRankD3D11DeviceCombo( CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCo // Match just Resolution for( size_t idm = 0; idm < pDeviceSettingsCombo->pOutputInfo->displayModeList.size() && !bResolutionFound; idm++ ) { - auto displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ]; + const auto& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ]; if( displayMode.Width == pOptimalDeviceSettings->sd.BufferDesc.Width && displayMode.Height == pOptimalDeviceSettings->sd.BufferDesc.Height ) diff --git a/DXUT/Optional/DXUTsettingsdlg.cpp b/DXUT/Optional/DXUTsettingsdlg.cpp index a20658b2..0a2e38bf 100644 --- a/DXUT/Optional/DXUTsettingsdlg.cpp +++ b/DXUT/Optional/DXUTsettingsdlg.cpp @@ -1460,7 +1460,7 @@ HRESULT CD3DSettingsDlg::UpdateD3D11Resolutions() for (size_t idm = 0; idm < pOutputInfo->displayModeList.size(); idm++) { - auto DisplayMode = pOutputInfo->displayModeList[idm]; + const auto& DisplayMode = pOutputInfo->displayModeList[idm]; float fAspect = (float) DisplayMode.Width / (float) DisplayMode.Height; if (DisplayMode.Format == g_DeviceSettings.d3d11.sd.BufferDesc.Format)