1
\$\begingroup\$

Let's say that I want to take advantage of GPU transform cache and use tristrips for that purpose. In the first case we have three triangles: 012, 213, 234. In the second case we used tristrip topology and passed indices to GPU: 0 1 2 3 4. In both cases all vertices will be cached on GPU. The only difference is the size of index buffer. In the first case (triangle topology) the size is 9. In the second case the size is 5. Even if we get 2x-3x size reduction, the index buffer is usually not the bottleneck. So, the question is why we get performance boost when using triangle strip vs indexed triangles in OpenGL?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Trianlge strips don't necessarily give increased performance

In the old days (pre-1998/99) GPU vendors used to recommend triangle strips as the optimal primitive type, but that was in a very specific case - non-indexed triangle strips using the GL_TRIANGLE_STRIP mode via glDrawArrays or glBegin/glEnd.

In 1998/99 something happened - Quake III Arena was launched. Back in those days the latest id Software game was the benchmarking tool of choice, and magazines and other publications used to regularly list performance figures. If you were a hardware manufacturer you needed to have this game run as fast as possible.

John Carmack wrote a note entitled Optimizing OpenGL drivers for Quake3 which contains the following little snippet:

Quake3’s rendering architecture has been defined with the primary goal of minimizing API calls and focusing as much work as possible in a single place to make optimization more productive.

During gameplay, 99.9% of all primitives go through a single API point:

glDrawElements( GL_TRIANGLES, numIndexes, GL_UNSIGNED_INT, indexes );

This was the beginning of indexed triangles (rather than strips) being the preferred performance path, although it's reasonable to assume that this was the result of back-and-forth discussion between Carmack and hardware manufacturers rather than something he pushed himself.

If you see anything recommending strips as the optimal primitive type then you need to look at the date it was published; the probabilitity is that it is something from 1998 or before.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .