Welcome to TechNet Blogs Sign in | Join | Help

Performance Art 2: When is a draw call not a draw call?

So we know that draw calls are a major killer for us.  So you would basically assume that the more draw calls there are, the worse the performance.  Well, this is not always true.  There's a funny scenario happening in the Adrenaline Expansion Pack right now.  Without the material batching, there's one area that is causing over 12,000 draw calls.  This is about 12x the USRDA recommended daily dosage of draw calls for any individual.  So it's a slide show right?  Actually, it's running at about 15-20 frames per second on most people's machines.  Which brings me to part 2 of the Performance Art thread:  When is a draw call not a draw call?

 Okay, a draw call is always a draw call.  Every new draw call involves the CPU sending information to the GPU to be rendered.  And believe me, we have our own overhead for each draw call (things like pull on ground and other procedures to make sure everything is rendering in the correct place).  However, if you have several thousand objects in a scene that all have the exact same material and textures, and are using a simple material with only diffuse and night textures, they can all be ripped out in a row without a single material switch.  Which means there is virtually no processing between each draw call except the new vertex information (in this case, incredibly simple apartment complexes of 100 vertices or less).  And on top of that, the pixel shader requires about 3 instructions.  So for 8500 of the 12000 draw calls, there is not a single material switch, very simple vertex data being sent to the card and almost no GPU calculations in the pixel shader.

So what's the lesson here?  Well the first is that we still need to do material batching, and when we do, those 8500 draw calls are going to become a handful.  The second lesson is that a draw call is not always super expensive.  If you author your content smartly (reusing textures and material settings exactly, using fewer vertices in the model and creating simple materials) you can rip through draw calls incredibly quickly.  And the benefit to authoring content that way is that when material batching comes in, all of those objects suddenly batch up into a few draw calls.  The last lesson is that we are really kicking it up a notch for the expansion pack.  Seattle, with all of the autogen cranked and traffic turned all the way up is still only about 5000 to 6000 draw calls.  I know, I say "only" like that's a low number.  It's still extremely excessive and hopefully the material batching work will really knock those numbers down and knock the framerates up.

Published Thursday, June 14, 2007 6:42 PM by torgo3000

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Friday, June 15, 2007 6:59 PM by OwenHewitt

# re: Performance Art 2: When is a draw call not a draw call?

Hi Adrian,

Thanks for this info regarding scenery environments.  What would you call a comfortable range of individual draw calls for an aircraft?

Owen

Monday, June 18, 2007 4:13 PM by torgo3000

# re: Performance Art 2: When is a draw call not a draw call?

It depends on how many you expect to view in the scene at any given time.  If there's only one in the scene, you could have 30 or 40 draw calls for an aircraft.  Ideally, you should be able to reduce the materials / draw calls down to just a few.  If you've got 3 or 4 textures, you should be able to get it down to under 10 draw calls for an aircraft.

Friday, December 21, 2007 6:34 PM by Arno Gerretsen

# Modelling and texturing for performance

Of course every designer has read the excellent blog posts by Adrian Woods on how to optimize your performance

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker