vertex buffer crashes


10-02-2012 10:06:53

I am getting frequent crashes with paged geometry, I am assuming from overloading the memory. It usually crashes on createVertexBuffer() in BatchedGeometry::SubBatch::build, or sometimes i get an exception "D3Dvertex buffer error".
I'm keeping view range and batch size very low, and the vegetation is sparse, its a desert not a forest. On the other hand the tree meshes have quite a few polys ranging 1500-4000.
Also its a large world so I'm loading in new pages of pagedgeometry, and unloading the old ones as I move every km or so.

These crashes are BAD for me. I have a few thousand players many with weaker video cards (I have a 1GB video card and it crashes), my bug report forum will be flooded if i release it like this.
What I need is some kind of memory manager in paged geometry that will detect in advance if the user is low on memory and queue up the request for later instead of crashing the app. Maybe assign resources from a limited pool or something, stop things being created without others being unloaded first.
Thing is I have no idea how to detect when memory is low. Can anyone give me some advice where to start here? Or I can pay good money to anyone who wants to do it for me :) ?


13-02-2012 08:19:04

I'm facing a really similar problem too. I'm using Grass and Tree loaders, and after moving for a little while, I get a "ran out of memory" D3D9 Vertex Buffer exception either in the createBuffer() or createIndexBuffer() methods.
If I catch the exception and remove/delete the PagedGeometry instance that has caused the exception, everything works flowlessy afterwards (but without grass or trees). If I force reloading the whole PagedGeometry when catching the exception, it continues for a couple of frames, then rises the exception again, causing some "blinking" (and is still not a clean solution). The only way I managed to "solve" the problem is by reducing the pages' size.
Does anyone have a clue about this? Is it related to how the GPU handles the loading/unloading of the vertex buffer content?


13-02-2012 13:29:51

I've done similar to you. I've put a try/catch around the offending code just as a safety barrier, and I've taken all my large/complicated geometry out and put it into a normal ogre static geometry thing. I'm just using pagedgeometry for the grass and the close-up, smaller simple foliage.


13-02-2012 16:57:40

I programmed using DirectX 9 SDK for a long time, have transited more than 5 years.
Now I use OpenGL and unfortunately prompt with a problem I can not. In GL it is possible and not to delete the old buffer, but Ogre on allows to change the size of the buffer on the fly, it is necessary to recreate it.

Buffer pool usage, will probably solve a problem, but this cardinal change. As I can recommend to update the video card driver, occasionally it works wonders :D


08-12-2013 22:37:42

you've probably already solved this... but i run into the same issue with my project.

paged geometry uses static batching which requires a ton of memory in return for drastically reducing batch counts over using individual entities.

static geometry has to copy the vertexes for every mesh * the number of instances in the world. i.e. if you have 3 instances of the same tree mesh, then paged geometry (using static geometry) must copy the vertexes 3 times into memory.

i posted a version of page geometry's batch page that uses hardware instancing which costs much less memory. you do pay some runtime cost as the vertex shader needs to transform the per-instance data instead of upfront when you make the copies.

see this for more background: ... ter03.html