- 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
This commit is contained in:
parent
471182cba0
commit
03201aff22
22 changed files with 540 additions and 460 deletions
|
@ -359,9 +359,9 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
|
|||
}
|
||||
|
||||
// save out the byte packet version
|
||||
((byte *)&ent->ambientLightInt)[0] = myftol( ent->ambientLight[0] );
|
||||
((byte *)&ent->ambientLightInt)[1] = myftol( ent->ambientLight[1] );
|
||||
((byte *)&ent->ambientLightInt)[2] = myftol( ent->ambientLight[2] );
|
||||
((byte *)&ent->ambientLightInt)[0] = Q_ftol(ent->ambientLight[0]);
|
||||
((byte *)&ent->ambientLightInt)[1] = Q_ftol(ent->ambientLight[1]);
|
||||
((byte *)&ent->ambientLightInt)[2] = Q_ftol(ent->ambientLight[2]);
|
||||
((byte *)&ent->ambientLightInt)[3] = 0xff;
|
||||
|
||||
// transform the direction to local space
|
||||
|
|
|
@ -34,14 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define GL_INDEX_TYPE GL_UNSIGNED_INT
|
||||
typedef unsigned int glIndex_t;
|
||||
|
||||
// fast float to int conversion
|
||||
#if id386 && !defined(__GNUC__)
|
||||
long myftol( float f );
|
||||
#else
|
||||
#define myftol(x) ((int)(x))
|
||||
#endif
|
||||
|
||||
|
||||
// everything that is needed by the backend needs
|
||||
// to be double buffered to allow it to run in
|
||||
// parallel on a dual cpu machine
|
||||
|
|
|
@ -218,7 +218,7 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
|
|||
}
|
||||
|
||||
flod *= tr.currentModel->numLods;
|
||||
lod = myftol( flod );
|
||||
lod = Q_ftol(flod);
|
||||
|
||||
if ( lod < 0 )
|
||||
{
|
||||
|
|
|
@ -233,7 +233,7 @@ static void R_BindAnimatedImage( textureBundle_t *bundle ) {
|
|||
|
||||
// it is necessary to do this messy calc to make sure animations line up
|
||||
// exactly with waveforms of the same frequency
|
||||
index = myftol( tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE );
|
||||
index = Q_ftol(tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE);
|
||||
index >>= FUNCTABLE_SIZE2;
|
||||
|
||||
if ( index < 0 ) {
|
||||
|
@ -689,9 +689,9 @@ static void ProjectDlightTexture_scalar( void ) {
|
|||
}
|
||||
}
|
||||
clipBits[i] = clip;
|
||||
colors[0] = myftol(floatColor[0] * modulate);
|
||||
colors[1] = myftol(floatColor[1] * modulate);
|
||||
colors[2] = myftol(floatColor[2] * modulate);
|
||||
colors[0] = Q_ftol(floatColor[0] * modulate);
|
||||
colors[1] = Q_ftol(floatColor[1] * modulate);
|
||||
colors[2] = Q_ftol(floatColor[2] * modulate);
|
||||
colors[3] = 255;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,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 )
|
||||
{
|
||||
|
@ -699,7 +699,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;
|
||||
|
@ -1018,21 +1018,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
|
||||
**
|
||||
|
@ -1195,19 +1180,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;
|
||||
}
|
||||
|
|
|
@ -553,10 +553,10 @@ static void FillCloudBox( const shader_t *shader, int stage )
|
|||
continue;
|
||||
}
|
||||
|
||||
sky_mins_subd[0] = myftol( sky_mins[0][i] * HALF_SKY_SUBDIVISIONS );
|
||||
sky_mins_subd[1] = myftol( sky_mins[1][i] * HALF_SKY_SUBDIVISIONS );
|
||||
sky_maxs_subd[0] = myftol( sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS );
|
||||
sky_maxs_subd[1] = myftol( sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS );
|
||||
sky_mins_subd[0] = Q_ftol(sky_mins[0][i] * HALF_SKY_SUBDIVISIONS);
|
||||
sky_mins_subd[1] = Q_ftol(sky_mins[1][i] * HALF_SKY_SUBDIVISIONS);
|
||||
sky_maxs_subd[0] = Q_ftol(sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS);
|
||||
sky_maxs_subd[1] = Q_ftol(sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS);
|
||||
|
||||
if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS )
|
||||
sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue