Merge pull request #6755 from unknownbrackets/clut-fix

Convert all CLUT entries ever loaded
This commit is contained in:
Henrik Rydgård 2014-08-19 22:40:16 -07:00
commit cb2f50bf98
2 changed files with 5 additions and 2 deletions

View File

@ -63,7 +63,7 @@
extern int g_iNumVideos;
TextureCache::TextureCache() : clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL), texelsScaledThisFrame_(0) {
TextureCache::TextureCache() : clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL), clutMaxBytes_(0), texelsScaledThisFrame_(0) {
timesInvalidatedAllThisFrame_ = 0;
lastBoundTexture = -1;
decimationCounter_ = TEXCACHE_DECIMATION_INTERVAL;
@ -909,6 +909,7 @@ void TextureCache::LoadClut() {
}
// Reload the clut next time.
clutLastFormat_ = 0xFFFFFFFF;
clutMaxBytes_ = std::max(clutMaxBytes_, clutTotalBytes_);
}
void TextureCache::UpdateCurrentClut() {
@ -923,7 +924,8 @@ void TextureCache::UpdateCurrentClut() {
// Avoid a copy when we don't need to convert colors.
if (UseBGRA8888() || clutFormat != GE_CMODE_32BIT_ABGR8888) {
ConvertColors(clutBufConverted_, clutBufRaw_, getClutDestFormat(clutFormat), clutExtendedBytes / sizeof(u16));
const int numColors = (clutMaxBytes_ + clutBaseBytes) / (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
ConvertColors(clutBufConverted_, clutBufRaw_, getClutDestFormat(clutFormat), numColors);
clutBuf_ = clutBufConverted_;
} else {
clutBuf_ = clutBufRaw_;

View File

@ -226,6 +226,7 @@ private:
u32 *clutBuf_;
u32 clutHash_;
u32 clutTotalBytes_;
u32 clutMaxBytes_;
// True if the clut is just alpha values in the same order (RGBA4444-bit only.)
bool clutAlphaLinear_;
u16 clutAlphaLinearColor_;