Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How do I optimize GUI rendering


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
7 replies to this topic

#1 comfy chair   Members   -  Reputation: 573

Like
0Likes
Like

Posted 22 November 2012 - 10:42 AM

When I turn off GUI rendering in my game, I gain around 10-15 FPS. I have also determined that my game is CPU-bound. This makes me think I ought to optimize it. But how?

The GUI is rendered using many small sprites and a few custom shaders.

What is the normal way? Is it to render into a render target and somehow do occasional re-renders only when something changes?


By the way, I code in XNA. Thank you.

Edited by comfy chair, 22 November 2012 - 10:44 AM.


Sponsor:

#2 Waterlimon   Crossbones+   -  Reputation: 2597

Like
2Likes
Like

Posted 22 November 2012 - 10:56 AM

10-15 fps change doesnt tell anything without the fps value it affects.

If you take 15 fps away from 1000 fps, i dont think you have a problem...

o3o


#3 C0lumbo   Crossbones+   -  Reputation: 2343

Like
0Likes
Like

Posted 22 November 2012 - 11:32 AM

Are your 2D sprites atlassed and batched sensibly?

It would be useful to know how many quads are rendered in your GUI and how many draw calls you are making to draw them.

Edited by C0lumbo, 22 November 2012 - 11:33 AM.


#4 MJP   Moderators   -  Reputation: 11569

Like
1Likes
Like

Posted 22 November 2012 - 11:50 AM

10-15 fps change doesnt tell anything without the fps value it affects.

If you take 15 fps away from 1000 fps, i dont think you have a problem...


What this guy said. FPS is not a linear measure of performance. I would suggest always describing things in terms of milliseconds per frame, and always using that metric when profiling.

#5 comfy chair   Members   -  Reputation: 573

Like
0Likes
Like

Posted 22 November 2012 - 12:59 PM

If I have 45 fps I can get to 60 FPS by turning GUI rendering off.

#6 MrDaaark   Members   -  Reputation: 3555

Like
0Likes
Like

Posted 22 November 2012 - 01:28 PM

Put all your GUI sprites on one texture sheet to kill material changes. Make some kind of vertex buffer object to draw them all in one pass, and only update it when something changes.

#7 MJP   Moderators   -  Reputation: 11569

Like
1Likes
Like

Posted 22 November 2012 - 03:18 PM

If you're using SpriteBatch, it will automatically batch sprites using the same texture. So if you use a texture atlas, you could potentially reduce your number of Draw calls by quite a bit.

#8 comfy chair   Members   -  Reputation: 573

Like
0Likes
Like

Posted 22 November 2012 - 03:36 PM

I use both SpriteBatch and a sprite sheet.

I think perhaps it is the culling and clipping that is responsible.




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