Jump to content

  • Log In with Google      Sign In   
  • Create Account


Unreasonable frame times in XNA


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 japro   Members   -  Reputation: 887

Like
0Likes
Like

Posted 04 February 2012 - 02:45 PM

So I figured I'd look into XNA/C# to widen my horizon. Now everything went smoothly until I changed the resolution of my Program. At the time I was only displaying 3 sprites and it went all choppy. Full screen on the other hand seems ok'ish again. Even an "empty" program has bad performance. I just checked that by creating a XNA project and inserting:
            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();
 
            this.IsFixedTimeStep = false;
into the Initialize function and
System.Console.WriteLine(gameTime.ElapsedGameTime.TotalMilliseconds);
into the Update function.
This outputs wildly varying times in the range 20-50ms.
Hardware shouldn't be an issue since a i5-580m and a GTX260m should be plenty.

Not changing resolution or going fullscreen gives ok performance. Weirdly it still seems to be vsynced even with IsFixedTimestep = false.

Sponsor:

#2 DJTN   Members   -  Reputation: 207

Like
0Likes
Like

Posted 05 February 2012 - 11:37 AM

I'm not well versed in XNA but I would first narrow down if the frame rate influx was GPU or CPU related. I'd also make sure the video card drivers were up to date and then I would use PIX to profile the application. The profile should give you a better idea of where the problem is occuring and when.

Also, does this influx happen in the release configuration or only in debug? I've had framerate drops in debug mode and then the release build was fine.

#3 Hazard_X   Members   -  Reputation: 118

Like
0Likes
Like

Posted 05 February 2012 - 01:01 PM

Weirdly it still seems to be vsynced even with IsFixedTimestep = false.


I'm not sure what the issue may be in general, but i can help you with this one. IsFixedTimestep is not VSync. It just guarantees that the Update Function is called 60 times per second, independent of framerate, even if you get less rendered frames.
To turn off VSync add this line to your code:
graphics.SynchronizeWithVerticalRetrace = false;

With both IsFixedTimestep and SynchronizeWithVerticalRetrace turned off you should get very high FPS.

#4 japro   Members   -  Reputation: 887

Like
0Likes
Like

Posted 05 February 2012 - 01:14 PM

Thank you. It seems the issue mostly exists in the case of vsync + nonfullscreen. I guess there is some sort of aliasing issue.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS