本文整理汇总了C++中TCacheEntryBase::LoadFromTmem方法的典型用法代码示例。如果您正苦于以下问题:C++ TCacheEntryBase::LoadFromTmem方法的具体用法?C++ TCacheEntryBase::LoadFromTmem怎么用?C++ TCacheEntryBase::LoadFromTmem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCacheEntryBase
的用法示例。
在下文中一共展示了TCacheEntryBase::LoadFromTmem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
//.........这里部分代码省略.........
const bool use_scaling = (g_ActiveConfig.iTexScalingType > 0) && !hires_tex && (width < 384) && (height < 384);
if (use_scaling)
{
config.width *= g_ActiveConfig.iTexScalingFactor;
config.height *= g_ActiveConfig.iTexScalingFactor;
config.pcformat = PC_TEX_FMT_RGBA32;
}
TCacheEntryBase* entry = AllocateTexture(config);
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
iter = textures_by_address.emplace((u64)address, entry);
if (g_ActiveConfig.iSafeTextureCache_ColorSamples == 0 ||
std::max(texture_size, palette_size) <= (u32)g_ActiveConfig.iSafeTextureCache_ColorSamples * 8)
{
entry->textures_by_hash_iter = textures_by_hash.emplace(full_hash, entry);
}
entry->SetGeneralParameters(address, texture_size, full_format);
entry->SetDimensions(nativeW, nativeH, tex_levels);
entry->SetHiresParams(!!hires_tex, basename, use_scaling);
entry->SetHashes(full_hash, tex_hash);
entry->is_efb_copy = false;
// load texture
if (hires_tex)
{
entry->Load(TextureCacheBase::temp, width, height, expandedWidth, 0);
u8 *Bufferptr = TextureCacheBase::temp;
Bufferptr += TextureUtil::GetTextureSizeInBytes(width, height, pcfmt);
for (u32 level = 1; level != texLevels; ++level)
{
u32 mip_width = TextureUtil::CalculateLevelSize(width, level);
u32 mip_height = TextureUtil::CalculateLevelSize(height, level);
entry->Load(Bufferptr, mip_width, mip_height, mip_width, level);
Bufferptr += TextureUtil::GetTextureSizeInBytes(mip_width, mip_height, pcfmt);
}
if (config.materialmap)
{
entry->LoadMaterialMap(Bufferptr, width, height, 0);
Bufferptr += TextureUtil::GetTextureSizeInBytes(width, height, pcfmt);
for (u32 level = 1; level != texLevels; ++level)
{
u32 mip_width = TextureUtil::CalculateLevelSize(width, level);
u32 mip_height = TextureUtil::CalculateLevelSize(height, level);
entry->LoadMaterialMap(Bufferptr, mip_width, mip_height, level);
Bufferptr += TextureUtil::GetTextureSizeInBytes(mip_width, mip_height, pcfmt);
}
}
}
else
{
if (!(texformat == GX_TF_RGBA8 && from_tmem))
{
entry->Load(src_data, width, height, expandedWidth,
expandedHeight, texformat, tlutaddr, (TlutFormat)tlutfmt, 0);
}
else
{
u8* src_data_gb = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
entry->LoadFromTmem(src_data, src_data_gb, width, height, expandedWidth,
expandedHeight, 0);
}
if (g_ActiveConfig.bDumpTextures)
{
DumpTexture(entry, basename, 0);
}
src_data += texture_size;
const u8* ptr_even = NULL;
const u8* ptr_odd = NULL;
if (from_tmem)
{
ptr_even = &texMem[bpmem.tex[stage / 4].texImage1[stage % 4].tmem_even * TMEM_LINE_SIZE + texture_size];
ptr_odd = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
}
for (u32 level = 1; level != texLevels; ++level)
{
const u32 mip_width = TextureUtil::CalculateLevelSize(width, level);
const u32 mip_height = TextureUtil::CalculateLevelSize(height, level);
const u32 expanded_mip_width = ROUND_UP(mip_width, bsw);
const u32 expanded_mip_height = ROUND_UP(mip_height, bsh);
const u8*& mip_src_data = from_tmem
? ((level % 2) ? ptr_odd : ptr_even)
: src_data;
entry->Load(mip_src_data, mip_width, mip_height, expanded_mip_width,
expanded_mip_height, texformat, tlutaddr, (TlutFormat)tlutfmt, level);
mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
if (g_ActiveConfig.bDumpTextures)
DumpTexture(entry, basename, level);
}
}
INCSTAT(stats.numTexturesCreated);
SETSTAT(stats.numTexturesAlive, textures_by_address.size());
entry = DoPartialTextureUpdates(iter);
return ReturnEntry(stage, entry);
}