I'm writing a program w/directX api. I'm beginning to use DXUT. I'm having problems when trying to control the reference count of the directX device. It seems that everytime I call D3DXCreateMesh(), D3DXCreateTextureFromFile() or IDirect3DDevice9::CreateVertexBuffer() a reference is added to the device. I've tried using "SYSTEMMEM" flags to store the newly created object(mesh, texture, or vertex buffer) in the system's memory as opposed to storing it within the device's allotment. Here is an example of a call that has added a reference to the device...
DWORD dwNumFaces = 1, dwNumVertices = 3, dwOptions |= D3DXMESH_SYSTEMMEM;
D3DVERTEXELEMENT9 mesh_decl
{
...
}
ID3DXMESH *pMesh = NULL;
D3DXCreateMesh(dwNumFaces, dwNumVertices, dwOptions, mesh_decl, m_pd3dDevice, &pMesh);
Any ideas or link to info concerning this issue? Is this to be expected? The solution so far has been to release the device (m_pd3dDevice->Release()) directly after each call to the above functions. When DXUT tries to release the device, an error is thrown that says the reference count for the device is greater than zero.