Skip to content

Commit

Permalink
Better fix for texture cache key needing StrideSel
Browse files Browse the repository at this point in the history
StrideSel and ScanOrder are no longer part of the texture cache key
since that breaks RTT texture matching. But they are updated at lookup
time so they will be used if the tex is updated later.
Fixes RTT-based xfade screens in Skies of Arcadia.
  • Loading branch information
flyinghead committed Jul 11, 2018
1 parent d5d711c commit 87f8c51
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/rend/gles/gltex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,6 @@ void ReadRTTBuffer() {
for (tsp.TexU = 0; tsp.TexU <= 7 && (8 << tsp.TexU) < w; tsp.TexU++);
for (tsp.TexV = 0; tsp.TexV <= 7 && (8 << tsp.TexV) < h; tsp.TexV++);

if (8 << tsp.TexU != w)
tcw.StrideSel = 1;

TextureCacheData *texture_data = getTextureCacheData(tsp, tcw);
if (texture_data->texID != 0)
glcache.DeleteTextures(1, &texture_data->texID);
Expand All @@ -641,7 +638,7 @@ static float LastTexCacheStats;

// Only use TexU and TexV from TSP in the cache key
const TSP TSPTextureCacheMask = { { TexV : 7, TexU : 7 } };
const TCW TCWTextureCacheMask = { { TexAddr : 0x1FFFFF, Reserved : 0, StrideSel : 1, ScanOrder : 1, PixelFmt : 7, VQ_Comp : 1, MipMapped : 1 } };
const TCW TCWTextureCacheMask = { { TexAddr : 0x1FFFFF, Reserved : 0, StrideSel : 0, ScanOrder : 0, PixelFmt : 7, VQ_Comp : 1, MipMapped : 1 } };

TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw) {
u64 key = tsp.full & TSPTextureCacheMask.full;
Expand All @@ -657,6 +654,9 @@ TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw) {
if (tx != TexCache.end())
{
tf = &tx->second;
// Needed if the texture is updated
tf->tcw.StrideSel = tcw.StrideSel;
tf->tcw.ScanOrder = tcw.ScanOrder;
}
else //create if not existing
{
Expand Down

0 comments on commit 87f8c51

Please sign in to comment.