mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-22 05:23:40 +00:00
Add some better comments
This commit is contained in:
parent
599152575b
commit
13d8407163
3 changed files with 14 additions and 10 deletions
|
@ -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<EBlockMode>(0xFF))
|
||||
{ }
|
||||
};
|
||||
|
|
|
@ -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<uint32>(eBlockMode_Four) |
|
||||
static_cast<uint32>(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<uint32>(5, selection.m_NumIndices);
|
||||
uint32 numShapeIndices = std::min<uint32>(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);
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue