diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-06-13 09:56:39 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-09 23:15:55 +0000 |
commit | 6a71409a0622050f9a682d4e3b02419c444febe5 (patch) | |
tree | 7766ff71304d04c6e42de7dd7d48ed7e7e0fac59 /src/renderer/tr_shade_calc.c | |
parent | b15804d39f71e9be202818288726777d1ca8ac09 (diff) |
- Add MASM assembler files for MSVC x64 projects to support vm_x86 in x64 mode - Clean up ftol()/snapvector() mess - Make use of SSE instructions for ftol()/snapvector() if available - move ftol/snapvector pure assembler to inline assembler, this will add x86_64 and improve support for different calling conventions - Set FPU control word at program startup to get consistent behaviour on all platforms
Diffstat (limited to 'src/renderer/tr_shade_calc.c')
-rw-r--r-- | src/renderer/tr_shade_calc.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/renderer/tr_shade_calc.c b/src/renderer/tr_shade_calc.c index 13fcf0b5..8d02177b 100644 --- a/src/renderer/tr_shade_calc.c +++ b/src/renderer/tr_shade_calc.c @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif -#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ myftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) +#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ Q_ftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) static float *TableForFunc( genFunc_t func ) { @@ -700,7 +700,7 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors ) glow = 1; } - v = myftol( 255 * glow ); + v = Q_ftol(255 * glow); color[0] = color[1] = color[2] = v; color[3] = 255; v = *(int *)color; @@ -1019,21 +1019,6 @@ void RB_CalcRotateTexCoords( float degsPerSecond, float *st ) } - - - - -#if id386 && !defined(__GNUC__) - -long myftol( float f ) { - static int tmp; - __asm fld f - __asm fistp tmp - __asm mov eax, tmp -} - -#endif - /* ** RB_CalcSpecularAlpha ** @@ -1196,19 +1181,19 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors ) *(int *)&colors[i*4] = ambientLightInt; continue; } - j = myftol( ambientLight[0] + incoming * directedLight[0] ); + j = Q_ftol(ambientLight[0] + incoming * directedLight[0]); if ( j > 255 ) { j = 255; } colors[i*4+0] = j; - j = myftol( ambientLight[1] + incoming * directedLight[1] ); + j = Q_ftol(ambientLight[1] + incoming * directedLight[1]); if ( j > 255 ) { j = 255; } colors[i*4+1] = j; - j = myftol( ambientLight[2] + incoming * directedLight[2] ); + j = Q_ftol(ambientLight[2] + incoming * directedLight[2]); if ( j > 255 ) { j = 255; } |