| 773 | } |
| 774 | |
| 775 | void TriTextureRes::ProcessLodRequest( const Tr2TextureLodUpdateRequest& request, Tr2TextureLodManager& manager ) |
| 776 | { |
| 777 | if( request.cachedInRam ) |
| 778 | { |
| 779 | CCP_STATS_ZONE( "CreateTexture" ); |
| 780 | |
| 781 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 782 | |
| 783 | Tr2BitmapDimensions desc; |
| 784 | std::vector<Tr2SubresourceData> initialData; |
| 785 | CreateDescription( *m_loadedBitmap, m_gpuMip + request.mipChange - m_cpuMip, desc, initialData ); |
| 786 | |
| 787 | Tr2TextureAL newTexture; |
| 788 | if( SUCCEEDED( newTexture.Create( desc, Tr2GpuUsage::SHADER_RESOURCE, Tr2CpuUsage::NONE, &initialData[0], renderContext ) ) ) |
| 789 | { |
| 790 | manager.GpuTextureCreated( desc ); |
| 791 | |
| 792 | if( m_ownTexture.IsValid() ) |
| 793 | { |
| 794 | manager.GpuTextureDestroyed( m_ownTexture.GetDesc() ); |
| 795 | } |
| 796 | |
| 797 | m_ownTexture = newTexture; |
| 798 | m_ownTexture.SetName( CW2A( GetPath() ) ); |
| 799 | SetTexture( m_ownTexture ); |
| 800 | NotifyRebuildCachedData(); |
| 801 | m_gpuMip += request.mipChange; |
| 802 | } |
| 803 | else |
| 804 | { |
| 805 | CCP_LOGERR( "Failed to create %ux%u texture %S", desc.GetWidth(), desc.GetHeight(), GetPath() ); |
| 806 | } |
| 807 | } |
| 808 | else |
| 809 | { |
| 810 | Initialize( GetFilePath().c_str(), GetExt() ); |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | uint32_t TriTextureRes::GetOriginalResolution() const |
| 815 | { |
no test coverage detected