Remove the unused, outdated AMD 3DNow! code. Both SDL and OpenGL support 3DNow.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@231 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
dc6d7963c6
commit
1c3458fe82
|
@ -205,28 +205,10 @@ static void AddIMDPrimativesBSP2(iIMDShape *IMDdef,iIMDPoly *ScrVertices, UDWORD
|
|||
* Will support zbuffering, texturing, coloured lighting and alpha effects
|
||||
* Avoids recalculating vertex projections for every poly
|
||||
***************************************************************************/
|
||||
|
||||
//#define _3DNOW
|
||||
|
||||
//#ifdef _3DNOW
|
||||
#include "amd3d.h"
|
||||
//#endif
|
||||
|
||||
// ---
|
||||
// DEV STUDIO 5, 3D NOW and INTEL VERSION.
|
||||
#if (_MSC_VER != 1000) && (_MSC_VER != 1020)
|
||||
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD spec, int pieFlag, int pieFlagData)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// needed for AMD
|
||||
int amd_scale = 0x3a800000; // 2^-10
|
||||
int amd_pie_RAISE_SCALE = 0x3b800000; // 2^-8
|
||||
int amd_sign = 0x80000000;
|
||||
int amd_RAISE = 0;
|
||||
int amd_HEIGHT_SCALED = 0x3f800000;
|
||||
#endif
|
||||
|
||||
// needed for intel
|
||||
int32 rx, ry, rz;
|
||||
int32 tzx, tzy;
|
||||
int32 tempY;
|
||||
|
@ -370,125 +352,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
|
|||
pVertices = shape->points;
|
||||
pPixels = &scrPoints[0];
|
||||
|
||||
if(weHave3DNow()) // call alex m's AMD detection stuff - uses _emit?!?!?
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Mike Goddard's funky code replacement.
|
||||
_asm {
|
||||
FEMMS
|
||||
|
||||
movd mm2, amd_RAISE // defaults
|
||||
mov eax, pieFlag
|
||||
test eax, pie_RAISE
|
||||
jz no_RAISE
|
||||
movd mm0, pieFlagData
|
||||
pi2fd (m0, m0)
|
||||
movd amd_RAISE, mm0
|
||||
movq mm2, mm0 // for first iteration
|
||||
no_RAISE:
|
||||
movd mm3, amd_HEIGHT_SCALED // defaults
|
||||
test eax, pie_HEIGHT_SCALED
|
||||
jz no_HEIGHT_SCALED
|
||||
movd mm0, pieFlagData
|
||||
movd mm1, amd_pie_RAISE_SCALE
|
||||
pi2fd (m0, m0)
|
||||
pfmul (m0, m1)
|
||||
movd amd_HEIGHT_SCALED, mm0
|
||||
movq mm3, mm0 // for first iteration
|
||||
no_HEIGHT_SCALED:
|
||||
|
||||
mov eax, pVertices
|
||||
mov ebx, psMatrix
|
||||
mov ecx, shape
|
||||
mov edx, pPixels
|
||||
mov ecx, [ecx]iIMDShape.npoints
|
||||
mov edi, psRendSurface
|
||||
test ecx, ecx
|
||||
je tloop_done
|
||||
tloop:
|
||||
movd mm1, [eax+4] // 0 | y
|
||||
;
|
||||
movd mm0, [eax] // 0 | x
|
||||
;
|
||||
pi2fd (m1, m1)
|
||||
;
|
||||
pi2fd (m0, m0)
|
||||
;
|
||||
pfsub (m1, m2) // 0 | RAISE y
|
||||
movd mm2, [eax+8] // 0 | z
|
||||
movq mm7, [ebx] // b | a
|
||||
punpckldq mm0, mm0 // x | x
|
||||
movq mm6, [ebx+12] // e | d
|
||||
pfmul (m1, m3) // 0 | SCALE y
|
||||
movq mm5, [ebx+24] // h | g
|
||||
punpckldq mm2, mm2 // z | z
|
||||
movd mm4, [ebx+8] // 0 | c
|
||||
punpckldq mm1, mm1 // y | y
|
||||
pi2fd (m2, m2)
|
||||
;
|
||||
pi2fd (m7, m7)
|
||||
;
|
||||
pi2fd (m6, m6)
|
||||
;
|
||||
pi2fd (m5, m5)
|
||||
pfmul (m7, m0) // x*b | x*a
|
||||
pi2fd (m4, m4)
|
||||
pfmul (m6, m1) // y*e | y*d
|
||||
pfmul (m5, m2) // z*h | z*g
|
||||
;
|
||||
pfadd (m6, m7) // y*e+x*b | y*d+x*a
|
||||
movd mm7, [ebx+20] // 0 | f
|
||||
pfmul (m4, m0) // 0 | x*c
|
||||
;
|
||||
pi2fd (m7, m7)
|
||||
;
|
||||
pfadd (m5, m6) // z*h+y*e+x*b | z*g+y*d+x*a
|
||||
movd mm6, [ebx+32] // 0 | i
|
||||
pfmul (m7, m1) // 0 | y*f
|
||||
movq mm0, [ebx+36] // k | j
|
||||
pi2fd (m6, m6)
|
||||
movd mm1, [ebx+44] // 0 | l
|
||||
pfadd (m7, m4) // 0 | y*f+x*c
|
||||
movd mm4, amd_scale
|
||||
pfmul (m6, m2) // 0 | z*i
|
||||
pi2fd (m0, m0)
|
||||
pi2fd (m1, m1)
|
||||
;
|
||||
pfadd (m6, m7) // 0 | z*i+y*f+x*c
|
||||
;
|
||||
pfadd (m5, m0) // ry | rx
|
||||
pxor mm0, mm0
|
||||
pfadd (m6, m1) // 0 | rz
|
||||
punpckldq mm0, amd_sign
|
||||
movq mm1, [edi]iSurface.xcentre
|
||||
pxor mm2, mm2
|
||||
pfmul (m6, m4) // 0 | srz
|
||||
movd [edx]PIEPIXEL.d3dz, mm6
|
||||
pxor mm5, mm0
|
||||
pi2fd (m1, m1)
|
||||
pfmax (m6, m2) // chop less than zero to max
|
||||
movd mm2, amd_RAISE // restore
|
||||
;
|
||||
;
|
||||
pfrcp (m7, m6) // 1/srz | 1/srz
|
||||
movd mm3, amd_HEIGHT_SCALED // restore
|
||||
;
|
||||
;
|
||||
pfmul (m5, m7) // ry/srz | rx/srz
|
||||
add eax, 12
|
||||
add edx, 12
|
||||
dec ecx
|
||||
pfadd (m5, m1)
|
||||
movq [edx-12]PIEPIXEL.d3dx, mm5
|
||||
jne tloop
|
||||
tloop_done:
|
||||
FEMMS
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
else // run the intel one
|
||||
//--
|
||||
for (i=0; i<shape->npoints; i++, pVertices++, pPixels++)
|
||||
for (i=0; i<shape->npoints; i++, pVertices++, pPixels++)
|
||||
{
|
||||
tempY = pVertices->y;
|
||||
if (pieFlag & pie_RAISE)
|
||||
|
@ -918,374 +782,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
|
|||
}
|
||||
}
|
||||
#endif
|
||||
// THE VERSION MIKE CHANGED.
|
||||
// 3D NOW Specific (and FASTER) shape renderer.
|
||||
#if 0
|
||||
/*
|
||||
void pie_Draw3DNowShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD spec, int pieFlag, int pieFlagData)
|
||||
{
|
||||
|
||||
int amd_scale = 0x3a800000; // 2^-10
|
||||
int amd_pie_RAISE_SCALE = 0x3b800000; // 2^-8
|
||||
int amd_sign = 0x80000000;
|
||||
int amd_RAISE = 0;
|
||||
int amd_HEIGHT_SCALED = 0x3f800000;
|
||||
|
||||
int i, n;
|
||||
iVector *pVertices;
|
||||
PIEPIXEL *pPixels;
|
||||
iIMDPoly *pPolys;
|
||||
PIEPOLY piePoly;
|
||||
iIMDPoly imdPoly;
|
||||
VERTEXID *index;
|
||||
PIELIGHT colour, specular;
|
||||
UBYTE alpha;
|
||||
|
||||
pieCount++;
|
||||
|
||||
// Fix for transparent buildings and features!!
|
||||
if( (pieFlag & pie_TRANSLUCENT) AND (pieFlagData>220) )
|
||||
{
|
||||
pieFlag = pieFlagData = 0; // force to bilinear and non-transparent
|
||||
}
|
||||
// Fix for transparent buildings and features!!
|
||||
|
||||
|
||||
|
||||
// WARZONE light as byte passed in colour so expand
|
||||
if (col <= MAX_UB_LIGHT)
|
||||
{
|
||||
if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
{
|
||||
colour.byte.a = 0;//no fog
|
||||
}
|
||||
else
|
||||
{
|
||||
colour.byte.a = 255;//no fog
|
||||
}
|
||||
colour.byte.r = (UBYTE)col;
|
||||
colour.byte.g = (UBYTE)col;
|
||||
colour.byte.b = (UBYTE)col;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour.argb = col;
|
||||
}
|
||||
specular.argb = spec;
|
||||
|
||||
if (frame == 0)
|
||||
{
|
||||
frame = team;
|
||||
}
|
||||
|
||||
if (!pie_Translucent())
|
||||
{
|
||||
if ((pieFlag & pie_ADDITIVE) || (pieFlag & pie_TRANSLUCENT))
|
||||
{
|
||||
pieFlag &= (pie_FLAG_MASK - pie_TRANSLUCENT - pie_ADDITIVE);
|
||||
pieFlag |= pie_NO_BILINEAR;
|
||||
}
|
||||
}
|
||||
else if (!pie_Additive())
|
||||
{
|
||||
if (pieFlag & pie_ADDITIVE)//Assume also translucent
|
||||
{
|
||||
pieFlag -= pie_ADDITIVE;
|
||||
pieFlag |= pie_TRANSLUCENT;
|
||||
pieFlag |= pie_NO_BILINEAR;
|
||||
pieFlagData /= 2;
|
||||
}
|
||||
}
|
||||
// Set tranlucency
|
||||
if (pieFlag & pie_ADDITIVE)//Assume also translucent
|
||||
{
|
||||
pie_SetFogStatus(FALSE);
|
||||
pie_SetRendMode(REND_ADDITIVE_TEX);
|
||||
if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
{
|
||||
alpha = 255-colour.byte.a;
|
||||
alpha = pie_ByteScale(alpha, (UBYTE)pieFlagData);//scale transparency by fog value
|
||||
colour.byte.a = alpha;
|
||||
}
|
||||
else if (pie_GetRenderEngine() == ENGINE_D3D)
|
||||
{
|
||||
alpha = 255-specular.byte.a;
|
||||
alpha = pie_ByteScale(alpha, (UBYTE)pieFlagData);//scale transparency by fog value
|
||||
colour.byte.a = alpha;
|
||||
colour.byte.r = pie_ByteScale(alpha, colour.byte.r);
|
||||
colour.byte.g = pie_ByteScale(alpha, colour.byte.g);
|
||||
colour.byte.b = pie_ByteScale(alpha, colour.byte.b);
|
||||
specular.argb = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour.byte.a = (UBYTE)pieFlagData;
|
||||
}
|
||||
pie_SetBilinear(TRUE);
|
||||
}
|
||||
else if (pieFlag & pie_TRANSLUCENT)
|
||||
{
|
||||
pie_SetFogStatus(FALSE);
|
||||
pie_SetRendMode(REND_ALPHA_TEX);
|
||||
if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
{
|
||||
alpha = 255-colour.byte.a;
|
||||
alpha = pie_ByteScale(alpha, (UBYTE)pieFlagData);//scale transparency by fog value
|
||||
colour.byte.a = alpha;
|
||||
}
|
||||
else if (pie_GetRenderEngine() == ENGINE_D3D)
|
||||
{
|
||||
alpha = 255-specular.byte.a;
|
||||
alpha = pie_ByteScale(alpha, (UBYTE)pieFlagData);//scale transparency by fog value
|
||||
colour.byte.a = alpha;
|
||||
specular.argb = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour.byte.a = (UBYTE)pieFlagData;
|
||||
}
|
||||
pie_SetBilinear(FALSE);//never bilinear with constant alpha, gives black edges
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pieFlag & pie_BUTTON)
|
||||
{
|
||||
pie_SetFogStatus(FALSE);
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie_SetFogStatus(TRUE);
|
||||
}
|
||||
pie_SetRendMode(REND_GOURAUD_TEX);
|
||||
//if hardware fog then alpha is set else unused in decal mode
|
||||
//colour.byte.a = MAX_UB_LIGHT;
|
||||
if (pieFlag & pie_NO_BILINEAR)
|
||||
{
|
||||
pie_SetBilinear(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie_SetBilinear(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pieFlag & pie_RAISE)
|
||||
{
|
||||
pieFlagData = (shape->ymax * (pie_RAISE_SCALE - pieFlagData))/pie_RAISE_SCALE;
|
||||
}
|
||||
|
||||
pie_SetTexturePage(shape->texpage);
|
||||
|
||||
|
||||
//now draw the shape
|
||||
//rotate and project points from shape->points to scrPoints
|
||||
pVertices = shape->points;
|
||||
pPixels = &scrPoints[0];
|
||||
|
||||
// Mike Goddard's funky code replacement.
|
||||
_asm {
|
||||
FEMMS
|
||||
|
||||
movd mm2, amd_RAISE // defaults
|
||||
mov eax, pieFlag
|
||||
test eax, pie_RAISE
|
||||
jz no_RAISE
|
||||
movd mm0, pieFlagData
|
||||
pi2fd (m0, m0)
|
||||
movd amd_RAISE, mm0
|
||||
movq mm2, mm0 // for first iteration
|
||||
no_RAISE:
|
||||
movd mm3, amd_HEIGHT_SCALED // defaults
|
||||
test eax, pie_HEIGHT_SCALED
|
||||
jz no_HEIGHT_SCALED
|
||||
movd mm0, pieFlagData
|
||||
movd mm1, amd_pie_RAISE_SCALE
|
||||
pi2fd (m0, m0)
|
||||
pfmul (m0, m1)
|
||||
movd amd_HEIGHT_SCALED, mm0
|
||||
movq mm3, mm0 // for first iteration
|
||||
no_HEIGHT_SCALED:
|
||||
|
||||
mov eax, pVertices
|
||||
mov ebx, psMatrix
|
||||
mov ecx, shape
|
||||
mov edx, pPixels
|
||||
mov ecx, [ecx]iIMDShape.npoints
|
||||
mov edi, psRendSurface
|
||||
test ecx, ecx
|
||||
je tloop_done
|
||||
tloop:
|
||||
movd mm1, [eax+4] // 0 | y
|
||||
;
|
||||
movd mm0, [eax] // 0 | x
|
||||
;
|
||||
pi2fd (m1, m1)
|
||||
;
|
||||
pi2fd (m0, m0)
|
||||
;
|
||||
pfsub (m1, m2) // 0 | RAISE y
|
||||
movd mm2, [eax+8] // 0 | z
|
||||
movq mm7, [ebx] // b | a
|
||||
punpckldq mm0, mm0 // x | x
|
||||
movq mm6, [ebx+12] // e | d
|
||||
pfmul (m1, m3) // 0 | SCALE y
|
||||
movq mm5, [ebx+24] // h | g
|
||||
punpckldq mm2, mm2 // z | z
|
||||
movd mm4, [ebx+8] // 0 | c
|
||||
punpckldq mm1, mm1 // y | y
|
||||
pi2fd (m2, m2)
|
||||
;
|
||||
pi2fd (m7, m7)
|
||||
;
|
||||
pi2fd (m6, m6)
|
||||
;
|
||||
pi2fd (m5, m5)
|
||||
pfmul (m7, m0) // x*b | x*a
|
||||
pi2fd (m4, m4)
|
||||
pfmul (m6, m1) // y*e | y*d
|
||||
pfmul (m5, m2) // z*h | z*g
|
||||
;
|
||||
pfadd (m6, m7) // y*e+x*b | y*d+x*a
|
||||
movd mm7, [ebx+20] // 0 | f
|
||||
pfmul (m4, m0) // 0 | x*c
|
||||
;
|
||||
pi2fd (m7, m7)
|
||||
;
|
||||
pfadd (m5, m6) // z*h+y*e+x*b | z*g+y*d+x*a
|
||||
movd mm6, [ebx+32] // 0 | i
|
||||
pfmul (m7, m1) // 0 | y*f
|
||||
movq mm0, [ebx+36] // k | j
|
||||
pi2fd (m6, m6)
|
||||
movd mm1, [ebx+44] // 0 | l
|
||||
pfadd (m7, m4) // 0 | y*f+x*c
|
||||
movd mm4, amd_scale
|
||||
pfmul (m6, m2) // 0 | z*i
|
||||
pi2fd (m0, m0)
|
||||
pi2fd (m1, m1)
|
||||
;
|
||||
pfadd (m6, m7) // 0 | z*i+y*f+x*c
|
||||
;
|
||||
pfadd (m5, m0) // ry | rx
|
||||
pxor mm0, mm0
|
||||
pfadd (m6, m1) // 0 | rz
|
||||
punpckldq mm0, amd_sign
|
||||
movq mm1, [edi]iSurface.xcentre
|
||||
pxor mm2, mm2
|
||||
pfmul (m6, m4) // 0 | srz
|
||||
movd [edx]PIEPIXEL.d3dz, mm6
|
||||
pxor mm5, mm0
|
||||
pi2fd (m1, m1)
|
||||
pfmax (m6, m2) // chop less than zero to max
|
||||
movd mm2, amd_RAISE // restore
|
||||
;
|
||||
;
|
||||
pfrcp (m7, m6) // 1/srz | 1/srz
|
||||
movd mm3, amd_HEIGHT_SCALED // restore
|
||||
;
|
||||
;
|
||||
pfmul (m5, m7) // ry/srz | rx/srz
|
||||
add eax, 12
|
||||
add edx, 12
|
||||
dec ecx
|
||||
pfadd (m5, m1)
|
||||
movq [edx-12]PIEPIXEL.d3dx, mm5
|
||||
jne tloop
|
||||
tloop_done:
|
||||
FEMMS
|
||||
}
|
||||
|
||||
|
||||
#ifdef BSPIMD
|
||||
|
||||
if ((!pie_Hardware()) AND shape->BSPNode!=NULL)
|
||||
{
|
||||
AddIMDPrimativesBSP2(shape,scrPoints,frame);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//build and render polygons
|
||||
if (pie_GetRenderEngine() == ENGINE_4101)
|
||||
{
|
||||
pPolys = shape->polys;
|
||||
for (i=0; i<shape->npolys; i++, pPolys++)
|
||||
{
|
||||
|
||||
index = pPolys->pindex;
|
||||
imdPoly.flags = pPolys->flags;
|
||||
for (n=0; n<pPolys->npnts; n++, index++)
|
||||
{
|
||||
imdVrts[n].x = MAKEINT(scrPoints[*index].d3dx);
|
||||
imdVrts[n].y = MAKEINT(scrPoints[*index].d3dy);
|
||||
imdVrts[n].z = 0;
|
||||
|
||||
//cull triangles with off screen points
|
||||
if (scrPoints[*index].d3dy > (float)LONG_TEST)
|
||||
imdPoly.flags = 0;
|
||||
|
||||
imdVrts[n].u = pPolys->vrt[n].u;
|
||||
imdVrts[n].v = pPolys->vrt[n].v;
|
||||
imdVrts[n].g = 128;//(red + green + blue + alpha)>>2;
|
||||
}
|
||||
imdPoly.npnts = pPolys->npnts;
|
||||
imdPoly.vrt = &imdVrts[0];
|
||||
#ifndef PIEPSX // was #ifndef PSX
|
||||
imdPoly.pTexAnim = pPolys->pTexAnim;
|
||||
#endif
|
||||
if (imdPoly.flags > 0)
|
||||
{
|
||||
pie_IvisPolyFrame(shape->texpage, &imdPoly,frame,TRUE); // draw the polygon ... this is an inline function
|
||||
}
|
||||
}
|
||||
}
|
||||
else //if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
{
|
||||
pPolys = shape->polys;
|
||||
for (i=0; i<shape->npolys; i++, pPolys++)
|
||||
{
|
||||
index = pPolys->pindex;
|
||||
piePoly.flags = pPolys->flags;
|
||||
if (pieFlag & pie_TRANSLUCENT)
|
||||
{
|
||||
piePoly.flags |= PIE_ALPHA;
|
||||
}
|
||||
for (n=0; n<pPolys->npnts; n++, index++)
|
||||
{
|
||||
pieVrts[n].sx = MAKEINT(scrPoints[*index].d3dx);
|
||||
pieVrts[n].sy = MAKEINT(scrPoints[*index].d3dy);
|
||||
//cull triangles with off screen points
|
||||
if (scrPoints[*index].d3dy > (float)LONG_TEST)
|
||||
{
|
||||
piePoly.flags = 0;
|
||||
}
|
||||
pieVrts[n].sz = MAKEINT(scrPoints[*index].d3dz);
|
||||
pieVrts[n].tu = pPolys->vrt[n].u;
|
||||
pieVrts[n].tv = pPolys->vrt[n].v;
|
||||
pieVrts[n].light.argb = colour.argb;
|
||||
pieVrts[n].specular.argb = specular.argb;
|
||||
}
|
||||
piePoly.nVrts = pPolys->npnts;
|
||||
piePoly.pVrts = &pieVrts[0];
|
||||
#ifndef PIEPSX // was #ifndef PSX
|
||||
piePoly.pTexAnim = pPolys->pTexAnim;
|
||||
#endif
|
||||
if (piePoly.flags > 0)
|
||||
{
|
||||
pie_PiePolyFrame(&piePoly,frame,TRUE); // draw the polygon ... this is an inline function
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (pieFlag & pie_BUTTON)
|
||||
{
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* pie_Drawimage
|
||||
*
|
||||
|
|
|
@ -62,76 +62,6 @@ void (*iV_ppBitmapColourTrans)(iBitmap *bmp, int x, int y, int w, int h, int ow,
|
|||
//******
|
||||
|
||||
|
||||
static BOOL bHas3DNow;
|
||||
BOOL weHave3DNow( void )
|
||||
{
|
||||
return(bHas3DNow);
|
||||
}
|
||||
|
||||
#define CPUID __asm _emit 0x0f __asm _emit 0xa2
|
||||
|
||||
BOOL cpuHas3DNow( void )
|
||||
{
|
||||
BOOL b3DNow;
|
||||
/* As of yet - we haven't found an AMD 3DNow! equipped processor */
|
||||
b3DNow = FALSE;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
_asm
|
||||
{
|
||||
push ebx
|
||||
push edx
|
||||
push ecx
|
||||
pushfd
|
||||
pushfd
|
||||
pop eax
|
||||
mov edx,eax
|
||||
xor eax,0200000h
|
||||
push eax
|
||||
popfd
|
||||
pushfd
|
||||
pop eax
|
||||
cmp eax,edx
|
||||
// quit if the processor has no cpu id query instructions
|
||||
jz has_no_3dnow
|
||||
// Otherwise, establish what kind of CPU we have found
|
||||
xor eax,eax
|
||||
// issue the cpuid instruction
|
||||
CPUID
|
||||
// Now we need to check for an AMD processor - the id is authenticAMD
|
||||
cmp ebx,068747541h // htuA
|
||||
jnz has_no_3dnow
|
||||
cmp edx,069746e65h // itne
|
||||
jnz has_no_3dnow
|
||||
cmp ecx,0444d4163h // DMAc
|
||||
jnz has_no_3dnow
|
||||
// At this point we could check for other vendors that support AMD technology and 3DNow, but....
|
||||
mov eax,080000000h
|
||||
CPUID
|
||||
test eax,eax
|
||||
jz has_no_3dnow
|
||||
mov eax,080000001h
|
||||
CPUID
|
||||
test edx,080000000h // we have 3DNow!
|
||||
jz has_no_3dnow
|
||||
// Need to send back that we have 3D now support
|
||||
mov eax,1 // we have it
|
||||
jmp has_3d_now
|
||||
has_no_3dnow:
|
||||
mov eax,0
|
||||
has_3d_now:
|
||||
mov b3DNow,eax
|
||||
popfd
|
||||
pop ecx
|
||||
pop edx
|
||||
pop ebx
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
return(b3DNow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32 iV_VideoMemorySize(int mode)
|
||||
|
||||
{
|
||||
|
@ -441,7 +371,6 @@ void iV_RenderAssign(int mode, iSurface *s)
|
|||
{
|
||||
/* Need to look into this - won't the unwanted called still set render surface? */
|
||||
psRendSurface = s;
|
||||
bHas3DNow = cpuHas3DNow(); // do some funky stuff to see if we have an AMD
|
||||
g_mode = mode;
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -217,14 +217,6 @@ pie_Polygon(SDWORD numVerts, PIEVERTEX* pVrts, FRACT texture_offset) {
|
|||
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD spec, int pieFlag, int pieFlagData)
|
||||
{
|
||||
|
||||
// needed for AMD
|
||||
// int amd_scale = 0x3a800000; // 2^-10
|
||||
// int amd_pie_RAISE_SCALE = 0x3b800000; // 2^-8
|
||||
// int amd_sign = 0x80000000;
|
||||
// int amd_RAISE = 0;
|
||||
// int amd_HEIGHT_SCALED = 0x3f800000;
|
||||
|
||||
// needed for intel
|
||||
int32 rx, ry, rz;
|
||||
int32 tzx, tzy;
|
||||
int32 tempY;
|
||||
|
|
|
@ -46,77 +46,6 @@ void (*iV_ppBitmapColourTrans)(iBitmap *bmp, int x, int y, int w, int h, int ow,
|
|||
//*
|
||||
//******
|
||||
|
||||
|
||||
static BOOL bHas3DNow;
|
||||
BOOL weHave3DNow( void )
|
||||
{
|
||||
return(bHas3DNow);
|
||||
}
|
||||
|
||||
#define CPUID __asm _emit 0x0f __asm _emit 0xa2
|
||||
|
||||
BOOL cpuHas3DNow( void )
|
||||
{
|
||||
BOOL b3DNow;
|
||||
/* As of yet - we haven't found an AMD 3DNow! equipped processor */
|
||||
b3DNow = FALSE;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
_asm
|
||||
{
|
||||
push ebx
|
||||
push edx
|
||||
push ecx
|
||||
pushfd
|
||||
pushfd
|
||||
pop eax
|
||||
mov edx,eax
|
||||
xor eax,0200000h
|
||||
push eax
|
||||
popfd
|
||||
pushfd
|
||||
pop eax
|
||||
cmp eax,edx
|
||||
// quit if the processor has no cpu id query instructions
|
||||
jz has_no_3dnow
|
||||
// Otherwise, establish what kind of CPU we have found
|
||||
xor eax,eax
|
||||
// issue the cpuid instruction
|
||||
CPUID
|
||||
// Now we need to check for an AMD processor - the id is authenticAMD
|
||||
cmp ebx,068747541h // htuA
|
||||
jnz has_no_3dnow
|
||||
cmp edx,069746e65h // itne
|
||||
jnz has_no_3dnow
|
||||
cmp ecx,0444d4163h // DMAc
|
||||
jnz has_no_3dnow
|
||||
// At this point we could check for other vendors that support AMD technology and 3DNow, but....
|
||||
mov eax,080000000h
|
||||
CPUID
|
||||
test eax,eax
|
||||
jz has_no_3dnow
|
||||
mov eax,080000001h
|
||||
CPUID
|
||||
test edx,080000000h // we have 3DNow!
|
||||
jz has_no_3dnow
|
||||
// Need to send back that we have 3D now support
|
||||
mov eax,1 // we have it
|
||||
jmp has_3d_now
|
||||
has_no_3dnow:
|
||||
mov eax,0
|
||||
has_3d_now:
|
||||
mov b3DNow,eax
|
||||
popfd
|
||||
pop ecx
|
||||
pop edx
|
||||
pop ebx
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
return(b3DNow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32 iV_VideoMemorySize(int mode)
|
||||
|
||||
{
|
||||
|
@ -401,8 +330,6 @@ void iV_RenderAssign(int mode, iSurface *s)
|
|||
/* Need to look into this - won't the unwanted called still set render surface? */
|
||||
psRendSurface = s;
|
||||
|
||||
bHas3DNow = FALSE; // do some funky stuff to see if we have an AMD
|
||||
|
||||
g_mode = mode;
|
||||
|
||||
iV_SetTransFilter = SetTransFilter;
|
||||
|
|
|
@ -316,30 +316,14 @@ void kf_FrameRate( void )
|
|||
|
||||
if (pie_GetRenderEngine() == ENGINE_OPENGL) //Was ENGINE_D3D -Q
|
||||
{
|
||||
if(weHave3DNow())
|
||||
{
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"DIRECT3D (With AMD 3DNow!) fps %d; PIEs %d; polys %d; Terr. polys %d; States %d",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount,loopStateChanges));
|
||||
}
|
||||
else
|
||||
{
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"DIRECT3D fps %d; PIEs %d; polys %d; Terr. polys %d; States %d",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount,loopStateChanges));
|
||||
}
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"DIRECT3D fps %d; PIEs %d; polys %d; Terr. polys %d; States %d",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount,loopStateChanges));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(weHave3DNow())
|
||||
{
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"SOFTWARE (With AMD 3DNow!) fps - %d; pie's - %d; polys - %d; Terr. polys - %d;",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"SOFTWARE fps - %d; pie's - %d; polys - %d; Terr. polys - %d;",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount));
|
||||
}
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"SOFTWARE fps - %d; pie's - %d; polys - %d; Terr. polys - %d;",
|
||||
frameGetFrameRate(),loopPieCount,loopPolyCount,loopTileCount));
|
||||
}
|
||||
if (bMultiPlayer)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue