| 10 | { |
| 11 | |
| 12 | bool CreateCubeTexture( ImageIO::HostBitmap& bitmap, Tr2TextureAL& out, uint32_t& memoryUse, Tr2PrimaryRenderContext& renderContext ) |
| 13 | { |
| 14 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 15 | |
| 16 | if( !bitmap.IsValid() ) |
| 17 | { |
| 18 | return false; |
| 19 | } |
| 20 | |
| 21 | const unsigned trueMipLevelCount = bitmap.GetTrueMipCount(); |
| 22 | |
| 23 | std::vector<Tr2SubresourceData> initData; |
| 24 | |
| 25 | for( unsigned face = 0; face != 6; ++face ) |
| 26 | { |
| 27 | for( unsigned i = 0; i != trueMipLevelCount; ++i ) |
| 28 | { |
| 29 | Tr2SubresourceData srd; |
| 30 | srd.m_sysMem = const_cast<char*>( bitmap.GetMipRawData( i, CubemapFace( face ) ) ); |
| 31 | srd.m_sysMemSlicePitch = bitmap.GetMipSize( i ); |
| 32 | srd.m_sysMemPitch = bitmap.GetMipPitch( i ); |
| 33 | |
| 34 | if( !srd.m_sysMem ) |
| 35 | { |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | initData.push_back( srd ); |
| 40 | |
| 41 | memoryUse += srd.m_sysMemSlicePitch; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | return !FAILED( out.Create( bitmap, Tr2GpuUsage::SHADER_RESOURCE, Tr2CpuUsage::READ, &initData[0], renderContext ) ); |
| 46 | } |
| 47 | |
| 48 | bool CreateVolumeTexture( ImageIO::HostBitmap& bitmap, Tr2TextureAL& out, uint32_t& memoryUse, Tr2PrimaryRenderContext& renderContext ) |
| 49 | { |
no test coverage detected