diff --git a/BPTCEncoder/include/FasTC/BPTCCompressor.h b/BPTCEncoder/include/FasTC/BPTCCompressor.h index 5d7ecbf..16fd41f 100755 --- a/BPTCEncoder/include/FasTC/BPTCCompressor.h +++ b/BPTCEncoder/include/FasTC/BPTCCompressor.h @@ -127,11 +127,11 @@ namespace BPTCC { // between zero and sixty-four that corresponds to one of the available // partitioning schemes defined by the BPTC format. struct ShapeSelection { - // This is the number of indices from which to select the appropriate - // shapes. I.e. the compressor will try the first m_NumIndices shapes - uint32 m_NumIndices; + // This is the number of valid shapes in m_Shapes + uint32 m_NumShapesToSearch; - // These are the shape indices to use when evaluating two-partition shapes. + // These are the shape indices to use when evaluating shapes. + // I.e. the shapes that the compressor will try to optimize. Shape m_Shapes[10]; // This is the additional mask to prevent modes once shape selection @@ -141,7 +141,7 @@ namespace BPTCC { // Defaults ShapeSelection() - : m_NumIndices(0) + : m_NumShapesToSearch(0) , m_SelectedModes(static_cast(0xFF)) { } }; diff --git a/BPTCEncoder/src/Compressor.cpp b/BPTCEncoder/src/Compressor.cpp index 7942270..c9e67bd 100755 --- a/BPTCEncoder/src/Compressor.cpp +++ b/BPTCEncoder/src/Compressor.cpp @@ -1722,7 +1722,7 @@ static ShapeSelection BoxSelection( RGBACluster cluster(pixels); - result.m_NumIndices = 1; + result.m_NumShapesToSearch = 1; for(unsigned int i = 0; i < kNumShapes2; i++) { cluster.SetShapeIndex(i, 2); @@ -1758,7 +1758,7 @@ static ShapeSelection BoxSelection( ~(static_cast(eBlockMode_Four) | static_cast(eBlockMode_Five)); - result.m_NumIndices++; + result.m_NumShapesToSearch++; for(unsigned int i = 0; i < kNumShapes3; i++) { cluster.SetShapeIndex(i, 3); @@ -1794,7 +1794,7 @@ static void CompressClusters(const ShapeSelection &selection, const uint32 pixel CompressionMode::Params bestParams; uint32 selectedModes = selection.m_SelectedModes; - uint32 numShapeIndices = std::min(5, selection.m_NumIndices); + uint32 numShapeIndices = std::min(5, selection.m_NumShapesToSearch); // If we don't have any indices, turn off two and three partition modes, // since the compressor will simply ignore the shapeIndex variable afterwards... @@ -2102,7 +2102,7 @@ static void CompressBC7Block( ShapeSelection selection; uint32 path = 0; - selection.m_NumIndices = 1; + selection.m_NumShapesToSearch = 1; for(unsigned int i = 0; i < kNumShapes2; i++) { blockCluster.SetShapeIndex(i, 2); @@ -2156,7 +2156,7 @@ static void CompressBC7Block( // There are not 3 subset blocks that support alpha, so only check these // if the entire block is opaque. if(opaque) { - selection.m_NumIndices++; + selection.m_NumShapesToSearch++; for(unsigned int i = 0; i < kNumShapes3; i++) { blockCluster.SetShapeIndex(i, 3); diff --git a/DXTEncoder/src/Decompressor.cpp b/DXTEncoder/src/Decompressor.cpp index 46ed919..42e0ea3 100644 --- a/DXTEncoder/src/Decompressor.cpp +++ b/DXTEncoder/src/Decompressor.cpp @@ -61,6 +61,10 @@ namespace DXTC { void DecompressDXT1Block(const uint8 *block, uint32 *outBuf) { + // When we call FasTC::Pixel::FromBits, we expect the bits + // to be read out of memory in LSB (byte) order first. Hence, + // we can't read the blocks directly as uint16 values out of + // the DXT buffer and we have to swap the bytes before hand. uint16 colorA = block[0]; colorA <<= 8; colorA |= block[1];