Jump to content
  • Advertisement
Sign in to follow this  

Max FPS in Windowed Mode

This topic is 4773 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

Hello all, I am working on a windowed D3D app and my FPS is ranging from 45-55fps. Given how little the app was doing I expected a much higher frame rate. Using Vtune I was able to determine that the call to either EndScene() or Present() were calling a Sleep() function to delay execution. Am I limited to 40-60 fps in windowed mode for some reason? Thanks Todd

Share this post


Link to post
Share on other sites
Advertisement
This is because of the presentation interval. By default it is set to D3DPRESENT_INTERVAL_ONE which means it is synchronised to the update frequency of your monitor (60). If you change it to D3DPRESENT_INTERVAL_IMMEDIATE you will see huge FPS.

presParams.PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE;

Share this post


Link to post
Share on other sites
What kind of computer are you developing on? I remember, I had the same issue when working with a laptop computer I used to have. I suspect that it was because the computer automatically v-sync'd itself and so the timing would always come up at/around 59-60 fps, so you might be having the same issue. I guess the best way you could check is to draw one polygon to the screen every frame and see what framerate you get. I assume that you're also not putting any delays in your code that waits for the program to have passed a certain amount of time before drawing the next frame (where you could also possibly get the constant framerate). Anyway, good luck!

EDIT: Hmm... I didn't realize someone was posting when I was. But INTERVAL_ONE wasn't the case with my laptop, so I'm not sure.

Share this post


Link to post
Share on other sites
Thanks for the help with this.

Is there a reason one would use D3DPRESENT_INTERVAL_ONE vs _IMMEDIATE?

I am indeed working on a laptop (Thinkpad T42p with ATI 128 card). I am not putting any delays in my code and I am indeed getting the same FPS with a very simple scene. I have a desktop though, so I can test this assertion as well.

Thanks for the direction!

Todd

Share this post


Link to post
Share on other sites
Sure enough, changing to D3DPRESENT_INTERVAL_IMMEDIATE jacked up my frame rate.

However, this raises some concerns on my engine architecture:

I am guessing that setting the interval to immediate means that I am spending time doing updates that are never seen because ultimately the screen refresh rate is the limiting factor. So, I should leave it as it was, right?

Also, my render function is a simple:

BeginScene()
A bunch of Draw Calls()
EndScene()
Present()

So, is the call to present() holding up my entire application waiting for the screen to referesh? Is there a way for me to recapture these lost cycles so that I could be using them for something else? Can I do a simple check in my render() function to see if the screen is ready or do I need to somehow rewrite the rendering engine as a separate thread?

Thanks

Share this post


Link to post
Share on other sites
D3DPRESENT_INTERVAL_ONE will wait for the vertical retrace to draw. It helps prevent image tearing.

Here's what MSDN has to say:

"The driver will wait for the vertical retrace period (the runtime will "beam follow" to prevent tearing). IDirect3DDevice9::Present operations will not be affected more frequently than the screen refresh; the runtime will complete at most one IDirect3DDevice9::Present operation per adapter refresh period. This is equivalent to using D3DSWAPEFFECT_COPYVSYNC in Microsoft DirectX 8.1. This option is always available for both windowed and full-screen swap chains."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/constants/D3DPRESENT.asp

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!