Supress msvc warning.

Replace tabs with spaces.
This commit is contained in:
castano 2011-02-25 09:51:09 +00:00
parent 71b88deb2a
commit b72a69f25c
3 changed files with 206 additions and 204 deletions

View File

@ -174,6 +174,8 @@ namespace
return i - skip;
}
#pragma warning(push)
#pragma warning(disable:4748)
static NV_NOINLINE int backtrace(void * trace[], int maxcount) {
CONTEXT ctx = { 0 };
#if NV_CPU_X86 && !NV_CPU_X86_64
@ -191,7 +193,7 @@ namespace
return backtraceWithSymbols(&ctx, trace, maxcount, 1);
}
#pragma warning(pop)
static NV_NOINLINE void printStackTrace(void * trace[], int size, int start=0)
{

View File

@ -32,7 +32,7 @@ using namespace nv;
/*----------------------------------------------------------------------------
BlockDXT1
BlockDXT1
----------------------------------------------------------------------------*/
uint BlockDXT1::evaluatePalette(Color32 color_array[4], bool d3d9/*= false*/) const
@ -216,19 +216,19 @@ void BlockDXT1::decodeBlock(ColorBlock * block, bool d3d9/*= false*/) const
void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
{
nvDebugCheck(block != NULL);
nvDebugCheck(block != NULL);
// Decode color block.
Color32 color_array[4];
evaluatePaletteNV5x(color_array);
// Decode color block.
Color32 color_array[4];
evaluatePaletteNV5x(color_array);
// Write color block.
for( uint j = 0; j < 4; j++ ) {
for( uint i = 0; i < 4; i++ ) {
uint idx = (row[j] >> (2 * i)) & 3;
block->color(i, j) = color_array[idx];
}
}
// Write color block.
for( uint j = 0; j < 4; j++ ) {
for( uint i = 0; i < 4; i++ ) {
uint idx = (row[j] >> (2 * i)) & 3;
block->color(i, j) = color_array[idx];
}
}
}
void BlockDXT1::setIndices(int * idx)
@ -255,7 +255,7 @@ inline void BlockDXT1::flip2()
/*----------------------------------------------------------------------------
BlockDXT3
BlockDXT3
----------------------------------------------------------------------------*/
void BlockDXT3::decodeBlock(ColorBlock * block, bool d3d9/*= false*/) const
@ -271,10 +271,10 @@ void BlockDXT3::decodeBlock(ColorBlock * block, bool d3d9/*= false*/) const
void BlockDXT3::decodeBlockNV5x(ColorBlock * block) const
{
nvDebugCheck(block != NULL);
color.decodeBlockNV5x(block);
alpha.decodeBlock(block);
nvDebugCheck(block != NULL);
color.decodeBlockNV5x(block);
alpha.decodeBlock(block);
}
void AlphaBlockDXT3::decodeBlock(ColorBlock * block, bool d3d9/*= false*/) const
@ -328,7 +328,7 @@ void BlockDXT3::flip2()
/*----------------------------------------------------------------------------
BlockDXT5
BlockDXT5
----------------------------------------------------------------------------*/
void AlphaBlockDXT5::evaluatePalette(uint8 alpha[8], bool d3d9) const
@ -467,13 +467,13 @@ void BlockDXT5::decodeBlock(ColorBlock * block, bool d3d9/*= false*/) const
void BlockDXT5::decodeBlockNV5x(ColorBlock * block) const
{
nvDebugCheck(block != NULL);
// Decode color.
color.decodeBlockNV5x(block);
// Decode alpha.
alpha.decodeBlock(block);
nvDebugCheck(block != NULL);
// Decode color.
color.decodeBlockNV5x(block);
// Decode alpha.
alpha.decodeBlock(block);
}
/// Flip DXT5 block vertically.

View File

@ -35,193 +35,193 @@ namespace nv
class Stream;
/// DXT1 block.
struct BlockDXT1
{
Color16 col0;
Color16 col1;
union {
uint8 row[4];
uint indices;
};
bool isFourColorMode() const;
uint evaluatePalette(Color32 color_array[4], bool d3d9) const;
uint evaluatePaletteNV5x(Color32 color_array[4]) const;
/// DXT1 block.
struct BlockDXT1
{
Color16 col0;
Color16 col1;
union {
uint8 row[4];
uint indices;
};
void evaluatePalette3(Color32 color_array[4], bool d3d9) const;
void evaluatePalette4(Color32 color_array[4], bool d3d9) const;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
void setIndices(int * idx);
bool isFourColorMode() const;
void flip4();
void flip2();
};
/// Return true if the block uses four color mode, false otherwise.
inline bool BlockDXT1::isFourColorMode() const
{
return col0.u > col1.u;
}
uint evaluatePalette(Color32 color_array[4], bool d3d9) const;
uint evaluatePaletteNV5x(Color32 color_array[4]) const;
/// DXT3 alpha block with explicit alpha.
struct AlphaBlockDXT3
{
union {
struct {
uint alpha0 : 4;
uint alpha1 : 4;
uint alpha2 : 4;
uint alpha3 : 4;
uint alpha4 : 4;
uint alpha5 : 4;
uint alpha6 : 4;
uint alpha7 : 4;
uint alpha8 : 4;
uint alpha9 : 4;
uint alphaA : 4;
uint alphaB : 4;
uint alphaC : 4;
uint alphaD : 4;
uint alphaE : 4;
uint alphaF : 4;
};
uint16 row[4];
};
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// DXT3 block.
struct BlockDXT3
{
AlphaBlockDXT3 alpha;
BlockDXT1 color;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
void flip4();
void flip2();
};
/// DXT5 alpha block.
struct AlphaBlockDXT5
{
union {
struct {
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;
};
void evaluatePalette(uint8 alpha[8], bool d3d9) const;
void evaluatePalette8(uint8 alpha[8], bool d3d9) const;
void evaluatePalette6(uint8 alpha[8], bool d3d9) const;
void indices(uint8 index_array[16]) const;
void evaluatePalette3(Color32 color_array[4], bool d3d9) const;
void evaluatePalette4(Color32 color_array[4], bool d3d9) const;
uint index(uint index) const;
void setIndex(uint index, uint value);
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
/// DXT5 block.
struct BlockDXT5
{
AlphaBlockDXT5 alpha;
BlockDXT1 color;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
void flip4();
void flip2();
};
void setIndices(int * idx);
/// ATI1 block.
struct BlockATI1
{
AlphaBlockDXT5 alpha;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
void flip4();
void flip2();
};
/// ATI2 block.
struct BlockATI2
{
AlphaBlockDXT5 x;
AlphaBlockDXT5 y;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// CTX1 block.
struct BlockCTX1
{
uint8 col0[2];
uint8 col1[2];
union {
uint8 row[4];
uint indices;
};
void evaluatePalette(Color32 color_array[4]) const;
void setIndices(int * idx);
void decodeBlock(ColorBlock * block) const;
void flip4();
void flip2();
};
/// Return true if the block uses four color mode, false otherwise.
inline bool BlockDXT1::isFourColorMode() const
{
return col0.u > col1.u;
}
// Serialization functions.
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT1 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT3 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT3 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT5 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT5 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI1 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI2 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockCTX1 & block);
/// DXT3 alpha block with explicit alpha.
struct AlphaBlockDXT3
{
union {
struct {
uint alpha0 : 4;
uint alpha1 : 4;
uint alpha2 : 4;
uint alpha3 : 4;
uint alpha4 : 4;
uint alpha5 : 4;
uint alpha6 : 4;
uint alpha7 : 4;
uint alpha8 : 4;
uint alpha9 : 4;
uint alphaA : 4;
uint alphaB : 4;
uint alphaC : 4;
uint alphaD : 4;
uint alphaE : 4;
uint alphaF : 4;
};
uint16 row[4];
};
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// DXT3 block.
struct BlockDXT3
{
AlphaBlockDXT3 alpha;
BlockDXT1 color;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
void flip4();
void flip2();
};
/// DXT5 alpha block.
struct AlphaBlockDXT5
{
union {
struct {
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;
};
void evaluatePalette(uint8 alpha[8], bool d3d9) const;
void evaluatePalette8(uint8 alpha[8], bool d3d9) const;
void evaluatePalette6(uint8 alpha[8], bool d3d9) const;
void indices(uint8 index_array[16]) const;
uint index(uint index) const;
void setIndex(uint index, uint value);
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// DXT5 block.
struct BlockDXT5
{
AlphaBlockDXT5 alpha;
BlockDXT1 color;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void decodeBlockNV5x(ColorBlock * block) const;
void flip4();
void flip2();
};
/// ATI1 block.
struct BlockATI1
{
AlphaBlockDXT5 alpha;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// ATI2 block.
struct BlockATI2
{
AlphaBlockDXT5 x;
AlphaBlockDXT5 y;
void decodeBlock(ColorBlock * block, bool d3d9 = false) const;
void flip4();
void flip2();
};
/// CTX1 block.
struct BlockCTX1
{
uint8 col0[2];
uint8 col1[2];
union {
uint8 row[4];
uint indices;
};
void evaluatePalette(Color32 color_array[4]) const;
void setIndices(int * idx);
void decodeBlock(ColorBlock * block) const;
void flip4();
void flip2();
};
// Serialization functions.
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT1 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT3 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT3 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT5 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT5 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI1 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI2 & block);
NVIMAGE_API Stream & operator<<(Stream & stream, BlockCTX1 & block);
} // nv namespace