MCPcopy Create free account
hub / github.com/carbonengine/trinity / ReleaseResources

Method ReleaseResources

trinity/Resources/TriTextureRes.cpp:356–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356void TriTextureRes::ReleaseResources( TriStorage s )
357{
358 if( m_ownTexture.IsValid() && ( m_ownTexture.GetMemoryClass() & s ) != 0 )
359 {
360 if( m_lodEnabled )
361 {
362 Tr2TextureLodManager::Instance().GpuTextureDestroyed( m_ownTexture.GetDesc() );
363 }
364 m_ownTexture = Tr2TextureAL();
365 }
366
367 if( !m_texture )
368 {
369 return;
370 }
371
372 if( ( s & TRISTORAGE_MANAGEDMEMORY ) || ( ( s & TRISTORAGE_VIDEOMEMORY ) && m_texture->GetMemoryClass() == AL_MEMORY_VIDEO ) )
373 {
374 CCP_STATS_ADD( textureResBytes, -(int)m_memoryUse );
375 m_memoryUse = 0;
376 m_originalMemoryUse = 0;
377
378 CancelPendingLoad();
379 CleanupAsyncSave( false );
380
381 m_ownTexture = Tr2TextureAL();
382 m_texture = nullptr;
383 if( m_wrappedRenderTarget )
384 {
385 m_wrappedRenderTarget->OnTextureChange().UnregisterListener( this );
386 }
387 m_wrappedRenderTarget = nullptr;
388 SetPrepared( false );
389 SetGood( false );
390 m_onTextureChange();
391 }
392}
393
394Tr2TextureAL* TriTextureRes::GetTexture()
395{

Callers

nothing calls this directly

Calls 5

GpuTextureDestroyedMethod · 0.80
UnregisterListenerMethod · 0.80
Tr2TextureALClass · 0.50
IsValidMethod · 0.45
GetMemoryClassMethod · 0.45

Tested by

no test coverage detected