• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[SHARE] Remove FPS Limit on Window Mode

Junior Spellweaver
Joined
Nov 27, 2023
Messages
101
Reaction score
45
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 :love:

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 .

Untitled - [SHARE] Remove FPS Limit on Window Mode - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Chinese Developer
Banned
Joined
Apr 6, 2019
Messages
358
Reaction score
53
1702647599698 - [SHARE] Remove FPS Limit on Window Mode - RaGEZONE Forums

before make the changes on code.

this is the result after making the posts modification.
1702648417469 - [SHARE] Remove FPS Limit on Window Mode - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Elite Diviner
Joined
Sep 7, 2020
Messages
461
Reaction score
78
1702656847106 - [SHARE] Remove FPS Limit on Window Mode - RaGEZONE Forums
256
 

Attachments

You must be registered for see attachments list
Initiate Mage
Joined
Dec 22, 2023
Messages
4
Reaction score
2
This is like turning off the vertical sync which locks the max fps to 60...; the fps-dropping problem is still here. Solving this requires multi-thread programming to join the job and render the texture and text. Perhaps updating the DX version of the game engine can be tried, too. It should also be better performance.
 
Junior Spellweaver
Joined
Nov 27, 2023
Messages
101
Reaction score
45
This is like turning off the vertical sync which locks the max fps to 60...; the fps-dropping problem is still here. Solving this requires multi-thread programming to join the job and render the texture and text. Perhaps updating the DX version of the game engine can be tried, too. It should also be better performance.
The more you take, the less you have ~ Master Oogway


you could apply a bunch of modification in attempt for better performance such as
reduce fire burning animation , make it don't spread randomly coordinate or you could even make it static image :cat:
reduce weather drop amount(rain,snow, leaves) or make them drop on specific coordinate ( why you do want this :chomp: )

...etc

. .it's a rabbit hole finding balance between quality and performance and you would waste too much time tweaking , eventually you will realize you converted ran online into minecraft graphics
 
Chinese Developer
Banned
Joined
Apr 6, 2019
Messages
358
Reaction score
53
The more you take, the less you have ~ Master Oogway


you could apply a bunch of modification in attempt for better performance such as
reduce fire burning animation , make it don't spread randomly coordinate or you could even make it static image :cat:
reduce weather drop amount(rain,snow, leaves) or make them drop on specific coordinate ( why you do want this :chomp: )

...etc

. .it's a rabbit hole finding balance between quality and performance and you would waste too much time tweaking , eventually you will realize you converted ran online into minecraft graphics
i think you miss understanding what he trying to told.
he just said that the above code is something like turning off the sync for showing out the fps rate on real time.
he dint mention that your share is not useable.

but what he pointing , the fps drop problem still there , its correct.
because now as the code shown, the render part only using single thread. he just suggest a idea or a ways for others dev that can trying to make changes on Multi Thread. or updating dx version to higher version.

as what your replies , i think you was miss understanding what he trying to tell.

My perspective on the statement 'It's a rabbit hole finding balance between quality and performance'
In the IT world, maintaining a balance between quality and performance is not a fairy tale but entirely achievable. Through continuous optimization and adopting effective development processes, we can deliver high-quality products while ensuring exceptional performance. The key is to find the right tools and methods to strike the ideal balance between quality and performance. It's a challenge, but it's also an interesting and worthwhile goal to pursue.
 
Initiate Mage
Joined
Dec 22, 2023
Messages
4
Reaction score
2
The more you take, the less you have ~ Master Oogway


you could apply a bunch of modification in attempt for better performance such as
reduce fire burning animation , make it don't spread randomly coordinate or you could even make it static image :cat:
reduce weather drop amount(rain,snow, leaves) or make them drop on specific coordinate ( why you do want this :chomp: )

...etc

. .it's a rabbit hole finding balance between quality and performance and you would waste too much time tweaking , eventually you will realize you converted ran online into minecraft graphics
'The more you take, the less you have' is not suitable for this scenario.
Assuming that there are 1m textures waiting to render in the game, then we can split them into 10 parts and join 10 threads to render them instead of 'reducing'.
You can imagine that, for i = 0 to 1m is split to 10 x for i = 0 to 0.1m. Since using thread can run asynchronously, that allows the process to use the maximum CPU utilization. Let's say in this example, 10 x for i = 0 to 0.1m is running asynchronously to render textures. Then your FPS is more stable to keep than just using for i = 0 to 1m. Of course, it is hard to implement since you need to prevent the critical section problem, which can cause wrong results.

About your 'rabbit hole', I think your first step is to understand the quality of the software.
When we say software quality, we always want to assure that the software is bug-free, easy to maintain, well-structured, and meets the requirements. Therefore, good quality software always gives you high-performance software, and it's not necessary to find a balance between 'quality and performance.' However, software quality assurance is not easy to achieve since it requires professional knowledge in the IT industry. That is why there is a course for software quality assurance.
 
Last edited:
Back
Top