Remove the monochrome hack

This was only used for the nv20 renderer.
This commit is contained in:
dhewg 2012-07-18 21:43:35 +02:00
parent 6aa9b3602e
commit a5678d2368
2 changed files with 5 additions and 29 deletions

View file

@ -215,7 +215,7 @@ public:
int BitsForInternalFormat( int internalFormat ) const;
void UploadCompressedNormalMap( int width, int height, const byte *rgba, int mipLevel );
GLenum SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, int width, int height,
textureDepth_t minimumDepth, bool *monochromeResult ) const;
textureDepth_t minimumDepth ) const;
void ImageProgramStringToCompressedFileName( const char *imageProg, char *fileName ) const;
int NumLevelsForImageSize( int width, int height ) const;
@ -246,7 +246,6 @@ public:
bool levelLoadReferenced; // for determining if it needs to be purged
bool precompressedFile; // true when it was loaded from a .d3t file
bool defaulted; // true if the default image was generated because a file couldn't be loaded
bool isMonochrome; // so the NV20 path can use a reduced pass count
ID_TIME_T timestamp; // the most recent of all images used in creation, for reloadImages command
int imageHash; // for identical-image checking
@ -292,7 +291,6 @@ ID_INLINE idImage::idImage() {
internalFormat = 0;
cacheUsagePrev = cacheUsageNext = NULL;
hashNext = NULL;
isMonochrome = false;
refCount = 0;
}

View file

@ -206,7 +206,7 @@ This may need to scan six cube map images
===============
*/
GLenum idImage::SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, int width, int height,
textureDepth_t minimumDepth, bool *monochromeResult ) const {
textureDepth_t minimumDepth ) const {
int i, c;
const byte *scan;
int rgbOr, rgbAnd, aOr, aAnd;
@ -222,8 +222,6 @@ GLenum idImage::SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, in
aOr = 0;
aAnd = -1;
*monochromeResult = true; // until shown otherwise
for ( int side = 0 ; side < numDataPtrs ; side++ ) {
scan = dataPtrs[side];
for ( i = 0; i < c; i++, scan += 4 ) {
@ -238,16 +236,6 @@ GLenum idImage::SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, in
// if rgb are all the same, the or and and will match
rgbDiffer |= ( cor ^ cand );
// our "isMonochrome" test is more lax than rgbDiffer,
// allowing the values to be off by several units and
// still use the NV20 mono path
if ( *monochromeResult ) {
if ( abs( scan[0] - scan[1] ) > 16
|| abs( scan[0] - scan[2] ) > 16 ) {
*monochromeResult = false;
}
}
rgbOr |= cor;
rgbAnd &= cand;
@ -554,7 +542,7 @@ void idImage::GenerateImage( const byte *pic, int width, int height,
qglGenTextures( 1, &texnum );
// select proper internal format before we resample
internalFormat = SelectInternalFormat( &pic, 1, width, height, depth, &isMonochrome );
internalFormat = SelectInternalFormat( &pic, 1, width, height, depth );
// copy or resample data as appropriate for first MIP level
if ( ( scaled_width == width ) && ( scaled_height == height ) ) {
@ -763,7 +751,7 @@ void idImage::Generate3DImage( const byte *pic, int width, int height, int picDe
// select proper internal format before we resample
// this function doesn't need to know it is 3D, so just make it very "tall"
internalFormat = SelectInternalFormat( &pic, 1, width, height * picDepth, minDepthParm, &isMonochrome );
internalFormat = SelectInternalFormat( &pic, 1, width, height * picDepth, minDepthParm );
uploadHeight = scaled_height;
uploadWidth = scaled_width;
@ -897,7 +885,7 @@ void idImage::GenerateCubeImage( const byte *pic[6], int size,
qglGenTextures( 1, &texnum );
// select proper internal format before we resample
internalFormat = SelectInternalFormat( pic, 6, width, height, depth, &isMonochrome );
internalFormat = SelectInternalFormat( pic, 6, width, height, depth );
// don't bother with downsample for now
scaled_width = width;
@ -1138,11 +1126,6 @@ void idImage::WritePrecompressedImage() {
header.dwHeight = uploadHeight;
header.dwWidth = uploadWidth;
// hack in our monochrome flag for the NV20 optimization
if ( isMonochrome ) {
header.dwFlags |= DDSF_ID_MONOCHROME;
}
if ( FormatIsDXT( altInternalFormat ) ) {
// size (in bytes) of the compressed base image
header.dwFlags |= DDSF_LINEARSIZE;
@ -1510,11 +1493,6 @@ void idImage::UploadPrecompressedImage( byte *data, int len ) {
return;
}
// we need the monochrome flag for the NV20 optimized path
if ( header->dwFlags & DDSF_ID_MONOCHROME ) {
isMonochrome = true;
}
type = TT_2D; // FIXME: we may want to support pre-compressed cube maps in the future
Bind();