Performance difference btw tri-list and indexed tris.

Started by
5 comments, last by _the_phantom_ 9 years, 12 months ago

I have a small primitive I am going to instance. I could use an index buffer, but the memory footprint is going to be extremely small either way. However, I am going to draw this object many times per frame. Does it matter at all if I use an ordered triangle list or an indexed triangle list?

Advertisement

Probably not.

Always use indices its very rare that you don't share any vertices. This way you allow gpu to use post vertex shader cache.

Always use indices its very rare that you don't share any vertices. This way you allow gpu to use post vertex shader cache.

For the small number of vertices the OP is talking about (I'm guessing quads in a particle system?) it's highly unlikely to make any difference. The bottleneck will be elsewhere.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

For the small number of vertices the OP is talking about (I'm guessing quads in a particle system?) it's highly unlikely to make any difference. The bottleneck will be elsewhere.


Basically, this.

In the general case a triangle list with indices in strip order will perform just as well, if not better, than tri-strips (if only because you can batch more together without having to care about shoving in degenerate triangles or primitive restart indices) BUT for small sizes, such as a quad in the form of two triangles you'll save memory foot print, bandwidth and cache by providing it as a tri-strip.

(The latter two are the two biggest killers of performance today; bandwidth might be large but you can run out quick, same deal with cache. Also keep in mind that vertex fetch is no longer a fixed operation, it is done in the ALU of the hardware via a normal memory fetch.)

Because I am optimizing my particle system now as well I will be going to test this tomorrow.

So, while waiting for data to build I was watching this http://gdcvault.com/play/1020624/Advanced-Visual-Effects-with-DirectX

And there is a bit where they cover particle systems using the vertex shader to expand a quad up.

The TL;DW (too long, didn't watch) version is that for particles;
- don't have a vertex buffer, use vertex id to index into an SRV to get your data
- do an indexed draw - this is slightly faster than an non-index draw (0.52 vs 0.77 (AMD), 0.87 (NV))
- don't instance - apparently draw instance for small meshes is REALLY slow like 0.52 vs 5.1 on a NV Titan for 500k slow. (or 1.5 vs 10.3 for 1M!. AMD; 0.52 v 1.77 and 1.02 vs 3.54); instead fill an index buffer and use that to draw things as a tri-list
- Don't use the Geo-shaders... just... don't. Ever.

This topic is closed to new replies.

Advertisement