Original Post
Today, overlooking the docs, I read:
Quote:Firing the search with "SetTexture" on MSDN didn't worked as expected while firing google with "IDirect3ddevice9 SetTexture NULL behaviour" returned this interesting forum thread. From here, I see that textures reference counts (as well as other) are decremented on change so calling SetTexture(..., NULL) seems to be necessary only for the "last resource". Is this correct? While I understand the need to avoid destroying objects while they are being used, this seems a bit overkill to me. Is this going away with D3D10? Is this going to be documented in the appropriate pages? Does this apply to every resource created with a Create*** call?
Texture resources Note: The IDirect3DDevice9::SetTexture method increments the reference count of the texture surface being assigned. When the texture is no longer needed, you should set the texture at the appropriate stage to NULL. If you fail to do this, the surface will not be released, resulting in a memory leak.