diff options
Diffstat (limited to 'source/blender/imbuf/intern/dds/BlockDXT.h')
-rw-r--r-- | source/blender/imbuf/intern/dds/BlockDXT.h | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index 5c232201f0c..ae640f6b5cc 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -143,29 +143,51 @@ struct BlockDXT3 /// DXT5 alpha block. struct AlphaBlockDXT5 { + // uint64 unions do not compile on all platforms + /* union { struct { - unsigned int alpha0 : 8; // 8 - unsigned int alpha1 : 8; // 16 - unsigned int bits0 : 3; // 3 - 19 - unsigned int bits1 : 3; // 6 - 22 - unsigned int bits2 : 3; // 9 - 25 - unsigned int bits3 : 3; // 12 - 28 - unsigned int bits4 : 3; // 15 - 31 - unsigned int bits5 : 3; // 18 - 34 - unsigned int bits6 : 3; // 21 - 37 - unsigned int bits7 : 3; // 24 - 40 - unsigned int bits8 : 3; // 27 - 43 - unsigned int bits9 : 3; // 30 - 46 - unsigned int bitsA : 3; // 33 - 49 - unsigned int bitsB : 3; // 36 - 52 - unsigned int bitsC : 3; // 39 - 55 - unsigned int bitsD : 3; // 42 - 58 - unsigned int bitsE : 3; // 45 - 61 - unsigned int bitsF : 3; // 48 - 64 + uint64 alpha0 : 8; // 8 + uint64 alpha1 : 8; // 16 + uint64 bits0 : 3; // 3 - 19 + uint64 bits1 : 3; // 6 - 22 + uint64 bits2 : 3; // 9 - 25 + uint64 bits3 : 3; // 12 - 28 + uint64 bits4 : 3; // 15 - 31 + uint64 bits5 : 3; // 18 - 34 + uint64 bits6 : 3; // 21 - 37 + uint64 bits7 : 3; // 24 - 40 + uint64 bits8 : 3; // 27 - 43 + uint64 bits9 : 3; // 30 - 46 + uint64 bitsA : 3; // 33 - 49 + uint64 bitsB : 3; // 36 - 52 + uint64 bitsC : 3; // 39 - 55 + uint64 bitsD : 3; // 42 - 58 + uint64 bitsE : 3; // 45 - 61 + uint64 bitsF : 3; // 48 - 64 }; uint64 u; }; + */ + uint64 u; + uint8 alpha0() const { return u & 0xffLL; }; + uint8 alpha1() const { return (u >> 8) & 0xffLL; }; + uint8 bits0() const { return (u >> 16) & 0x7LL; }; + uint8 bits1() const { return (u >> 19) & 0x7LL; }; + uint8 bits2() const { return (u >> 22) & 0x7LL; }; + uint8 bits3() const { return (u >> 25) & 0x7LL; }; + uint8 bits4() const { return (u >> 28) & 0x7LL; }; + uint8 bits5() const { return (u >> 31) & 0x7LL; }; + uint8 bits6() const { return (u >> 34) & 0x7LL; }; + uint8 bits7() const { return (u >> 37) & 0x7LL; }; + uint8 bits8() const { return (u >> 40) & 0x7LL; }; + uint8 bits9() const { return (u >> 43) & 0x7LL; }; + uint8 bitsA() const { return (u >> 46) & 0x7LL; }; + uint8 bitsB() const { return (u >> 49) & 0x7LL; }; + uint8 bitsC() const { return (u >> 52) & 0x7LL; }; + uint8 bitsD() const { return (u >> 55) & 0x7LL; }; + uint8 bitsE() const { return (u >> 58) & 0x7LL; }; + uint8 bitsF() const { return (u >> 61) & 0x7LL; }; void evaluatePalette(uint8 alpha[8]) const; void evaluatePalette8(uint8 alpha[8]) const; |