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

Method OpenShared

trinity/Resources/TriTextureRes.cpp:1132–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130}
1131
1132ALResult TriTextureRes::OpenShared( uintptr_t handle )
1133{
1134 DestroyOwnTexture();
1135
1136 USE_MAIN_THREAD_RENDER_CONTEXT();
1137
1138 CR_RETURN_HR( m_ownTexture.OpenShared( handle, Tr2GpuUsage::SHADER_RESOURCE, renderContext ) );
1139
1140 *static_cast<Tr2BitmapDimensions*>( this ) = m_ownTexture.GetDesc();
1141
1142 m_memoryUse = 0;
1143 auto trueMipCount = GetTrueMipCount();
1144 for( uint32_t i = 0; i < trueMipCount; ++i )
1145 {
1146 m_memoryUse += GetMipSize( i );
1147 }
1148 m_memoryUse *= std::max( 1u, GetArraySize() );
1149 m_originalMemoryUse = m_memoryUse;
1150
1151 CCP_STATS_ADD( textureResBytes, m_memoryUse );
1152 SetTexture( m_ownTexture );
1153 SetPrepared( true );
1154 SetGood( true );
1155 return S_OK;
1156}
1157
1158// ---------------------------------------------------------------
1159bool TriTextureRes::SetTexture( Tr2TextureAL& texture )

Callers 1

OpenSharedTextureFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected