Single color partition with alpha bugfix.

When we detect that a partition has a single color in each subset, we can generate almost an exact representation of this value for most compression modes. However, when we were doing this subset matching, we were ignoring the error introduced by modes that had completely opaque representations against data that had transparent pixels. This bug fix essentially includes this error in our "best fit" calculations and makes everything work out for the better.
This commit is contained in:
Pavel Krajcevski 2013-03-19 11:58:21 -04:00
parent 6f6ca2d867
commit f825b28051

View File

@ -362,9 +362,12 @@ double BC7CompressionMode::CompressSingleColor(const RGBAVector &p, RGBAVector &
const uint8 val = (pixel >> (ci * 8)) & 0xFF;
int nBits = ci == 3? GetAlphaChannelPrecision() : m_Attributes->colorChannelPrecision;
// If we don't handle this channel, then we don't need to
// worry about how well we interpolate.
if(nBits == 0) { bestValI[ci] = bestValJ[ci] = 0xFF; continue; }
// If we don't handle this channel, then it must be the full value (alpha)
if(nBits == 0) {
bestValI[ci] = bestValJ[ci] = 0xFF;
dist = std::max(dist, (uint32)((uint8)0xFF - val));
continue;
}
const int nPossVals = (1 << nBits);
int possValsH[256];