Originally posted by Asgard:
Have you tried using glDrawRangeElements instead of glDrawElements?
***** ONLY FIRST TIME INIT
#ifdef USE_VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 1);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, vertexsno * sizeof(*vertexs), vertexs, GL_STATIC_DRAW_ARB);
#endif
#ifdef USE_VBO
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 2);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, facesno * 3 * sizeof(*faces_short), faces_short, GL_STATIC_DRAW_ARB);
#endif
#ifdef USE_VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 1);
glVertexPointer(3, GL_FLOAT, 0, 0);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 2);
#endif
***** MAIN LOOP
QueryPerformanceCounter((LARGE_INTEGER*)&start_time);
// batches_per_frame = 200, faces_per_batch = 1000. only vertex array enabled
for( j = 0 ; j < batches_per_frame ; j++ ) {
<TAB>glDrawRangeElementsEXT(GL_TRIANGLES, 0, faces_per_batch3, faces_per_batch3, GL_UNSIGNED_SHORT, 0);
<TAB>ret.polys_rendered += faces_per_batch;
<TAB>ret.objects_rendered++;
}
QueryPerformanceCounter((LARGE_INTEGER*)&cur_time);
glDrawRangeElements() Det 52.16 hotspot
EAX = 0A739340
EDX = 0A5FED24 // looks like some memory mapped heap, maybe AGP memory?!?
******* HOTSPOT LOOP STARTS // looks like implicit flush like in NV_VAR?!?
08B0443C movzx ecx,word ptr [edx] // they take short int index here
08B0443F add edx,2 // advance the index pointer
08B04442 mov esi,dword ptr ds:[0A4D6110h] // load the source base addr
08B04448 lea edi,[ecx+ecx2] // clever way to multiply with 3 (3 floats per vertex)
08B0444B lea esi,[esi+edi4] // calculate the final pointer to the source vertex array, base + (index * 3 * sizeof(float))
08B0444E mov edi,dword ptr [esi] // load vertex.x
08B04450 mov ebp,dword ptr [esi+4] // load vertex.y
08B04453 mov dword ptr [eax],edi // store vertex.x
08B04455 mov dword ptr [eax+4],ebp // store vertex.y
08B04458 mov edi,dword ptr [esi+8] // load vertex.z
08B0445B mov dword ptr [eax+8],edi // store vertex.z
08B0445E add eax,0Ch // add sizeof(float) * 3 to destination
08B04461 cmp edx,dword ptr [esp+20h] // end of the copy loop?
08B04465 jne 08B0443C
******* LOOP ENDS
glDrawRangeElements() is not good too, even worse in Det 52.16 because it copies vertices not indexes as you can see
Can ppl from NVIDIA hint what is this copying about and more importantly is there a way to avoid it except wait for the better VBO support?
[This message has been edited by speedy (edited 11-12-2003).]
[This message has been edited by speedy (edited 11-12-2003).]