Shared Vertex Buffers Cont.

The plot doesn’t thicken, it plods on like man in a desert holding a can of pudding and desperately looking for a opener. Actually, it isn’t like that at all, but when it gets late you start to get more “poetic” and silly.

profile graph
Profile Data On Swivel! The blue line is the time taken by renderOneFrame() (an Ogre3D function). The yellow line is the time the application takes to update the quad tree and the brown is the amount of time within renderOneFrame() that is taken up by my application updating the render queue and creating/updating vertex/index buffers. The vertical axis is time in milliseconds and the horizontal axis is time in seconds. This chart only shows the main thread and does not include the builder threads that create the mesh data including the heightfields and normal maps.

I uploaded some profile data for the test application that runs in 3 different modes to Swivel, which is a free online data/graphing tool that is in “preview” aka beta. I needed to find a better graphing tool than iWork’s Numbers, which takes 10+ minutes to make graphs of data with more than a handful of rows and columns ugh.

I’ve created a class that encapsulates all the functionality for managing the vertex buffers for the terrain. The class has 3 managing “modes”. It can have all the meshes use a large single vertex buffer, or multiple vertex buffers. When using multiple vertex buffers it can either cache those buffers for later re-use, or immediately delete buffers that are no longer used.

When running in single buffer mode, or multiple shared buffer mode, every mesh that is in the visible list and the visible build list has space in the buffer. Every mesh in the cache list no longer has a guaranteed space in the buffer – however if the cached mesh is still around when we need it later the vertex buffer manager will check to see if that mesh’s data is still in the vertex buffer somewhere.

The nice thing about sharing the vertex buffers is that it means I’m not deleting them like crazy, and because I create enough space to hold a good number of meshes when the program loads I’m not creating buffers like crazy (or expanding them in the case of the single buffer).

Conclusions:
Now that I have coded these 2/3 methods up, I need to do some further testing because so far the only definitive results are that all 3 versions exhibit random spikes in renderOneFrame() that I think are just related to panning the camera around which updates the frustum culling, and that the FPS drops from 310 to 290 when switching from STATIC to DYNAMIC vertex buffers. I plan on making the camera follow a specific path and output profile data for each method using that path so I can better compare the results. Right now it’s just me flying down to the surface and then randomly visiting spots on the surface.

One comment to “Shared Vertex Buffers Cont.”

Comments are closed.