E_OUTOFMEMORY when creating vertex buffer

Started by
5 comments, last by Evil Steve 15 years, 7 months ago
Hi, I´m trying to run some old code on my new computer but strangely I get these vertex buffers that fail to create. The CreateVertexBuffer function returns E_OUTOFMEMORY. The program worked fine on my old computer. The old computer had a lot less mem and an old graphics card, GeForce 4200. Now I have a lot more system mem and a big-ass Geforce 9800 GX2, so I find it very strange that it runs out of memory so quickly. Only explanation I can think of is that it has something to to with Windows Vista. The old computer had Windows XP. I´m running the program on DirectX9. Are there any things I should consider when switching over to Vista? Peter
Advertisement
Nothing I can think of offhand. Can we see some code? What size is the vertex buffer? What flags do you use?
CreateVertexBuffer(pByteCount, D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &FD3DVertexBuffer9, NULL);

I checked pByteCount to see if there were abnormal values. pByteCount is a little above 42000 when it fails. It creates a bunch of other buffers succesfully before one fails.

Peter
How many other resources have been created before that point, and what's the total size?

EDIT: And do the Debug Runtimes say anything?
One recommendation I have is to not create vertex buffers in the default pool unless they are dynamic vertex buffers (i.e. they get written to a lot). For buffers which are dynamic pass the D3DUSAGE_DYNAMIC flag as well as D3DUSAGE_WRITEONLY.

Same goes for textures and index buffers. Put them in the managed pool unless they are dynamic (or are render target textures).
Problem is solved. I found a bad memory overwrite somewhere else in the code, wasn´t related to D3D.

Thanks for the help, and the advice about using the managed pool. I am using buffers that are written regularly but not every frame. Once per 30 secs or so. Should I make them dynamic or not?

Peter
Quote:Original post by PeterV
Thanks for the help, and the advice about using the managed pool. I am using buffers that are written regularly but not every frame. Once per 30 secs or so. Should I make them dynamic or not?
They can probably be static, but it'd be best to profile and make sure - there might be a bit of a stutter when they're updated.

This topic is closed to new replies.

Advertisement