CBaseStateManager( LPDIRECT3DDEVICE9 pDevice ) : m_lRef( 1UL ), m_pDevice( pDevice ), m_nTotalStateChanges( 0 ), m_nTotalStateChangesPerFrame( 0 ) { // Increment the reference count on the device, because a pointer to it has // been copied for later use m_pDevice->AddRef(); m_wszFrameStats[0] = 0; }
HRESULT KG3DGraphicsEngine::UnInit() { HRESULT hr = E_FAIL; HRESULT hrResult = E_FAIL; if (m_pDeviceCallback) { hr = m_pDeviceCallback->OnDestroyDevice(); KGLOG_COM_PROCESS_ERROR(hr); } hr = UnInitVIM3D(); KGLOG_COM_PROCESS_ERROR(hr); int k = g_pd3dDevice->AddRef(); k = g_pd3dDevice->Release(); VERIFY_RELEASE(g_pd3dDevice); //如果到这里,就表明有资源没有释放干净 VERIFY_RELEASE(m_pD3D); hrResult = S_OK; Exit0: return hrResult; }
ULONG HookIDirect3DDevice9::AddRef(LPVOID _this) { LOG_API(); return pD3Dev->AddRef(); }