Optomizing, draw one huge polygon or several small polygons

Started by
6 comments, last by MrFlibble 16 years, 10 months ago
I'm curious if this would matter, I'm drawing backgrounds as 2D quads (2 tris), sometimes theres more than one (1024x768 quad) on the screen at a time, and I've noticed a major loss in speed when they're on the screen as opposed to when they're not. would it make a difference to tile these as several small quads instead of one big one?
-----------------------------------------------The ZoloProject
Advertisement
I have limited knowledge in this subject but something that would cause major loss in performance would be shade mode and pixel shader ops. ShadeMode should be set to flat and no pixel process at all?

-Devin
not using shaders. I'm making a quick mock-up right now too test it.
-----------------------------------------------The ZoloProject
Quote:Original post by speedie
would it make a difference to tile these as several small quads instead of one big one?
Theorically yes, but I don't know how much this would translate in real world performance. Recent games I've looked at used 6-4 subdivisions. I subdivide my tonemapping quad in 16x16 but obviously the performance increment (supposing there is one in the first place) goes hidden by the other workload.

If "there's more than a quad" I guess it's more likely you're blending. Blending is a slow operation on all cards.

Previously "Krohm"

How would adding more quads increase your performance? If anything, it will decrease performance due to the extra vertices and primitives. And don't forget that fragments along borders would need to be processed multiple times. As a matter of fact, I've read that some people use one really large triangle instead of a quad to avoid processing the diagonal border fragments twice.

Drawing full-screen quads is about the slowest thing you can do anyway, since you need to process every single pixel, so it's not that surprising that you're experiencing performance problems with multiple quads. In this case you're just fillrate-limited, and there's not much you can do about that besides get a faster card.
Quote:Original post by Zipster
How would adding more quads increase your performance? If anything, it will decrease performance due to the extra vertices and primitives.

It can actually speed things up on certain graphics chips (PSP for one). Smaller tris can fit into cache better and so be processed faster. I don't think you'd notice any difference with a PC graphics card though.
If you're that worried about performance here then perhaps you should look at different methods of drawing your quad. Obviously the best way to draw a large quad is just to Blit the data from your texture area in memory to the screen area.

That is, of course, if no scaling is involved, but perhaps then too you could use on of the Device.StretchRectangle() methods?

-Devin
The slowdown you're probably seeing is related to the texture cache and the size of the polygon you are drawing.

A texture polygon of that size will hammer the texture cache, causing lots of data stalls loading cache lines. Reducing the size of the polygon or splitting it up into smaller areas to be rendered will improve your performance.

Unfortunately the size of the texture cache varies depending on the graphics chip-set. Sticking with polygons that are roughly up to 64x64 in size should give you good results though - but try out any variation that is a power of 2 until you're happy.

MrF.--Code..reboot..code..reboot..sigh!

This topic is closed to new replies.

Advertisement