Sign in to follow this  
PeterV

E_OUTOFMEMORY when creating vertex buffer

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this