Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ID3D11Texture2D (that I've created manually) inside a ID3D11ShaderResourceView. When I want to Release() the resource view, do I need to Release() the texture that it is inside too? Or is it not necessary to do so?

Msdn doc and Google couldn't help me on this one. :/

share|improve this question
up vote 2 down vote accepted

Yes. Any reference you have to a D3D object needs a Release() call when you're done with it. It doesn't matter whether another object might also have a reference to it. The object will not be deleted until all references to it are gone, so it's safe to Release() the texture as soon as you don't need the pointer to it anymore. If it's also referenced by an SRV, that reference will keep it alive until the SRV is also deleted.

share|improve this answer
Thanks for your answer. So this would be okay to do? HRESULT res = d3dDevice->CreateShaderResourceView(ret_texture, &desc, &SRV); ret_texture->Release(); // ... Do more stuff with SRV object – Kaboose Apr 29 '13 at 17:07
@Kaboose Yes, that should be fine. – Nathan Reed Apr 29 '13 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.