Optimize DXT1 index order fixing.

This commit is contained in:
Bartosz Taudul 2020-06-11 03:04:09 +02:00
parent aa3b0de1f5
commit 191ff93822

View File

@ -219,10 +219,11 @@ void TextureCompression::FixOrder( char* data, size_t blocks )
assert( blocks > 0 ); assert( blocks > 0 );
do do
{ {
uint8_t tmp[4]; uint32_t res = 0;
memcpy( tmp, data+4, 4 ); uint32_t tmp;
for( int k=0; k<4; k++ ) tmp[k] = DxtcIndexTable[(uint8_t)tmp[k]]; memcpy( &tmp, data+4, 4 );
memcpy( data+4, tmp, 4 ); for( int k=0; k<4; k++ ) res |= DxtcIndexTable[(tmp >> (k*8)) & 0xFF] << (k*8);
memcpy( data+4, &res, 4 );
data += 8; data += 8;
} }
while( --blocks ); while( --blocks );