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

Method ProcessLodRequest

trinity/Resources/TriTextureRes.cpp:775–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775void 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
814uint32_t TriTextureRes::GetOriginalResolution() const
815{

Callers 1

OnTickMethod · 0.80

Calls 9

CreateDescriptionFunction · 0.85
GpuTextureCreatedMethod · 0.80
GpuTextureDestroyedMethod · 0.80
InitializeFunction · 0.50
CreateMethod · 0.45
IsValidMethod · 0.45
SetNameMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected