I'm developing a DX 10 demo for one of my university projects that makes heavily use of render-to-texture, shadow maps, multiple post processing effects, etc.
Until today, I have somehow managed to avoid the "The Direct3D device has a non-zero reference count, meaning some objects were not released." - warning after exiting the application. This was when compiling in debug mode, now I made my first release build and there I get the warning/error again.
Now my question is: What do I exactly have to do to solve this problem. I always thought all I have to do is to do a SAFE_RELEASE() on resources like ID3D10Effect, ID3D10Texture2D, ID3D10ShaderResourceView, ID3D10RenderTargetView before exiting. This does not seem to be enough.
- Which resources do I have to release?
- What if a pointer to a resource was passed to another object and stored there again as a pointer? Do I have to release both pointers?
- Is there any way to see which resources have not been released at a certain point in the program?