PDA

View Full Version : Sorting Vertex Array



Arath
04-25-2001, 12:09 PM
Hi,

I read one month ago, a paper from nvidia, which shows with graphically that vertex buffer (sorry in DX :-( ) are drawn faster when there are sorted. So, I sorted my vertex array (in openGL so, I'm not treacherous person), but I loose 1,15 millions of polygone, what an ugly performance, isn't it? Anybody know why I get a such slowdown? Is it only working with DX?

Here an example of my vertices indexes before and after sorting :

before : 0;17;18;18;1;0;1;18;19;19
after : 0;1;2;2;3;0;3;2;4;4

and so on ... of course I change my vertex, normals, texture coordinate array to suit with the new index array, do I use a wrong
method?

Arath

PS : I have a GeForce 2 MX.

Korval
04-25-2001, 12:53 PM
You probably got such a slowdown because you spent time you would have been rendering in a sort operation.

I would imagine that sorting only helps through its use of cache memory. If your arrays are separate (as opposed to interleved), they may be stomping on each other's cache memory.

Anyway, I wouldn't be too concerned about this in any event. Since you are using OpenGL, not D3D, you should look into other vertex array optimizations first (CVAs, VARs, etc). And sorting will offer no help to VARs, since the memory is uncached anyway.

mcraighead
04-25-2001, 04:36 PM
No, when you quickly reuse indices, you can get more vertex caching benefits. But that's all.

- Matt

Arath
04-25-2001, 10:24 PM
Hum, I discovered the problem, now I've got the same performance with sorted array than "random" array.I am disappointed, I'll try to implement VAR.

Thanks for your piece of information,
Arath