Made static variables that inline asm needs to touch non-static.

I dislike having to do this, but Clang sees them as unused and removes them
from the object file, causing linking to fail.

The real solution here is to remove all the assembly code because it's 2016
and this game doesn't have to run on 133MHz Pentium now.  :)
This commit is contained in:
Ryan C. Gordon 2016-03-31 13:04:57 -04:00
parent ed527eb29e
commit ee754e7edf
3 changed files with 75 additions and 86 deletions

View File

@ -626,19 +626,19 @@ static ULONG ulDither2[4][4] = {
}; };
static __int64 mmErrDiffMask=0; __int64 mmErrDiffMask=0;
#if (defined __GNUC__) #if (defined __GNUC__)
static __int64 mmW3 = 0x0003000300030003ll; __int64 mmW3 = 0x0003000300030003ll;
static __int64 mmW5 = 0x0005000500050005ll; __int64 mmW5 = 0x0005000500050005ll;
static __int64 mmW7 = 0x0007000700070007ll; __int64 mmW7 = 0x0007000700070007ll;
#else #else
static __int64 mmW3 = 0x0003000300030003; __int64 mmW3 = 0x0003000300030003;
static __int64 mmW5 = 0x0005000500050005; __int64 mmW5 = 0x0005000500050005;
static __int64 mmW7 = 0x0007000700070007; __int64 mmW7 = 0x0007000700070007;
#endif #endif
static __int64 mmShift = 0; __int64 mmShift = 0;
static __int64 mmMask = 0; __int64 mmMask = 0;
static ULONG *pulDitherTable; ULONG *pulDitherTable;
// performs dithering of a 32-bit bipmap (can be in-place) // performs dithering of a 32-bit bipmap (can be in-place)
void DitherBitmap( INDEX iDitherType, ULONG *pulSrc, ULONG *pulDst, PIX pixWidth, PIX pixHeight, void DitherBitmap( INDEX iDitherType, ULONG *pulSrc, ULONG *pulDst, PIX pixWidth, PIX pixHeight,
@ -1132,35 +1132,23 @@ static INDEX aiFilters[6][3] = {
{ 1, 1, 1 }}; // { 1, 1, 1 }}; //
// temp for middle pixels, vertical/horizontal edges, and corners // temp for middle pixels, vertical/horizontal edges, and corners
static __int64 mmMc, mmMe, mmMm; // corner, edge, middle __int64 mmMc, mmMe, mmMm; // corner, edge, middle
static __int64 mmEch, mmEm; // corner-high, middle __int64 mmEch, mmEm; // corner-high, middle
#define mmEcl mmMc // corner-low #define mmEcl mmMc // corner-low
#define mmEe mmMe // edge #define mmEe mmMe // edge
static __int64 mmCm; // middle __int64 mmCm; // middle
#define mmCc mmMc // corner #define mmCc mmMc // corner
#define mmCe mmEch // edge #define mmCe mmEch // edge
static __int64 mmInvDiv; __int64 mmInvDiv;
#if (defined __GNUC__) #if (defined __GNUC__)
static __int64 mmAdd = 0x0007000700070007ll; __int64 mmAdd = 0x0007000700070007ll;
#else #else
static __int64 mmAdd = 0x0007000700070007; __int64 mmAdd = 0x0007000700070007;
#endif #endif
// temp rows for in-place filtering support // temp rows for in-place filtering support
extern "C" { static ULONG aulRows[2048]; } extern "C" { ULONG aulRows[2048]; }
static void *force_syms_to_exist = NULL;
void asm_force_mmAdd() { force_syms_to_exist = &mmAdd; }
void asm_force_aulRows() { force_syms_to_exist = &aulRows; }
void asm_force_mmMc() { force_syms_to_exist = &mmMc; }
void asm_force_mmMe() { force_syms_to_exist = &mmMe; }
void asm_force_mmMm() { force_syms_to_exist = &mmMm; }
void asm_force_mmEch() { force_syms_to_exist = &mmEch; }
void asm_force_mmEm() { force_syms_to_exist = &mmEm; }
void asm_force_mmW3() { force_syms_to_exist = &mmW3; }
void asm_force_mmW5() { force_syms_to_exist = &mmW5; }
void asm_force_mmW7() { force_syms_to_exist = &mmW7; }
// FilterBitmap() INTERNAL: generates convolution filter matrix if needed // FilterBitmap() INTERNAL: generates convolution filter matrix if needed
static INDEX iLastFilter; static INDEX iLastFilter;
@ -1199,13 +1187,13 @@ static void GenerateConvolutionMatrix( INDEX iFilter)
extern "C" { extern "C" {
static ULONG *FB_pulSrc = NULL; ULONG *FB_pulSrc = NULL;
static ULONG *FB_pulDst = NULL; ULONG *FB_pulDst = NULL;
static PIX FB_pixWidth = 0; PIX FB_pixWidth = 0;
static PIX FB_pixHeight = 0; PIX FB_pixHeight = 0;
static PIX FB_pixCanvasWidth = 0; PIX FB_pixCanvasWidth = 0;
static SLONG FB_slModulo1 = 0; SLONG FB_slModulo1 = 0;
static SLONG FB_slCanvasWidth = 0; SLONG FB_slCanvasWidth = 0;
} }

View File

@ -29,12 +29,12 @@
#define ASMOPT 0 #define ASMOPT 0
#endif #endif
static __int64 mmBaseWidthShift=0; __int64 mmBaseWidthShift=0;
static __int64 mmBaseWidth=0; __int64 mmBaseWidth=0;
static __int64 mmBaseWidthMask=0; __int64 mmBaseWidthMask=0;
static __int64 mmBaseHeightMask=0; __int64 mmBaseHeightMask=0;
static __int64 mmBaseMasks=0; __int64 mmBaseMasks=0;
static __int64 mmShift=0; __int64 mmShift=0;
#if (defined __GNUC__) #if (defined __GNUC__)
/* /*
@ -42,12 +42,12 @@ static __int64 mmShift=0;
* builds with optimization, which means the linker can't resolve the * builds with optimization, which means the linker can't resolve the
* references to them in the inline ASM. That's obnoxious. * references to them in the inline ASM. That's obnoxious.
*/ */
static __int64 mm1LO = 0x0000000000000001ll; __int64 mm1LO = 0x0000000000000001ll;
static __int64 mm1HI = 0x0000000100000000ll; __int64 mm1HI = 0x0000000100000000ll;
static __int64 mm1HILO = 0x0000000100000001ll; __int64 mm1HILO = 0x0000000100000001ll;
static __int64 mm0001 = 0x0000000000000001ll; __int64 mm0001 = 0x0000000000000001ll;
static __int64 mm0010 = 0x0000000000010000ll; __int64 mm0010 = 0x0000000000010000ll;
static __int64 mm00M0 = 0x00000000FFFF0000ll; __int64 mm00M0 = 0x00000000FFFF0000ll;
static void *force_syms_to_exist = NULL; static void *force_syms_to_exist = NULL;
void asm_force_mm1LO() { force_syms_to_exist = &mm1LO; } void asm_force_mm1LO() { force_syms_to_exist = &mm1LO; }
@ -64,30 +64,31 @@ void asm_force_mmBaseMasks() { force_syms_to_exist = &mmBaseMasks; }
void asm_force_mmShift() { force_syms_to_exist = &mmShift; } void asm_force_mmShift() { force_syms_to_exist = &mmShift; }
#else #else
static const __int64 mm1LO = 0x0000000000000001; const __int64 mm1LO = 0x0000000000000001;
static const __int64 mm1HI = 0x0000000100000000; const __int64 mm1HI = 0x0000000100000000;
static const __int64 mm1HILO = 0x0000000100000001; const __int64 mm1HILO = 0x0000000100000001;
static const __int64 mm0001 = 0x0000000000000001; const __int64 mm0001 = 0x0000000000000001;
static const __int64 mm0010 = 0x0000000000010000; const __int64 mm0010 = 0x0000000000010000;
static const __int64 mm00M0 = 0x00000000FFFF0000; const __int64 mm00M0 = 0x00000000FFFF0000;
#endif #endif
// speed table // speed table
static SBYTE asbMod3Sub1Table[256]; SBYTE asbMod3Sub1Table[256];
static BOOL bTableSet = FALSE; static BOOL bTableSet = FALSE;
static CTextureData *_ptdEffect, *_ptdBase; static CTextureData *_ptdEffect, *_ptdBase;
static PIX _pixTexWidth, _pixTexHeight;
static PIX _pixBufferWidth, _pixBufferHeight;
static ULONG _ulBufferMask; static ULONG _ulBufferMask;
static INDEX _iWantedMipLevel; static INDEX _iWantedMipLevel;
static UBYTE *_pubDrawBuffer; static UBYTE *_pubDrawBuffer;
static SWORD *_pswDrawBuffer; static SWORD *_pswDrawBuffer;
PIX _pixTexWidth, _pixTexHeight;
PIX _pixBufferWidth, _pixBufferHeight;
// randomizer // randomizer
static ULONG ulRNDSeed; ULONG ulRNDSeed;
inline void Randomize( ULONG ulSeed) inline void Randomize( ULONG ulSeed)
{ {
@ -1240,8 +1241,8 @@ static void AnimateWater( SLONG slDensity)
#define PIXEL(u,v) pulTextureBase[ ((u)&(SLONG&)mmBaseWidthMask) + ((v)&(SLONG&)mmBaseHeightMask) *pixBaseWidth] #define PIXEL(u,v) pulTextureBase[ ((u)&(SLONG&)mmBaseWidthMask) + ((v)&(SLONG&)mmBaseHeightMask) *pixBaseWidth]
static ULONG _slHeightMapStep_renderWater = 0; ULONG _slHeightMapStep_renderWater = 0;
static PIX _pixBaseWidth_renderWater = 0; PIX _pixBaseWidth_renderWater = 0;
#pragma warning(disable: 4731) #pragma warning(disable: 4731)
static void RenderWater(void) static void RenderWater(void)
@ -3039,7 +3040,7 @@ pixDone:
//////////////////////////// displace texture //////////////////////////// displace texture
static UBYTE *_pubHeat_RenderPlasmaFire = NULL; UBYTE *_pubHeat_RenderPlasmaFire = NULL;
static void RenderPlasmaFire(void) static void RenderPlasmaFire(void)
{ {

View File

@ -241,25 +241,25 @@ void CLayerMixer::FindLayerMipmap( CBrushShadowLayer *pbsl, UBYTE *&pub, UBYTE &
#define FTOX 0x10000000 #define FTOX 0x10000000
#define SHIFTX (28-SQRTTABLESIZELOG2) #define SHIFTX (28-SQRTTABLESIZELOG2)
// static variables for easier transfers // variables for easier transfers
static const FLOAT3D *_vLight; const FLOAT3D *_vLight;
static FLOAT _fMinLightDistance; FLOAT _fMinLightDistance;
static FLOAT _f1oFallOff; FLOAT _f1oFallOff;
static INDEX _iPixCt; INDEX _iPixCt;
static INDEX _iRowCt; INDEX _iRowCt;
static SLONG _slModulo; SLONG _slModulo;
static ULONG _ulLightFlags; ULONG _ulLightFlags;
static ULONG _ulPolyFlags; ULONG _ulPolyFlags;
static SLONG _slL2Row; SLONG _slL2Row;
static SLONG _slDDL2oDU; SLONG _slDDL2oDU;
static SLONG _slDDL2oDV; SLONG _slDDL2oDV;
static SLONG _slDDL2oDUoDV; SLONG _slDDL2oDUoDV;
static SLONG _slDL2oDURow; SLONG _slDL2oDURow;
static SLONG _slDL2oDV; SLONG _slDL2oDV;
static SLONG _slLightMax; SLONG _slLightMax;
static SLONG _slHotSpot; SLONG _slHotSpot;
static SLONG _slLightStep; SLONG _slLightStep;
static ULONG *_pulLayer; ULONG *_pulLayer;
// !!! FIXME : rcg01072001 These statics are a pain in the ass. // !!! FIXME : rcg01072001 These statics are a pain in the ass.
@ -472,8 +472,8 @@ skipPixel:
extern "C" { extern "C" {
static __int64 mmDDL2oDU_addAmbientMaskPoint; __int64 mmDDL2oDU_addAmbientMaskPoint;
static __int64 mmDDL2oDV_addAmbientMaskPoint; __int64 mmDDL2oDV_addAmbientMaskPoint;
} }
// add one layer point light without diffusion and with mask // add one layer point light without diffusion and with mask
@ -694,8 +694,8 @@ skipPixel:
} }
extern "C" { extern "C" {
static __int64 mmDDL2oDU_AddDiffusionPoint; __int64 mmDDL2oDU_AddDiffusionPoint;
static __int64 mmDDL2oDV_AddDiffusionPoint; __int64 mmDDL2oDV_AddDiffusionPoint;
} }
// add one layer point light with diffusion and without mask // add one layer point light with diffusion and without mask
@ -878,8 +878,8 @@ skipPixel:
} }
extern "C" { extern "C" {
static __int64 mmDDL2oDU_AddDiffusionMaskPoint; __int64 mmDDL2oDU_AddDiffusionMaskPoint;
static __int64 mmDDL2oDV_AddDiffusionMaskPoint; __int64 mmDDL2oDV_AddDiffusionMaskPoint;
} }
// add one layer point light with diffusion and mask // add one layer point light with diffusion and mask