什么函数会释放 ID3D11Texture2D?

问题描述

我通过调用创建了一个 ID3D11Texture2D 类型的 currTexture

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

释放分配给此 Texture2D 的资源的正确方法是什么?不存在 ReleaseTexture2D() 函数或类似的东西......

谢谢! :-)

解决方法

确实存在 Release 方法,如您在文档中所见:

"The ID3D11Texture2D interface inherits from ID3D11Resource"

"The ID3D11Resource interface inherits from ID3D11DeviceChild"

"The ID3D11DeviceChild interface inherits from the IUnknown interface"

并且 the IUnknown 有方法 Release

所以当你完成它时调用 currTexture->Release()