Does it make sense to include an index by using DrawIndexedPrimitives, when using linelists performance wise? I could imagine it would be easy for the GPU to generate such indexes anyway.
|
|
Indexing provides two major benefits:
If you use a 16-bit index buffer or non-trivial vertex types, your savings with indexing will most likely outweight the memory cost of the extra vertices (ie - a good thing). Also, there is a small bit of GPU overhead with indexing, but it can be very small compared the running the vertex shader many more times than is necessary. Edit I thought of an example where you'd need to use non-indexed vertices. If you want to implement something like horizontal window blinds (picture for clarity), you may start with a model that has them closed (ie, all the blind surfaces are coplanar). To open them you'd apply different rotation matrices to each of the faces. Vertices that overlapped when closed would now be separate in world space. (When closed, the bottom edge of one slat will sit on top of the top edge of the next one down, and when open, they don't touch at all). (Incidentally, that would be a perfect application of instancing [which can be thought of as yet another layer of indexing] if you had many sets of blinds.) |
|||||||||
|
|
If you draw a line where the end point of the first line is the start point of the second line then you can use LineStrip to 'automatically' get indices. If you draw lines where vertices are never shared between lines then indices will get you no benefit at all (might even slow it down). If some part of your vertices are shared then it can indeed be smart to use an index buffer. |
|||
|
|