Core: Fix tile cache invalidation

This commit is contained in:
Jeffrey Pfau 2016-10-23 11:09:15 -07:00
parent 5a355c3bdd
commit 4573c22fa8
2 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,7 @@ void mTileCacheWriteVRAM(struct mTileCache* cache, uint32_t address) {
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 @@ const uint16_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, uns
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 @@ const uint16_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileC
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

View File

@ -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 {