Vertex Array Range Memory Mangement

I use a simple method or memcpy’ing all my data in to some rotating partitions in the agp memory.

I think that as a general rule better performance can be gained by using a memory manager on the AGP ram and allocating memory from thsi pool for the vert\etc arrays from the API and assigning it directly to models as they are created. This way when you ‘draw’ a model you just need to call the API with the index list.

This scheme doesn’t work too well if there is insufficient ram, so you’ll need to fall back to the ‘copy in to a partition’ method.

Has anyone worked through this?

Chris

As you said, in a case of sufficient AGP memory you can allocate vertex arrays directly on the AGP memory. A problem arise when you want your data to be dynamic. You need to change the AGP mem directly (quite slow, no caching, you must write sequentially) or to have another copy on the regular memory (change it, and then memcpy). Take into account that reading from the AGP memory is extremely slow.

Try to have a static partition and a dynamic partition. Don’t touch the static, and have your dynamic data copied from your original buffers. Again, if you don’t have enough memory, you must recycle some of your memory - memcpy every frame. You can use fences to maximize the parallelization of the memcpy and the rendering operations.

Anyway, try to put as much static data into the static partition, and for the rest of the data (dynamic and static) the memory must be recycled.

Shlomi.