fix warnings and more gcc pedantic errors

This commit is contained in:
zeromus 2009-10-29 05:20:49 +00:00
parent 93186fb640
commit e6bc023301
4 changed files with 250 additions and 251 deletions

View File

@ -562,7 +562,7 @@ static void setTexture(unsigned int format, unsigned int texpal)
{ {
currTexture->deleteCallback = texDeleteCallback; currTexture->deleteCallback = texDeleteCallback;
if(freeTextureIds.empty()) expandFreeTextures(); if(freeTextureIds.empty()) expandFreeTextures();
currTexture->texid = (u32)freeTextureIds.front(); currTexture->texid = (u64)freeTextureIds.front();
freeTextureIds.pop(); freeTextureIds.pop();
glBindTexture(GL_TEXTURE_2D,(GLuint)currTexture->texid); glBindTexture(GL_TEXTURE_2D,(GLuint)currTexture->texid);

View File

@ -147,248 +147,248 @@ struct StereoOutFloat
} }
}; };
struct Stereo21Out16 //struct Stereo21Out16
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 LFE; // s16 LFE;
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
Left = src.Left >> SndOutVolumeShift; // Left = src.Left >> SndOutVolumeShift;
Right = src.Right >> SndOutVolumeShift; // Right = src.Right >> SndOutVolumeShift;
LFE = (src.Left + src.Right) >> (SndOutVolumeShift + 1); // LFE = (src.Left + src.Right) >> (SndOutVolumeShift + 1);
} // }
}; //};
//
struct StereoQuadOut16 //struct StereoQuadOut16
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 LeftBack; // s16 LeftBack;
s16 RightBack; // s16 RightBack;
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
Left = src.Left >> SndOutVolumeShift; // Left = src.Left >> SndOutVolumeShift;
Right = src.Right >> SndOutVolumeShift; // Right = src.Right >> SndOutVolumeShift;
LeftBack = src.Left >> SndOutVolumeShift; // LeftBack = src.Left >> SndOutVolumeShift;
RightBack = src.Right >> SndOutVolumeShift; // RightBack = src.Right >> SndOutVolumeShift;
} // }
}; //};
//
struct Stereo41Out16 //struct Stereo41Out16
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 LFE; // s16 LFE;
s16 LeftBack; // s16 LeftBack;
s16 RightBack; // s16 RightBack;
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
Left = src.Left >> SndOutVolumeShift; // Left = src.Left >> SndOutVolumeShift;
Right = src.Right >> SndOutVolumeShift; // Right = src.Right >> SndOutVolumeShift;
LFE = (src.Left + src.Right) >> (SndOutVolumeShift + 1); // LFE = (src.Left + src.Right) >> (SndOutVolumeShift + 1);
LeftBack = src.Left >> SndOutVolumeShift; // LeftBack = src.Left >> SndOutVolumeShift;
RightBack = src.Right >> SndOutVolumeShift; // RightBack = src.Right >> SndOutVolumeShift;
} // }
}; //};
//
struct Stereo51Out16 //struct Stereo51Out16
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 Center; // s16 Center;
s16 LFE; // s16 LFE;
s16 LeftBack; // s16 LeftBack;
s16 RightBack; // s16 RightBack;
//
// Implementation Note: Center and Subwoofer/LFE --> // // Implementation Note: Center and Subwoofer/LFE -->
// This method is simple and sounds nice. It relies on the speaker/soundcard // // This method is simple and sounds nice. It relies on the speaker/soundcard
// systems do to their own low pass / crossover. Manual lowpass is wasted effort // // systems do to their own low pass / crossover. Manual lowpass is wasted effort
// and can't match solid state results anyway. // // and can't match solid state results anyway.
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
Left = src.Left >> SndOutVolumeShift; // Left = src.Left >> SndOutVolumeShift;
Right = src.Right >> SndOutVolumeShift; // Right = src.Right >> SndOutVolumeShift;
Center = (src.Left + src.Right) >> (SndOutVolumeShift + 1); // Center = (src.Left + src.Right) >> (SndOutVolumeShift + 1);
LFE = Center; // LFE = Center;
LeftBack = src.Left >> SndOutVolumeShift; // LeftBack = src.Left >> SndOutVolumeShift;
RightBack = src.Right >> SndOutVolumeShift; // RightBack = src.Right >> SndOutVolumeShift;
} // }
}; //};
//
struct Stereo51Out16DplII //struct Stereo51Out16DplII
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 Center; // s16 Center;
s16 LFE; // s16 LFE;
s16 LeftBack; // s16 LeftBack;
s16 RightBack; // s16 RightBack;
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
static const u8 sLogTable[256] = { // static const u8 sLogTable[256] = {
0x00,0x3C,0x60,0x78,0x8C,0x9C,0xA8,0xB4,0xBE,0xC8,0xD0,0xD8,0xDE,0xE4,0xEA,0xF0, // 0x00,0x3C,0x60,0x78,0x8C,0x9C,0xA8,0xB4,0xBE,0xC8,0xD0,0xD8,0xDE,0xE4,0xEA,0xF0,
0xF6,0xFA,0xFE,0x04,0x08,0x0C,0x10,0x14,0x16,0x1A,0x1E,0x20,0x24,0x26,0x2A,0x2C, // 0xF6,0xFA,0xFE,0x04,0x08,0x0C,0x10,0x14,0x16,0x1A,0x1E,0x20,0x24,0x26,0x2A,0x2C,
0x2E,0x32,0x34,0x36,0x38,0x3A,0x3E,0x40,0x42,0x44,0x46,0x48,0x4A,0x4C,0x4E,0x50, // 0x2E,0x32,0x34,0x36,0x38,0x3A,0x3E,0x40,0x42,0x44,0x46,0x48,0x4A,0x4C,0x4E,0x50,
0x50,0x52,0x54,0x56,0x58,0x5A,0x5A,0x5C,0x5E,0x60,0x60,0x62,0x64,0x66,0x66,0x68, // 0x50,0x52,0x54,0x56,0x58,0x5A,0x5A,0x5C,0x5E,0x60,0x60,0x62,0x64,0x66,0x66,0x68,
0x6A,0x6A,0x6C,0x6E,0x6E,0x70,0x70,0x72,0x74,0x74,0x76,0x76,0x78,0x7A,0x7A,0x7C, // 0x6A,0x6A,0x6C,0x6E,0x6E,0x70,0x70,0x72,0x74,0x74,0x76,0x76,0x78,0x7A,0x7A,0x7C,
0x7C,0x7E,0x7E,0x80,0x80,0x82,0x82,0x84,0x84,0x86,0x86,0x88,0x88,0x8A,0x8A,0x8C, // 0x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xC8,0xC8,0xC8,0xC8,0xCA,0xCA,0xCA,0xCA,0xCC,0xCC,0xCC,0xCC,0xCC,0xCE,0xCE,0xCE, // 0xC8,0xC8,0xC8,0xC8,0xCA,0xCA,0xCA,0xCA,0xCC,0xCC,0xCC,0xCC,0xCC,0xCE,0xCE,0xCE,
0xCE,0xCE,0xD0,0xD0,0xD0,0xD0,0xD0,0xD2,0xD2,0xD2,0xD2,0xD2,0xD4,0xD4,0xD4,0xD4, // 0xCE,0xCE,0xD0,0xD0,0xD0,0xD0,0xD0,0xD2,0xD2,0xD2,0xD2,0xD2,0xD4,0xD4,0xD4,0xD4,
0xD4,0xD6,0xD6,0xD6,0xD6,0xD6,0xD8,0xD8,0xD8,0xD8,0xD8,0xD8,0xDA,0xDA,0xDA,0xDA, // 0xD4,0xD6,0xD6,0xD6,0xD6,0xD6,0xD8,0xD8,0xD8,0xD8,0xD8,0xD8,0xDA,0xDA,0xDA,0xDA,
0xDA,0xDC,0xDC,0xDC,0xDC,0xDC,0xDC,0xDE,0xDE,0xDE,0xDE,0xDE,0xDE,0xE0,0xE0,0xE0, // 0xDA,0xDC,0xDC,0xDC,0xDC,0xDC,0xDC,0xDE,0xDE,0xDE,0xDE,0xDE,0xDE,0xE0,0xE0,0xE0,
}; // };
//
static s32 Gfl=0,Gfr=0; // static s32 Gfl=0,Gfr=0;
static s32 LMax=0,RMax=0; // static s32 LMax=0,RMax=0;
//
static s32 LAccum; // static s32 LAccum;
static s32 RAccum; // static s32 RAccum;
static s32 ANum; // static s32 ANum;
//
s32 ValL = src.Left >> (SndOutVolumeShift-8); // s32 ValL = src.Left >> (SndOutVolumeShift-8);
s32 ValR = src.Right >> (SndOutVolumeShift-8); // s32 ValR = src.Right >> (SndOutVolumeShift-8);
//
s32 XL = abs(ValL>>8); // s32 XL = abs(ValL>>8);
s32 XR = abs(ValR>>8); // s32 XR = abs(ValR>>8);
//
if(XL>LMax) LMax = XL; // if(XL>LMax) LMax = XL;
if(XR>RMax) RMax = XR; // if(XR>RMax) RMax = XR;
//
ANum++; // ANum++;
if(ANum>=128) // if(ANum>=128)
{ // {
ANum=0; // ANum=0;
LAccum = 1+((LAccum * 224 + LMax * 31)>>8); // LAccum = 1+((LAccum * 224 + LMax * 31)>>8);
RAccum = 1+((RAccum * 224 + RMax * 31)>>8); // RAccum = 1+((RAccum * 224 + RMax * 31)>>8);
//
LMax = 0; // LMax = 0;
RMax = 0; // RMax = 0;
//
s32 Tfl=(RAccum)*255/(LAccum); // s32 Tfl=(RAccum)*255/(LAccum);
s32 Tfr=(LAccum)*255/(RAccum); // s32 Tfr=(LAccum)*255/(RAccum);
//
int gMax = std::max(Tfl,Tfr); // int gMax = std::max(Tfl,Tfr);
Tfl = Tfl*255/gMax; // Tfl = Tfl*255/gMax;
Tfr = Tfr*255/gMax; // Tfr = Tfr*255/gMax;
//
if(Tfl>255) Tfl=255; // if(Tfl>255) Tfl=255;
if(Tfr>255) Tfr=255; // if(Tfr>255) Tfr=255;
if(Tfl<1) Tfl=1; // if(Tfl<1) Tfl=1;
if(Tfr<1) Tfr=1; // if(Tfr<1) Tfr=1;
//
Gfl = (Gfl * 200 + Tfl * 56)>>8; // Gfl = (Gfl * 200 + Tfl * 56)>>8;
Gfr = (Gfr * 200 + Tfr * 56)>>8; // Gfr = (Gfr * 200 + Tfr * 56)>>8;
//
} // }
//
s32 L,R,C,SUB,SL,SR; // s32 L,R,C,SUB,SL,SR;
//
C=(ValL+ValR)>>1; //16.8 // C=(ValL+ValR)>>1; //16.8
//
ValL-=C;//16.8 // ValL-=C;//16.8
ValR-=C;//16.8 // ValR-=C;//16.8
//
L=ValL>>8; //16.0 // L=ValL>>8; //16.0
R=ValR>>8; //16.0 // R=ValR>>8; //16.0
C=C>>8; //16.0 // C=C>>8; //16.0
SUB = C; // SUB = C;
//
{ // {
s32 Cfl = 1+sLogTable[Gfl]; // s32 Cfl = 1+sLogTable[Gfl];
s32 Cfr = 1+sLogTable[Gfr]; // s32 Cfr = 1+sLogTable[Gfr];
//
s32 VL=(ValL>>4) * Cfl; //16.12 // s32 VL=(ValL>>4) * Cfl; //16.12
s32 VR=(ValR>>4) * Cfr; // s32 VR=(ValR>>4) * Cfr;
//
//s32 SC = (VL-VR)>>15; // //s32 SC = (VL-VR)>>15;
//
SL = (((VR/148 - VL/209)>>4)*Cfr)>>8; // SL = (((VR/148 - VL/209)>>4)*Cfr)>>8;
SR = (((VR/209 - VL/148)>>4)*Cfl)>>8; // SR = (((VR/209 - VL/148)>>4)*Cfl)>>8;
//
} // }
//
// Random-ish values to get it to compile // // Random-ish values to get it to compile
int GainL = 200; // int GainL = 200;
int GainR = 200; // int GainR = 200;
int GainC = 180; // int GainC = 180;
int GainSL = 230; // int GainSL = 230;
int GainSR = 230; // int GainSR = 230;
int GainLFE = 200; // int GainLFE = 200;
int AddCLR = 55; // int AddCLR = 55;
//
int AddCX = (C * AddCLR)>>8; // int AddCX = (C * AddCLR)>>8;
//
Left = (((L * GainL ))>>8) + AddCX; // Left = (((L * GainL ))>>8) + AddCX;
Right = (((R * GainR ))>>8) + AddCX; // Right = (((R * GainR ))>>8) + AddCX;
Center = (((C * GainC ))>>8); // Center = (((C * GainC ))>>8);
LFE = (((SUB * GainLFE))>>8); // LFE = (((SUB * GainLFE))>>8);
LeftBack = (((SL * GainSL ))>>8); // LeftBack = (((SL * GainSL ))>>8);
RightBack = (((SR * GainSR ))>>8); // RightBack = (((SR * GainSR ))>>8);
} // }
}; //};
//
struct Stereo71Out16 //struct Stereo71Out16
{ //{
s16 Left; // s16 Left;
s16 Right; // s16 Right;
s16 Center; // s16 Center;
s16 LFE; // s16 LFE;
s16 LeftBack; // s16 LeftBack;
s16 RightBack; // s16 RightBack;
s16 LeftSide; // s16 LeftSide;
s16 RightSide; // s16 RightSide;
//
void ResampleFrom( const StereoOut32& src ) // void ResampleFrom( const StereoOut32& src )
{ // {
Left = src.Left >> SndOutVolumeShift; // Left = src.Left >> SndOutVolumeShift;
Right = src.Right >> SndOutVolumeShift; // Right = src.Right >> SndOutVolumeShift;
Center = (src.Left + src.Right) >> (SndOutVolumeShift + 1); // Center = (src.Left + src.Right) >> (SndOutVolumeShift + 1);
LFE = Center; // LFE = Center;
LeftBack = src.Left >> SndOutVolumeShift; // LeftBack = src.Left >> SndOutVolumeShift;
RightBack = src.Right >> SndOutVolumeShift; // RightBack = src.Right >> SndOutVolumeShift;
//
LeftSide = src.Left >> (SndOutVolumeShift+1); // LeftSide = src.Left >> (SndOutVolumeShift+1);
RightSide = src.Right >> (SndOutVolumeShift+1); // RightSide = src.Right >> (SndOutVolumeShift+1);
} // }
}; //};
//
struct Stereo21Out32 //struct Stereo21Out32
{ //{
s32 Left; // s32 Left;
s32 Right; // s32 Right;
s32 LFE; // s32 LFE;
}; //};
//
struct Stereo41Out32 //struct Stereo41Out32
{ //{
s32 Left; // s32 Left;
s32 Right; // s32 Right;
s32 LFE; // s32 LFE;
s32 LeftBack; // s32 LeftBack;
s32 RightBack; // s32 RightBack;
}; //};
//
struct Stereo51Out32 //struct Stereo51Out32
{ //{
s32 Left; // s32 Left;
s32 Right; // s32 Right;
s32 Center; // s32 Center;
s32 LFE; // s32 LFE;
s32 LeftBack; // s32 LeftBack;
s32 RightBack; // s32 RightBack;
}; //};
// Developer Note: This is a static class only (all static members). // Developer Note: This is a static class only (all static members).
class SndBuffer class SndBuffer

View File

@ -341,9 +341,10 @@ public:
int SLI_MASK, SLI_VALUE; int SLI_MASK, SLI_VALUE;
RasterizerUnit() RasterizerUnit()
: sampler(*this) : sampler()
, shader(sampler) , shader(sampler)
{ {
sampler.unit = this;
} }
ADPCMCacheItem* lastTexKey; ADPCMCacheItem* lastTexKey;
@ -397,11 +398,9 @@ public:
struct Sampler struct Sampler
{ {
Sampler(RasterizerUnit& _unit) Sampler() {}
: unit(_unit)
{}
RasterizerUnit& unit; RasterizerUnit* unit;
int width, height; int width, height;
int wmask, hmask; int wmask, hmask;
@ -474,7 +473,7 @@ public:
dowrap(iu,iv); dowrap(iu,iv);
FragmentColor color; FragmentColor color;
color.color = ((u32*)unit.lastTexKey->decoded)[(iv<<wshift)+iu]; color.color = ((u32*)unit->lastTexKey->decoded)[(iv<<wshift)+iu];
return color; return color;
} }
@ -953,7 +952,7 @@ static int rasterizerCores;
void* execRasterizerUnit(void* arg) void* execRasterizerUnit(void* arg)
{ {
s32 which = (s32)arg; intptr_t which = (intptr_t)arg;
rasterizerUnit[which].mainLoop<true>(); rasterizerUnit[which].mainLoop<true>();
return 0; return 0;
} }

View File

@ -44,7 +44,7 @@ public:
u32 sizeX, sizeY; u32 sizeX, sizeY;
float invSizeX, invSizeY; float invSizeX, invSizeY;
u32 texid; //used by ogl renderer for the texid u64 texid; //used by ogl renderer for the texid
void (*deleteCallback)(ADPCMCacheItem*); void (*deleteCallback)(ADPCMCacheItem*);
TexCache_TexFormat cacheFormat; TexCache_TexFormat cacheFormat;