DirectX 11 SwapChain::Present issue

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Heya Guys!

Ive quite the weird problem at my hand here.<br/>
Im 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.
Ive 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. Ive 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 its SwapChain::Present that all of a sudden takes way longer time then it ever should.
In Release its the same problem, this only happens if i got the debugger attached btw. I cant really figure this one out myself.
Tried rebuilding and rebooting.
my present function:

<div style="color:black; background-color:white
<pre>m_pSwapChain->Present( 0, 0);
[/code]


My Application::Render function:
<div style="color:black; background-color:white
<pre><span style="color:blue void CApplication::Render() <span style="color:blue const
{
CD3D::Instance()->BeginRender();

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

CTextSystem::Instance()->Render2D();
CD3D::Instance()->EndRender();
}
[/code]


Any ideas?

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

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

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

[Profiler] BeginRender: 2.4996988314660883e-005<br/>
[Profiler] Models::Render: 0.0091422720154198285<br/>
[Profiler] Text|Sprite ::Render: 0.00011655222262378027<br/>
[Profiler] EndRender: 0.2590757137694254<br/>
[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 doesnt happen if i have fraps running(was going to capture the behavior so you could see it). Duno if thats a clue to anything.
[/Edit]
<br/>
<br/>
<br/>

View the full article
 
Back
Top