When creating ShaderResourceViews in my engine, I've started assigning them DebugName properties to assist in debugging, using the VS 2013 graphics debugger. I've noticed that since I've started doing this, the underlying Texture objects aren't getting disposed of correctly, and SlimDX complains of memory leaks when the program closes. The code to create a ShaderResourceView looks like this:
CubeMapSRV = ShaderResourceView.FromFile(device, filename);
CubeMapSRV.Resource.DebugName = "sky cubemap";
The code to dispose of the ShaderResourceView looks like this:
if (CubeMapSRV != null){
CubeMapSRV.Dispose();
CubeMapSRV = null;
}
The object creation stack trace printed by SlimDX is indicating that it is the CubeMapSRV.Resource.DebugName assignment that is leaking; specifically, the underlying Texture object. Is assigning the DebugName creating a reference to the Texture somewhere that is hidden from me?