Jump to content
  • Advertisement
Sign in to follow this  
yahastu

DirectX FPS

This topic is 3930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I measured that I am getting 50-55 FPS in my game. I am measuring the FPS by looking over the last 200 frames, computing it using clock() and time(), both give the same answer. I thought this was a bit low because I'm not doing too much...rendering some text, a few thousand points, mesh, fog, thats basically it. Well, I did some profiling...and it turns out that I get the exact same FPS when I remove EVERYTHING from my render loop leaving just: dxDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(154,168,214), 1.0f, 0); dxDevice->BeginScene(); //nothing dxDevice->EndScene(); dxDevice->Present(NULL, NULL, NULL, NULL); Literally, theres nothing else in the timing loop. Yes, I am running in Release mode, and every single speed optimization that Visual studio can do is turned on. If I comment out dxDevice->Present, then it jumps up to like 600 FPS, and then if I turn off the others it goes up to practically infinity (as expected). What I dont understand is...why is this the bottleneck? And rendering a large mesh with 1024 tex + text overlays + dynamic generation of point sprites...none of these things even make a noticeable increase in the FPS. So it seems that 50 is the BEST possible fps I can achieve under any circumstances then....yet I have seen higher FPS reported to me in games and demos that other people have compiled! Im using: Geforce 6600GT 128MB 3 GB ram Athlon 3800+ 2.01 GHz dual core proc

Share this post


Link to post
Share on other sites
Advertisement
You probably have v-sync enabled (meaning that your frame rate is limited to your monitor's refresh rate) - you'll want to check what your presentation interval is set at under your D3D device settings. To force v-sync off you'll want to set the presentation interval to 'immediate' - search your DX SDK docs for presentation interval and everything should be there :)

Share this post


Link to post
Share on other sites
Hey, have you got your presentation parameters set to vsync by any chance?

i.e. (in MDX for example)

D3DPresentParameters.PresentationInterval = PresentInterval.Default; //this will vsync it to your monitor refresh rate (around 60Hz).

D3DPresentParameters.PresentationInterval = PresentInterval.Immediate; //this will throw frames out as fast as it can (eg much > 60Hz).

[edit]: snap boersch :) i was way to slow on that one

Share this post


Link to post
Share on other sites
Just to add to this - the presentation interval parameters tend to be more of a hint than a requirement. Look in your hardware's control panel applet and you'll probably find a "always off"/"application preference"/"always on" switch.

The point being that it's best not to rely on V-SYNC being enabled or disabled.

hth
Jack

Share this post


Link to post
Share on other sites
Not alot of point in turning it off really though. Sure it helps to give a rough indication of the preformance without any real profiling but apart from that what does it matter if you're window refreshes 50 times a second or 200 if you're monitor is onlt refreshing at 50 anyway? Hopefully you're not relying on any peticular frame rate for timing otherwise its not going to run the same on your system as on another one.

Share this post


Link to post
Share on other sites
Naku,

When I set PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; as suggested, my framerate jumps up to around 215. I suppose there is no way to know for sure if the screen is really refreshing that fast...but there is a very noticeable improvement. My monitor refreshes at 75 Hz anyway, not 50 Hz!

JollyJeffers,

Interesting...I have the nVIDIA display desktop manager thing in my system tray, but I was unable to find the setting you are talking about.

Share this post


Link to post
Share on other sites
Naku,

When I set PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; as suggested, my framerate jumps up to around 215. I suppose there is no way to know for sure if the screen is really refreshing that fast...but there is a very noticeable improvement. My monitor refreshes at 75 Hz anyway, not 50 Hz!

JollyJeffers,

Interesting...I have the nVIDIA display desktop manager thing in my system tray, but I was unable to find the setting you are talking about.

Share this post


Link to post
Share on other sites
Naku,

When I set PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; as suggested, my framerate jumps up to around 215. I suppose there is no way to know for sure if the screen is really refreshing that fast...but there is a very noticeable improvement. My monitor refreshes at 75 Hz anyway, not 50 Hz!

JollyJeffers,

Interesting...I have the nVIDIA display desktop manager thing in my system tray, but I was unable to find the setting you are talking about.

Share this post


Link to post
Share on other sites
I was calculating my fps similar to that until I thought of a much better way:

(not exact code off the top of my head)
static int fps = 0;
SetTimer(0, 1000);

gameloop()
{
fps++;
if (WM_TIMER == msg.message)
{
DisplayFPS();
fps = 0;
}

}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!