In general, you don't ever have to call AddRef() yourself, except for testing, to see how many references you already have to an object. For instance, here's some code from my renderer -- this is the only place in my code base where I ever call AddRef().
#ifndef _FINALRELEASE
inline ulong NRenderer::GetRef(LPUNKNOWN obj)
{
ulong retVal = 0x7A31C7; // for sanity
if (obj)
{
obj->AddRef();
retVal = obj->Release();
}
return retVal;
}
#else
inline ulong NRenderer::GetRef(LPUNKNOWN)
{
return 0;
}
#endif
References can be added by a variety of function calls, but in general, anything that creates an object (e.g., IDirect3DDevice9::CreateTexture()) or assigns a reference to an object to another object (e.g., ID3DXBaseEffect::SetTexture()) will increment the reference count by at least one.