Lock/UnlockArraysEXT

What is the right use of this extension, and what are the benefits?

It’s used by locking your vertex arrays after specifying vertex, normal etc. pointers. Then you call glDrawElements, and after that unlock the arrays.

The arrays can be precompiled at the locking time by the driver. A common advantage is, that shared vertice get transformed only once. The advantage gets bigger if you multipass over the same object, since you can compile (lock) the object once and draw it several times.

-Ilkka

Thanks. So if one vertex is common for n triangles it’s tranformed just once, and you spare n-1 transformations, right?
And one more question : is it compatible with glInterleavedArrays?

Yes, it is compatible.

The real benefit comes for multi-pass algorithms:

VertexPointer()
LockArrays()
foreach texture layer:
TexCoordPointer()
BindTexture()
DrawElements()
UnlockArrays()

Hey, are you really allowed to change texCoordPointer after lockArrays? That would be great, but I thought you can’t do that.

-Ilkka

The CVA spec is about as vague as you can get on this point. So you can probably change it, but it might trigger a re transform of geometry. On the other hand, that’s what happens on hw T&L cards anyway, since they can’t “save” transformed vertices.

It might trigger a re transform of geometry. On the other hand, that’s what happens on hw T&L cards anyway, since they can’t “save” transformed vertices.

Wouldn´t this mean, that CVA´s are good with shared vertices, but not with mutlipass rendering, because the computations of the first pass are not available in the second?

Jan.

With CVA, the computations ARE available for second passes, if you change nothing except bind new textures and change texenv.

However, an optimized driver may realize that it doesn’t need to re-transform vertex position and normal values just because you re-specify the texture coordinate array, unless you have texgen enabled.

Even when it has to re-transform, it can do it in a much more efficient way, because you tell it what the minimum and maximum vertex index you’ll use is; it can use a highly efficient streaming transform path to just transform the entire chunk between start and end.