Detect if framebuffer clut uses alpha.

It's not a perfect check but it may allow skipping alphatests sometimes.
This commit is contained in:
Unknown W. Brackets 2014-06-03 01:06:02 -07:00
parent bf788e278d
commit 238bdce2b8

View file

@ -951,8 +951,14 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) {
glstate.Restore();
framebufferManager_->RebindFramebuffer();
gstate_c.textureFullAlpha = false;
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
const GEPaletteFormat clutFormat = gstate.getClutPaletteFormat();
const u32 clutBase = gstate.getClutIndexStartPos();
const u32 bytesPerColor = clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16);
const u32 clutExtendedColors = (clutTotalBytes_ / bytesPerColor) + clutBase;
TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormat(gstate.getClutPaletteFormat()), clutExtendedColors, clutExtendedColors, 1);
gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
} else {
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
framebufferManager_->BindFramebufferColor(entry->framebuffer);