🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DrawPrim or DrawIndexedPrim?

Started by
1 comment, last by VyvyanBasterd 23 years, 10 months ago
I saw on nVidia''s website that DrawIndexedPrimitiveVB is faster than DrawPrimitiveVB on the geForce. I''ll accept that perhaps they''ve optimized their hardware, but it still seems like there''s going to be additional memory reads in the IndexedPrimitive call, thus adding overhead. Am I missing something? In the general case (not strictly geForce; I''m personally using a Voodoo3, and my programming partner uses a TNT2), which is faster? DrawIndexedPrimitiveVB or DrawPrimitiveVB? Does anyone have any data on this? Vyvyan
Advertisement
Opinion from someone who doesn''t really know much 3D: I believe the Indexed calls, although they would use fewer reads, would be quicker for 2 other reasons:

1) The primitive is more likely to fit in the cache memory as it is smaller (an index to a vertex is smaller than a vertex), which will make those extra reads trivial.

2) The primitive will move up your PCI/AGP bus faster due to it being smaller: this means more primitives per second.

Note that these qualities will only be true if an indexed primitive would be smaller than a ''normal'' primitive of the same kind: this is going to be most likely where your vertices are shared across many triangles, for example on curved or skinned surfaces. At the other extreme, you may notice a small performance degradation on cubes, for example.
Yeah, I guess you''ve pretty much got the following:
(each vert is at least 56 bytes)
1 Triangle:
In DP: 3 Verts = 168 bytes
In DIP: 3 Verts, 3 indices = 180 bytes

2 Triangles in a Strip (2 shared verts):
In DP: 6 Verts = 336 bytes
In DIP: 4 Verts, 6 indices = 248 bytes
Which is a savings of about 26%

3 Triangles (2 in a strip, one not):
In DP: 9 Verts = 504 bytes
In DIP: 7 Verts, 9 indices = 428 bytes
Savings of about 15%

So I guess it''s dependant on how many shared vertices there are.

Vyvyan

This topic is closed to new replies.

Advertisement