all repos — mgba @ 4573c22fa87336c371f81be08f9873b2e69fda49

mGBA Game Boy Advance Emulator

Core: Fix tile cache invalidation
Jeffrey Pfau jeffrey@endrift.com
Sun, 23 Oct 2016 11:09:15 -0700
commit

4573c22fa87336c371f81be08f9873b2e69fda49

parent

5a355c3bdd88ee865343ae83675fb433859f1901

2 files changed, 5 insertions(+), 0 deletions(-)

jump to
M src/core/tile-cache.csrc/core/tile-cache.c

@@ -90,6 +90,7 @@ unsigned count = cache->entriesPerTile;

size_t i; for (i = 0; i < count; ++i) { cache->status[(address >> bpp) * count + i].vramClean = 0; + ++cache->status[(address >> bpp) * count + i].vramVersion; } }

@@ -221,6 +222,7 @@ unsigned bpp = cache->bpp;

struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId]; struct mTileCacheEntry desiredStatus = { .paletteVersion = cache->globalPaletteVersion[cPaletteId][paletteId], + .vramVersion = status->vramVersion, .vramClean = 1, .paletteId = paletteId, .activePalette = cPaletteId

@@ -252,6 +254,7 @@ unsigned bpp = cache->bpp;

struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId]; struct mTileCacheEntry desiredStatus = { .paletteVersion = cache->globalPaletteVersion[cPaletteId][paletteId], + .vramVersion = status->vramVersion, .vramClean = 1, .paletteId = paletteId, .activePalette = cPaletteId
M src/core/tile-cache.hsrc/core/tile-cache.h

@@ -20,9 +20,11 @@ DECL_BITS(mTileCacheSystemInfo, MaxTiles, 16, 13);

struct mTileCacheEntry { uint32_t paletteVersion; + uint32_t vramVersion; uint8_t vramClean; uint8_t paletteId; uint8_t activePalette; + uint8_t padding; }; struct mTileCache {