TextureCacheBase: Fix a potential bug when using custom textures.
This commit is contained in:
parent
249afa5eac
commit
5a78351033
|
@ -377,7 +377,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
|
||||||
//
|
//
|
||||||
// TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies?
|
// TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies?
|
||||||
// TODO: Actually, it should be enough if the internal texture format matches...
|
// TODO: Actually, it should be enough if the internal texture format matches...
|
||||||
if ((entry->type == TCET_NORMAL && width == entry->native_width && height == entry->native_height && full_format == entry->format && entry->num_mipmaps == maxlevel)
|
if ((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height && full_format == entry->format && entry->num_mipmaps == maxlevel)
|
||||||
|| (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height))
|
|| (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height))
|
||||||
{
|
{
|
||||||
// reuse the texture
|
// reuse the texture
|
||||||
|
@ -395,15 +395,22 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
|
||||||
{
|
{
|
||||||
pcfmt = LoadCustomTexture(tex_hash, texformat, 0, width, height);
|
pcfmt = LoadCustomTexture(tex_hash, texformat, 0, width, height);
|
||||||
if (pcfmt != PC_TEX_FMT_NONE)
|
if (pcfmt != PC_TEX_FMT_NONE)
|
||||||
|
{
|
||||||
|
if (expandedWidth != width || expandedHeight != height)
|
||||||
{
|
{
|
||||||
expandedWidth = width;
|
expandedWidth = width;
|
||||||
expandedHeight = height;
|
expandedHeight = height;
|
||||||
|
|
||||||
|
// If we thought we could reuse the texture before, make sure to delete it now!
|
||||||
|
delete entry;
|
||||||
|
entry = NULL;
|
||||||
|
}
|
||||||
using_custom_texture = true;
|
using_custom_texture = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems when preloading is enabled
|
// TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems here when preloading is enabled
|
||||||
if (pcfmt == PC_TEX_FMT_NONE)
|
if (!using_custom_texture)
|
||||||
pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth,
|
pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth,
|
||||||
expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
|
expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue