What is the cost of using the DrawPrimitive family of functions?

In the DrawPrimitive family there are two primitive construct function calls DrawPrimitive and DrawPrimitiveUP. DrawPrimitive renders a sequence of nonindexed, geometric primitives of the specified type from the current set of data input streams (Vertex Buffers). Whereas DrawPrimitiveUP renders a sequence of geometric primitives of the specified type from the data specified by a user memory pointer.

If a DPUP call is used for creating a particle system then it is an advantage as the data is already in the CPU cache. The DrawPrimitiveUP call is actually 'translated' into a DrawPrimitive call, plus a memcpy of the data into a Private vertex buffer maintained by Direct3D. So for less than around 100 vertices DrawPrimitve and DrawPrimitveUP are not much different except in the second case there is an extra memcpy (But for less than 100 vertices it is insignificant)

Dan Baker (on the Microsoft Direct3D team) says: "Using DrawPrimUP for very small loads isn't any different than creating a Dynamic Vertex Buffer and filling it yourself - except an extra memcopy (that is negligible since the loads are small). If you are just using it to do UI quads or sprites, then it is fine. Think of it as the 2D interface to D3D."

FAQ Menu

 
Printer friendly version of the FAQ-DIRECTX-Using-DrawPrimitive-Functions page


Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.