GSTextureCache: Add ASSERTs on pal value to ease debugging.

This commit is contained in:
Alessandro Vetere 2018-12-10 21:11:52 +01:00 committed by lightningterror
parent acbe6c24a0
commit 774373cc65
1 changed files with 4 additions and 0 deletions

View File

@ -2092,6 +2092,8 @@ std::size_t GSTextureCache::PaletteKeyHash::operator()(const PaletteKey &key) co
uint16 pal = key.pal; uint16 pal = key.pal;
const uint32* clut = key.clut; const uint32* clut = key.clut;
ASSERT((pal & 15) == 0);
size_t clut_hash = 3831179159; size_t clut_hash = 3831179159;
for (uint16 i = 0; i < pal; i += 16) { for (uint16 i = 0; i < pal; i += 16) {
clut_hash = (clut_hash + 1488000301) ^ (clut[i] + 33644011); clut_hash = (clut_hash + 1488000301) ^ (clut[i] + 33644011);
@ -2140,6 +2142,8 @@ GSTextureCache::PaletteMap::PaletteMap(const GSRenderer* renderer) {
// Retrieves the palette with the desired clut // Retrieves the palette with the desired clut
std::shared_ptr<GSTextureCache::Palette> GSTextureCache::PaletteMap::LookupPalette(uint16 pal, bool need_gs_texture) { std::shared_ptr<GSTextureCache::Palette> GSTextureCache::PaletteMap::LookupPalette(uint16 pal, bool need_gs_texture) {
ASSERT(pal == 16 || pal == 256);
// Choose which hash map search into: // Choose which hash map search into:
// pal == 16 : index 0 // pal == 16 : index 0
// pal == 256 : index 1 // pal == 256 : index 1