VAR and wglAllocateMemoryNV/malloc

I do get a valid pointer back from wglAllocateMemoryNV(). But every combination of readFrequency, writeFrequency, and priority gives me memory which is slower than memory allocated with malloc(). I only write chunks sequencially to the memory via memcpy(); I never read data back from it. Indices are not stored in the VAR-memory obtained by wglAllocateMemoryNV()!

Before rendering a primitive I verify via
GL_VERTEX_ARRAY_RANGE_VALID_NV that the VAR is valid.

Some (read, write, priority)-combinations give me less performance drops (about 10%) but other combinations are halving my FPS or even worse with respect to memory allocated by malloc().

Any suggestions?

You must call glVertexArrayRangeNV on the range before you start drawing (or right after you initialize the array). Here’s is a sample from my code:

fVertices = (GLfloat*)wglAllocateMemoryNV(8*vVertices->size()sizeof(GLfloat), 0.2f, 0.2f, 0.5f);
glVertexArrayRangeNV(8
vVertices->size()*sizeof(GLfloat), fVertices);

Hope it helps.

Yes, I know!

I do something like that (out of my head):

void* ptr = wglAllocateMemoryNV(size, …);
glVertexArrayRangeNV(size, ptr);
glEnableClientState(GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV);

// setup vertex data by memcpy(ptr, …)

// check if VAR is valid
GLint varEnabled = false;
glGetIntegerv(GL_VERTEX_ARRAY_RANGE_VALID_NV, &varEnabled);
if(!varEnabled) {
// warning
} else {
glDrawArrays(…);
}

I have tried all possible combinations of read-frequency, write-frequency, and priority for wglAllocateMemory(), but memory allocated via malloc() is always faster (up to 200%).

Hampel