How do I optimize GUI rendering

Started by
6 comments, last by comfy chair 11 years, 4 months ago
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.
Advertisement
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

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.

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.
If I have 45 fps I can get to 60 FPS by turning GUI rendering off.
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.
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.
I use both SpriteBatch and a sprite sheet.

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

This topic is closed to new replies.

Advertisement