XPlane2Blender icon indicating copy to clipboard operation
XPlane2Blender copied to clipboard

Vertex and Index Order Should be GPU Optimized

Open bsupnik opened this issue 9 years ago • 1 comments

The write-out order of the index table and vertex table should be optimized for GPU consumption.

  1. The index table should run in approximately the linear draw order of the TRIS commands of the file. So this is good:

TRIS 0 12 ATTR_foo TRIS 12 24

This is not so good TRIS 108 9 ATTR_foo TRIS 36 3

Ideally the ordering of primitives going into the index table should be the order of primitives after state sorting.

  1. The vertex table should run in approximately linear draw order fro the index table, so this is good:

IDX10 0 1 2 1 3 2 2 3 4 3 5 and this is bad IDX10 108 3 16 41 35 21

One naive way to deal with this is to simply accumulate the vertices from the primitives as they are written into the index table with dupe removal; thus the first primitive will get to have as its first index vertex 0, 1 and 2.

bsupnik avatar Jul 28 '15 16:07 bsupnik

We now have very very fast de-duplication code, but it isn't on by default and I believe exhibits this behavior.

tngreene avatar Jun 05 '20 16:06 tngreene