Jump to content
  • Advertisement
Sign in to follow this  

How to free D3DPOOL_DEFAULT resource?*solved*

This topic is 4737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using C++ and Direct3D. I have a dynamic vertex buffer in D3DPOOL_DEFAULT memory. My problem is that when I reset the device (for changing resolution and alt tab situations) it fails because the vertex buffer is not freed. The errors: Direct3D9: (ERROR) :The following D3DPOOL_DEFAULT surfaces/buffers/textures still exist Direct3D9: (ERROR) : D3DRTYPE_VERTEXBUFFER Direct3D9: (ERROR) :All user created D3DPOOL_DEFAULT surfaces must be freed before Reset can succeed. Reset Fails. I tried: g_pD3DDevice9->EvictManagedResources(); and if(g_pVertexBuffer) { g_pVertexBuffer->Release(); g_pVertexBuffer=NULL; } before doing reset, but the vertex buffer is still not being freed. Anyone able to help? [Edited by - utilae on June 1, 2005 8:28:12 PM]

Share this post


Link to post
Share on other sites
Advertisement
For debugging (only), check the return value of Release(). It returns the new reference count of the object, which should be zero if the resource is completely destroyed.

If it doesn't return 0, then the resource is referenced from somewhere else, such as an explicit call to AddRef(), or an implicit one (e.g. ID3DXMesh::GetVertexBuffer() increases the reference count of the returned interface).
I heard that SetStreamSource() also increases the reference count of the vertex buffer, but my code doesn't seem to have any problems with it, so I assume it either doesn't, or it uses some other reference count.

Share this post


Link to post
Share on other sites
Ok, thanks I fixed it.

I was changing the displaymode (which involved releasing and recreating the vertex buffer) before I created the vertex buffer.

So I was trying to release the vertex buffer when it wasn't even created yet.

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!