Called on main thread
| 660 | |
| 661 | // Called on main thread |
| 662 | bool TriTextureRes::DoPrepare() |
| 663 | { |
| 664 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 665 | |
| 666 | if( m_lodEnabled ) |
| 667 | { |
| 668 | if( m_ownTexture.IsValid() ) |
| 669 | { |
| 670 | Tr2TextureLodManager::Instance().GpuTextureDestroyed( m_ownTexture.GetDesc() ); |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | m_ownTexture = Tr2TextureAL(); |
| 675 | SetTexture( m_ownTexture ); |
| 676 | |
| 677 | // No need to check for texture load disabled - we wouldn't have gotten here |
| 678 | // if it were. |
| 679 | |
| 680 | if( !Tr2Renderer::IsResourceCreationAllowed() ) |
| 681 | { |
| 682 | return false; |
| 683 | } |
| 684 | |
| 685 | bool isOK = false; |
| 686 | if( m_loadedBitmap ) |
| 687 | { |
| 688 | Tr2TextureAL face; |
| 689 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 690 | uint32_t memoryUse; |
| 691 | if( !Tr2ImageIOHelpers::CreateTexture( *m_loadedBitmap, m_ownTexture, memoryUse, renderContext, USAGE_IMMUTABLE ) ) |
| 692 | { |
| 693 | CCP_LOGWARN( "Tr2ImageHandler failed to create texture '%S'", GetPath() ); |
| 694 | return false; |
| 695 | } |
| 696 | if( m_lodEnabled ) |
| 697 | { |
| 698 | Tr2TextureLodManager::Instance().GpuTextureCreated( m_ownTexture.GetDesc() ); |
| 699 | m_gpuMip = m_cpuMip; |
| 700 | } |
| 701 | |
| 702 | m_ownTexture.SetName( CW2A( GetPath() ) ); |
| 703 | |
| 704 | isOK = true; |
| 705 | SetTexture( m_ownTexture ); |
| 706 | } |
| 707 | |
| 708 | |
| 709 | return isOK; |
| 710 | } |
| 711 | |
| 712 | void TriTextureRes::RequestResolution( const uint32_t requestedLod ) |
| 713 | { |
nothing calls this directly
no test coverage detected