Question

I've quite the weird problem at my hand here. I'm using directx 11 to make my own game framework/engine and it has worked fine until i tried to implement frustum culling which gave me really weird framerate issues.

I've simplifed the problem a bit so it happens without me doing any frustum culling. Right now I have 250 models rendered on my screen, 70 fps in debug. I've made it so that if i hold in the button H it skips the rendering of my models in my Application::Render but if i do this and then let go of the button again, my framerate is tops around 40 afterwards most times around 4 fps even. Profiling shows me it's SwapChain::Present that all of a sudden takes way longer time then it ever should.

In Release it's the same problem, this only happens if i got the debugger attached btw. I can't really figure this one out myself.

Tried rebuilding and rebooting.

my present function:

m_pSwapChain->Present( 0, 0);

My Application::Render function:

void CApplication::Render() const
{
    CD3D::Instance()->BeginRender();

    //Render 3d
    if ( !CInputSystem::Instance()->IsKeyPressed('H'))
    {
        std::vector<CPlanet*>::const_iterator it;
        for (it = m_Planets.begin(); it != m_Planets.end(); ++it)
        {
            (*it)->Render();
        }
    }
    // Render 2d
    m_pScreenSprite->Render();

    CTextSystem::Instance()->Render2D();
    CD3D::Instance()->EndRender();
}

This is how my profiling looks before stopping my models to be rendered by pressing H:

[Profiler] BeginRender: 2.830984218768823e-005
[Profiler] Models::Render: 1.4456089627755692e-005
[Profiler] Text|Sprite ::Render: 0.00015811348030357787
[Profiler] EndRender: 0.00018853150222864715
[Profiler] CApplication::Render(): 0.00067612335863149022

After I've pressed H for a second then released it so the models are being rendered again:

[Profiler] BeginRender: 2.4996988314660883e-005
[Profiler] Models::Render: 0.0091422720154198285
[Profiler] Text|Sprite ::Render: 0.00011655222262378027
[Profiler] EndRender: 0.2590757137694254
[Profiler] CApplication::Render(): 0.26870557764124803

I also tried, instead of not rendering my models when i press H, I create a new model when i press C which has the same effect. So if the number of models rendered changes in any way during runtime my framerate goes crazy.

This doesn't happen if i have fraps running(was going to capture the behavior so you could see it). Duno if that's a clue to anything.

FIXED! Look at comment below

Was it helpful?

Solution

Finally i can answer my own question(had to wait 8 hours)

Problem solved, I should've thought of this sooner, FML. Works fine now when i upgraded my drivers to ones that came out 11 days ago(i've upgraded them just 1-2 months ago last time). Works fine now, fpsdrops has disapeared in other games as well

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top