Skip to main content
GameDev.net gamedev.net
🔒 Locked

VBO Question

Started by LowCalorieSoftDrink Apr 30, 2004 at 2:17 PM 10 replies 1.6k views
Original Post
LowCalorieSoftDrink
LowCalorieSoftDrink
I get exactly the same performance from vbo''s as i get from normal vertex arrays, so my question, is this because my app is fill rate limited so memory bandwidth is incidental?
Sneftel
Sneftel
Well, there''s a lot of potential reasons. Perhaps you aren''t making efficient use of VBOs. Perhaps your video card doesn''t support them well, and just implements them as VAs. Perhaps your game is indeed fill-rate limited. Perhaps your framerate is already so high that the comparison isn''t statistically meaningful. Perhaps you have vsync turned on.

My question: Is your app currently "fast enough"?


"Sneftel is correct, if rather vulgar." --Flarelocke
LowCalorieSoftDrink
LowCalorieSoftDrink
I have a GeForce FX5600, vsync turned off, and currently i get ~70fps for a 1500 poly per-pixelally lit scene, with shadow volumes (~750 shadow polys using external tris) for 2 lights at 800x600.

Initially i implemented this using vertex arrays for both my geometry and shadow volumes, and expected an increase in framerate if i used a vbo for my geometry. However i get exactly the same performance from a vbo, and i dont mean similar performance, i mean exactly the same.

Which implied to me that the scene is heavily fill rate limited (which i dont think is the case because i get a very similar frame rate at 640x480) or i was doing something wrong with the vbos causing them to be implemented as vas.

As for my app being "fast enough"... i'd hoped for better.

Edit: And my use of vbos is an interleaved vertex array, 32-bit pos, normal and texcoord struct using a vbo indice array.

[edited by - LowCalorieSoftDrink on April 30, 2004 8:25:50 PM]
Sneftel
Sneftel
So is vsync turned on?

EDIT: whoops, didn't see that. K, I'm stumped for now. Anyone else?


"Sneftel is correct, if rather vulgar." --Flarelocke

[edited by - sneftel on April 30, 2004 8:27:10 PM]
benjamin bunny
benjamin bunny
Are your VBOs setup for static or dynamic rendering (DYNAMIC_DRAW_ARB/STATIC_DRAW_ARB)? If you''re using dynamic rendering then it''s possible the driver is falling back to standard VAs internally.
LowCalorieSoftDrink
LowCalorieSoftDrink
Ok...

Creating the buffer...


void TRenderer :: BuildVBuffer( TVBInfo* pInfo )
{
pInfo->VBO = pInfo->VBO && mVBOAvail;

if( pInfo->VBO )
{
glGenBuffers( 1, &pInfo->RCID );
glBindBuffer( GL_ARRAY_BUFFER_ARB, pInfo->RCID );
glBufferData( GL_ARRAY_BUFFER_ARB, pInfo->Size * pInfo->Count, pInfo->Data, GL_STATIC_DRAW_ARB );
}
}



Binding the buffer...



void TRenderInterface :: BindBuffer( TVBInfo* pBuffer )
{
mBuffer = pBuffer;

mBuffer->VBO ? glBindBuffer( GL_ARRAY_BUFFER_ARB, mBuffer->RCID ) : glBindBuffer( GL_ARRAY_BUFFER_ARB, 0 );

for( int i = 0; i < mNumTexUnits; ++i ) mTexCoordsBound[i] = false;

mColorsBound = mNormalsBound = mSecColorsBound = mVerticesBound = false;
}




Then for vertices, normals etc there is a binding function similar to below



void TRenderInterface :: BindVertices( TType pType, int pNumElements, uint pOffset )
{
if( mBuffer->VBO )
glVertexPointer( pNumElements, pType, mBuffer->Stride, (void*)pOffset );
else
glVertexPointer( pNumElements, pType, mBuffer->Stride, (char*)mBuffer->Data + pOffset );

if( !mVerticesActive ) glEnableClientState( GL_VERTEX_ARRAY );

mVerticesBound = mVerticesActive = true;
}




and finally for drawing the contents of the buffer...


void TRenderInterface :: DrawElements( TType pType, TShape pShapes, TIBInfo* pBuffer )
{
SetBufferStates();

if( pBuffer->VBO )
{
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, pBuffer->RCID );

glDrawElements( pShapes, pBuffer->NumIndices, pType, 0 );

glBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
}
else glDrawElements( pShapes, pBuffer->NumIndices, pType, pBuffer->Indices );
}


Edit: SetBufferState merely disables any unbound attribute pointers

The system is inter-changeable between VAs and VBOs by setting the vbuffer's/ibuffer's VBO attribute, as well as whether the card supports VBOs (mVBOAvail). I have ensured that the VBO code path is used by following the flow of execution from within the debugger, so thats not my problem. I would assume the data transfer and offset setting is correct as all geometry is renderd correctly.

[edited by - LowCalorieSoftDrink on May 1, 2004 9:25:57 AM]
Ysaneya
Ysaneya
If your scene is 1500 polys only, you're certainly not transform or bandwidth limited, so using VBO or not will not make a difference. I'd check fillrate or CPU first, but since you mention shadow volumes (fillrate intensive) and per pixel lighting.. the former sounds more likely.

Y.


[edited by - Ysaneya on May 1, 2004 10:36:52 AM]
LowCalorieSoftDrink
LowCalorieSoftDrink
Ok, i guessed as much... what would be a conclusive method to test if it is the fillrate?

Thanks for the help

[edited by - LowCalorieSoftDrink on May 1, 2004 3:21:58 PM]
JD
JD
Decrease the screen res. If the app speeds up you''re fill rate limited if not you''re xform limited. Most likely you''re fill rate limited like filling stencil buffer with shadows and multipassing the lights.

Is there a mismatch between vertex and index buffers? One in video the other in system ram? I can see how the verts in video ram would be stalled waiting for indices to ship off from system or agp ram. Maybe not, probably fill rate limited like I''m.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.