Search code examples
winapidirectxdirectx-11direct3ddirect3d11

What function releases a ID3D11Texture2D?


I create a currTexture of type ID3D11Texture2D via a call to

ID3D11Device->CreateTexture2D(&m_desc, NULL, &currTexture);

What is the proper way to release the resources assigned to this Texture2D? There does not exist a ReleaseTexture2D()-function or something like that…

Thanks! :-)


Solution

  • There does exists a Release method as you can see in the docs:

    "The ID3D11Texture2D interface inherits from ID3D11Resource".

    "The ID3D11Resource interface inherits from ID3D11DeviceChild".

    "The ID3D11DeviceChild interface inherits from the IUnknown interface".

    And the IUnknown has method Release.

    So call currTexture->Release() when you are done with it.