Jump to content
  • Advertisement
Sign in to follow this  
speedie

Optomizing, draw one huge polygon or several small polygons

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

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!