Merge pull request #5206 from ligfx/fixcustomtextures

TextureCacheBase: fix custom textures not being loaded
This commit is contained in:
Stenzek 2017-04-05 16:49:54 +10:00 committed by GitHub
commit 27e9e469d4

View File

@ -781,32 +781,33 @@ TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage)
if (!entry) if (!entry)
return nullptr; return nullptr;
if (!hires_tex) const u8* tlut = &texMem[tlutaddr];
if (hires_tex)
{ {
const u8* tlut = &texMem[tlutaddr]; entry->Load(temp, width, height, expandedWidth, 0);
if (decode_on_gpu) }
else if (decode_on_gpu)
{
u32 row_stride = bytes_per_block * (expandedWidth / bsw);
g_texture_cache->DecodeTextureOnGPU(
entry, 0, src_data, texture_size, static_cast<TextureFormat>(texformat), width, height,
expandedWidth, expandedHeight, row_stride, tlut, static_cast<TlutFormat>(tlutfmt));
}
else
{
if (!(texformat == GX_TF_RGBA8 && from_tmem))
{ {
u32 row_stride = bytes_per_block * (expandedWidth / bsw); TexDecoder_Decode(temp, src_data, expandedWidth, expandedHeight, texformat, tlut,
g_texture_cache->DecodeTextureOnGPU( (TlutFormat)tlutfmt);
entry, 0, src_data, texture_size, static_cast<TextureFormat>(texformat), width, height,
expandedWidth, expandedHeight, row_stride, tlut, static_cast<TlutFormat>(tlutfmt));
} }
else else
{ {
if (!(texformat == GX_TF_RGBA8 && from_tmem)) u8* src_data_gb =
{ &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
TexDecoder_Decode(temp, src_data, expandedWidth, expandedHeight, texformat, tlut, TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight);
(TlutFormat)tlutfmt);
}
else
{
u8* src_data_gb =
&texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight);
}
entry->Load(temp, width, height, expandedWidth, 0);
} }
entry->Load(temp, width, height, expandedWidth, 0);
} }
iter = textures_by_address.emplace(address, entry); iter = textures_by_address.emplace(address, entry);