This modification will remove FPS limit being limited equal to your monitor refresh rate (example if your monitor refresh rate is 60 then 60 FPS limit ) when playing window mode .
After applying this modification expect 50 ~ 80 FPS increase on window mode
on DXUT.cpp find
modify
on DXUT.cpp again find
modify
on DXUTenum.cpp find
modify
on d3dapp.cpp find
modify
then lastly at d3dapp.cpp change both PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE
Please post screenshot of your Ran running window mode using /dsp fps command ...also don't forget to Like this thread if this is helpful .
After applying this modification expect 50 ~ 80 FPS increase on window mode
on DXUT.cpp find
Code:
//---------------------
// Present interval
//---------------------
if( pMatchOptions->ePresentInterval == DXUTMT_IGNORE_INPUT )
{
// For windowed, default to D3DPRESENT_INTERVAL_IMMEDIATE
// which will wait not for the vertical retrace period to prevent tearing,
// but may introduce tearing.
// For full screen, default to D3DPRESENT_INTERVAL_DEFAULT
// which will wait for the vertical retrace period to prevent tearing.
if( pOptimalDeviceSettings->pp.Windowed )
pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
else
pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
}
else
{
pOptimalDeviceSettings->pp.PresentationInterval = pDeviceSettingsIn->pp.PresentationInterval;
}
}
modify
Code:
//---------------------
// Present interval
//---------------------
if( pMatchOptions->ePresentInterval == DXUTMT_IGNORE_INPUT )
{
// For windowed, default to D3DPRESENT_INTERVAL_IMMEDIATE
// which will wait not for the vertical retrace period to prevent tearing,
// but may introduce tearing.
// For full screen, default to D3DPRESENT_INTERVAL_DEFAULT
// which will wait for the vertical retrace period to prevent tearing.
if( pOptimalDeviceSettings->pp.Windowed )
pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
else
// pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; // default
pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
// pOptimalDeviceSettings->pp.PresentationInterval = pDeviceSettingsIn->pp.PresentationInterval; //default
pOptimalDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
}
on DXUT.cpp again find
Code:
//---------------------
// Present interval
//---------------------
UINT bestPresentInterval;
if( pMatchOptions->ePresentInterval == DXUTMT_PRESERVE_INPUT )
{
bestPresentInterval = pDeviceSettingsIn->pp.PresentationInterval;
}
else if( pMatchOptions->ePresentInterval == DXUTMT_IGNORE_INPUT )
{
if( pBestDeviceSettingsCombo->Windowed )
{
// For windowed, the framework defaults to D3DPRESENT_INTERVAL_IMMEDIATE
// which will wait not for the vertical retrace period to prevent tearing,
// but may introduce tearing
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
// For full screen, the framework defaults to D3DPRESENT_INTERVAL_DEFAULT
// which will wait for the vertical retrace period to prevent tearing
bestPresentInterval = D3DPRESENT_INTERVAL_DEFAULT;
}
}
else // if( pMatchOptions->ePresentInterval == DXUTMT_CLOSEST_TO_INPUT )
{
if( pBestDeviceSettingsCombo->presentIntervalList.Contains( pDeviceSettingsIn->pp.PresentationInterval ) )
{
bestPresentInterval = pDeviceSettingsIn->pp.PresentationInterval;
}
else
{
if( pBestDeviceSettingsCombo->Windowed )
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
else
bestPresentInterval = D3DPRESENT_INTERVAL_DEFAULT;
}
}
modify
Code:
//---------------------
// Present interval
//---------------------
UINT bestPresentInterval;
if( pMatchOptions->ePresentInterval == DXUTMT_PRESERVE_INPUT )
{
// bestPresentInterval = pDeviceSettingsIn->pp.PresentationInterval; // default
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else if( pMatchOptions->ePresentInterval == DXUTMT_IGNORE_INPUT )
{
if( pBestDeviceSettingsCombo->Windowed )
{
// For windowed, the framework defaults to D3DPRESENT_INTERVAL_IMMEDIATE
// which will wait not for the vertical retrace period to prevent tearing,
// but may introduce tearing
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
// For full screen, the framework defaults to D3DPRESENT_INTERVAL_DEFAULT
// which will wait for the vertical retrace period to prevent tearing
// bestPresentInterval = D3DPRESENT_INTERVAL_DEFAULT; // default
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
}
else // if( pMatchOptions->ePresentInterval == DXUTMT_CLOSEST_TO_INPUT )
{
if( pBestDeviceSettingsCombo->presentIntervalList.Contains( pDeviceSettingsIn->pp.PresentationInterval ) )
{
// bestPresentInterval = pDeviceSettingsIn->pp.PresentationInterval; // default
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
if( pBestDeviceSettingsCombo->Windowed )
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
else
// bestPresentInterval = D3DPRESENT_INTERVAL_DEFAULT; // default
bestPresentInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
}
on DXUTenum.cpp find
Code:
void CD3DEnumeration::BuildPresentIntervalList( CD3DEnumDeviceInfo* pDeviceInfo,
CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
UINT pi;
for( int ipi = 0; ipi < m_PresentIntervalList.GetSize(); ipi++ )
{
pi = m_PresentIntervalList.GetAt(ipi);
if( pDeviceCombo->Windowed )
{
if( pi == D3DPRESENT_INTERVAL_TWO ||
pi == D3DPRESENT_INTERVAL_THREE ||
pi == D3DPRESENT_INTERVAL_FOUR )
{
// These intervals are not supported in windowed mode.
continue;
}
}
// Note that D3DPRESENT_INTERVAL_DEFAULT is zero, so you
// can't do a caps check for it -- it is always available.
if( pi == D3DPRESENT_INTERVAL_DEFAULT ||
(pDeviceInfo->Caps.PresentationIntervals & pi) )
{
pDeviceCombo->presentIntervalList.Add( pi );
}
}
}
modify
Code:
void CD3DEnumeration::BuildPresentIntervalList( CD3DEnumDeviceInfo* pDeviceInfo,
CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
UINT pi;
for( int ipi = 0; ipi < m_PresentIntervalList.GetSize(); ipi++ )
{
pi = m_PresentIntervalList.GetAt(ipi);
if( pDeviceCombo->Windowed )
{
if( pi == D3DPRESENT_INTERVAL_DEFAULT ||
pi == D3DPRESENT_INTERVAL_ONE ||
pi == D3DPRESENT_INTERVAL_TWO ||
pi == D3DPRESENT_INTERVAL_THREE ||
pi == D3DPRESENT_INTERVAL_FOUR )
{
// These intervals are not supported in windowed mode.
continue;
}
}
// Note that D3DPRESENT_INTERVAL_DEFAULT is zero, so you
// can't do a caps check for it -- it is always available.
/*
if( pi == D3DPRESENT_INTERVAL_DEFAULT ||
(pDeviceInfo->Caps.PresentationIntervals & pi) )
{
pDeviceCombo->presentIntervalList.Add( pi );
}
*/
if( pi == D3DPRESENT_INTERVAL_IMMEDIATE ||
(pDeviceInfo->Caps.PresentationIntervals & pi) )
{
pDeviceCombo->presentIntervalList.Add( pi );
}
}
}
on d3dapp.cpp find
Code:
m_d3dpp.AutoDepthStencilFormat = pModeInfo->DepthStencilFormat;
m_d3dpp.hDeviceWindow = m_hWndApp;
if( m_bDefWin )
{
m_d3dpp.BackBufferWidth = m_rcWindowClient.right - m_rcWindowClient.left;
m_d3dpp.BackBufferHeight = m_rcWindowClient.bottom - m_rcWindowClient.top;
m_d3dpp.BackBufferFormat = pAdapterInfo->d3ddmDesktop.Format;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; //D3DPRESENT_INTERVAL_IMMEDIATE; //D3DPRESENT_INTERVAL_ONE;
}
else
{
m_d3dpp.BackBufferWidth = pModeInfo->Width;
m_d3dpp.BackBufferHeight = pModeInfo->Height;
m_d3dpp.BackBufferFormat = pModeInfo->Format;
m_d3dpp.FullScreen_RefreshRateInHz = pModeInfo->nCurrentHz;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Speed Limit Off
}
modify
Code:
m_d3dpp.AutoDepthStencilFormat = pModeInfo->DepthStencilFormat;
m_d3dpp.hDeviceWindow = m_hWndApp;
if( m_bDefWin )
{
m_d3dpp.BackBufferWidth = m_rcWindowClient.right - m_rcWindowClient.left;
m_d3dpp.BackBufferHeight = m_rcWindowClient.bottom - m_rcWindowClient.top;
m_d3dpp.BackBufferFormat = pAdapterInfo->d3ddmDesktop.Format;
//m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; //D3DPRESENT_INTERVAL_IMMEDIATE; //D3DPRESENT_INTERVAL_ONE;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
m_d3dpp.BackBufferWidth = pModeInfo->Width;
m_d3dpp.BackBufferHeight = pModeInfo->Height;
m_d3dpp.BackBufferFormat = pModeInfo->Format;
m_d3dpp.FullScreen_RefreshRateInHz = pModeInfo->nCurrentHz;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Speed Limit Off
}
then lastly at d3dapp.cpp change both PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE
Code:
if( m_bDefWin )
{
m_d3dpp.BackBufferWidth = m_rcWindowClient.right - m_rcWindowClient.left;
m_d3dpp.BackBufferHeight = m_rcWindowClient.bottom - m_rcWindowClient.top;
m_d3dpp.BackBufferFormat = pAdapterInfo->d3ddmDesktop.Format;
m_d3dpp.FullScreen_RefreshRateInHz = 0;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
else
{
m_d3dpp.BackBufferWidth = pModeInfo->Width;
m_d3dpp.BackBufferHeight = pModeInfo->Height;
m_d3dpp.BackBufferFormat = pModeInfo->Format;
m_d3dpp.FullScreen_RefreshRateInHz = pModeInfo->nCurrentHz;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}
// Resize the 3D device
Please post screenshot of your Ran running window mode using /dsp fps command ...also don't forget to Like this thread if this is helpful .
Attachments
You must be registered for see attachments list
Last edited: