Okay, so it's still not working perfectly, it just looks like it. :)

Trivial_accept is switched on, but the asm is disabled for now.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@913 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-22 05:00:25 +00:00
parent 219fd9ec38
commit bb2fd1c05d
7 changed files with 174 additions and 229 deletions

View File

@ -282,7 +282,7 @@ void D_DrawSurfaces (void)
d_zistepv = 0;
d_ziorigin = -0.9;
D_DrawSolidSurface (s, (int)r_clearcolor.value & 0xFF);
D_DrawSolidSurface (s, (int)r_fastskycolour.value & 0xFF);
D_DrawZSpans (s->spans);
continue;
}

View File

@ -74,6 +74,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define stv_s 0
#define stv_t 4
#define stv_size 8
#define stv_shift 4
// trivertx_t structure

View File

@ -1104,7 +1104,7 @@ C(D_PolysetDrawAsm):
// D_DrawNonSubdiv ();
movl C(r_affinetridesc)+atd_drawtype,%eax
testl %eax,%eax
jz C(D_DrawNonSubdiv)
jz C(D_DrawNonSubdivAsm)
pushl %ebp // preserve caller stack frame pointer
@ -1564,8 +1564,8 @@ LNextVert:
// not C-callable because of stack buffer cleanup
//----------------------------------------------------------------------
.globl C(D_DrawNonSubdiv)
C(D_DrawNonSubdiv):
.globl C(D_DrawNonSubdivAsm)
C(D_DrawNonSubdivAsm):
pushl %ebp // preserve caller stack frame pointer
movl C(r_affinetridesc)+atd_numtriangles,%ebp
pushl %ebx
@ -1626,104 +1626,101 @@ LNDLoop:
movl %eax,C(d_xdenom)
fildl C(d_xdenom)
//ecx = index0
//edx = index1
//ebx = index2
//edi = temp
//eax = temp (non cachable)
//esi = temp (non cachable)
//use esi for st pointer?
//edi contains base triangles
//ebp is the current triangle number
//
movl C(r_affinetridesc)+atd_pstverts,%edi
// r_p0[0] = index0->v[0]; // u
// r_p0[1] = index0->v[1]; // v
// r_p0[2] = index0->v[2]; // s
// r_p0[3] = index0->v[3]; // t
// r_p0[4] = index0->v[4]; // light
// r_p0[5] = index0->v[5]; // iz
movl fv_v+0(%ecx),%eax
movl fv_v+4(%ecx),%esi
movl %eax,C(r_p0)+0
movl %esi,C(r_p0)+4
movl fv_v+8(%ecx),%eax
movl fv_v+12(%ecx),%esi
movl %eax,C(r_p0)+8
movl %esi,C(r_p0)+12
movl fv_v+16(%ecx),%eax
movl fv_v+20(%ecx),%esi
movl %eax,C(r_p0)+16
movl %esi,C(r_p0)+20
//now we can reuse ecx
movl C(r_affinetridesc)+atd_ptriangles,%ecx
//esi = edi + ecx->st_index[0];
// r_p0[2] = esi->v[2]; // s
// r_p0[3] = esi->v[3]; // t
movl mtri_stindex+0-mtri_size(%ecx,%ebp),%esi
shll $(stv_shift), %esi
addl %edi, %esi
movl stv_s(%esi), %eax
movl stv_t(%esi), %esi
movl %eax,C(r_p0)+8
movl %esi,C(r_p0)+12
fdivrs float_1
// r_p1[0] = index1->v[0];
// r_p1[1] = index1->v[1];
// r_p1[2] = index1->v[2];
// r_p1[3] = index1->v[3];
// r_p1[4] = index1->v[4];
// r_p1[5] = index1->v[5];
movl fv_v+0(%edx),%eax
movl fv_v+4(%edx),%esi
movl %eax,C(r_p1)+0
movl %esi,C(r_p1)+4
movl fv_v+8(%edx),%eax
movl fv_v+12(%edx),%esi
movl %eax,C(r_p1)+8
movl %esi,C(r_p1)+12
movl fv_v+16(%edx),%eax
movl fv_v+20(%edx),%esi
movl %eax,C(r_p1)+16
movl %esi,C(r_p1)+20
// r_p1[2] = index1->v[2];
// r_p1[3] = index1->v[3];
movl mtri_stindex+4-mtri_size(%ecx,%ebp),%esi
shll $(stv_shift), %esi
addl %edi, %esi
movl stv_s(%esi), %eax
movl stv_t(%esi), %esi
movl %eax,C(r_p1)+8
movl %esi,C(r_p1)+12
// r_p2[0] = index2->v[0];
// r_p2[1] = index2->v[1];
// r_p2[2] = index2->v[2];
// r_p2[3] = index2->v[3];
// r_p2[4] = index2->v[4];
// r_p2[5] = index2->v[5];
movl fv_v+0(%ebx),%eax
movl fv_v+4(%ebx),%esi
movl %eax,C(r_p2)+0
movl %esi,C(r_p2)+4
movl fv_v+8(%ebx),%eax
movl fv_v+12(%ebx),%esi
movl %eax,C(r_p2)+8
movl %esi,C(r_p2)+12
movl fv_v+16(%ebx),%eax
movl fv_v+20(%ebx),%esi
movl %eax,C(r_p2)+16
movl C(r_affinetridesc)+atd_ptriangles,%edi
movl %esi,C(r_p2)+20
// r_p2[2] = index2->v[2];
// r_p2[3] = index2->v[3];
movl mtri_stindex+8-mtri_size(%ecx,%ebp),%esi
shll $(stv_shift), %esi
addl %edi, %esi
movl stv_s(%esi), %eax
movl stv_t(%esi), %esi
movl %eax,C(r_p2)+8
movl %esi,C(r_p2)+12
#ifdef ONSEAMSTUFF
movl mtri_facesfront-mtri_size(%edi,%ebp,1),%eax
// if (!ptri->facesfront)
// {
testl %eax,%eax
jnz LFacesFront
// if (index0->flags & ALIAS_ONSEAM)
// r_p0[2] += r_affinetridesc.seamfixupX16;
movl fv_flags(%ecx),%eax
movl fv_flags(%edx),%esi
movl fv_flags(%ebx),%edi
testl $(ALIAS_ONSEAM),%eax
movl C(r_affinetridesc)+atd_seamfixupX16,%eax
jz LOnseamDone0
addl %eax,C(r_p0)+8
LOnseamDone0:
// if (index1->flags & ALIAS_ONSEAM)
// r_p1[2] += r_affinetridesc.seamfixupX16;
testl $(ALIAS_ONSEAM),%esi
jz LOnseamDone1
addl %eax,C(r_p1)+8
LOnseamDone1:
// if (index2->flags & ALIAS_ONSEAM)
// r_p2[2] += r_affinetridesc.seamfixupX16;
testl $(ALIAS_ONSEAM),%edi
jz LOnseamDone2
addl %eax,C(r_p2)+8
LOnseamDone2:
// }
LFacesFront:
#endif
fstps C(d_xdenom)
// D_PolysetSetEdgeTable ();

View File

@ -126,6 +126,7 @@ void D_PolysetScanLeftEdge (int height);
#endif
void D_PolysetDrawSpans8 (spanpackage_t *pspanpackage);
void D_PolysetDrawSpans8C (spanpackage_t *pspanpackage);
void D_PolysetCalcGradients (int skinwidth);
void D_PolysetCalcGradients32 (int skinwidth);
void D_DrawSubdiv (void);
@ -628,7 +629,10 @@ void D_PolysetDrawSpans8Trans (spanpackage_t *pspanpackage)
if (t_state & TT_REVERSE)
{
D_PolysetDrawSpans8ReverseTrans(pspanpackage);
if (t_state & TT_ONE)
D_PolysetDrawSpans8C(pspanpackage);
else
D_PolysetDrawSpans8ReverseTrans(pspanpackage);
return;
}
@ -1194,7 +1198,7 @@ void D_PolysetDraw16 (void)
else
*/
{
D_DrawNonSubdiv ();
D_DrawNonSubdivC ();
}
}
@ -1269,66 +1273,36 @@ void D_DrawSubdivC (void)
int i;
int lnumtriangles;
void (*drawfnc) (int *p1, int *p2, int *p3);
pfv = r_affinetridesc.pfinalverts;
ptri = r_affinetridesc.ptriangles;
lnumtriangles = r_affinetridesc.numtriangles;
#ifdef PEXT_TRANS
if (r_pixbytes == 4)
{
for (i=0 ; i<lnumtriangles ; i++)
{
index0 = pfv + ptri[i].xyz_index[0];
index1 = pfv + ptri[i].xyz_index[1];
index2 = pfv + ptri[i].xyz_index[2];
if (((index0->v[1]-index1->v[1]) *
(index0->v[0]-index2->v[0]) -
(index0->v[0]-index1->v[0]) *
(index0->v[1]-index2->v[1])) >= 0)
{
continue;
}
d_pcolormap = &((qbyte *)acolormap)[index0->v[4] & 0xFF00];
D_PolysetRecursiveTriangle32Trans(index0->v, index1->v, index2->v);
}
return;
}
if (currententity->alpha != 1)
drawfnc = D_PolysetRecursiveTriangle32Trans;
else if (currententity->alpha != 1)
{
Set_TransLevelF(currententity->alpha);
if (!(t_state & TT_ONE))
{
if (t_state & TT_ZERO)
return;
for (i=0 ; i<lnumtriangles ; i++)
{
index0 = pfv + ptri[i].xyz_index[0];
index1 = pfv + ptri[i].xyz_index[1];
index2 = pfv + ptri[i].xyz_index[2];
if (((index0->v[1]-index1->v[1]) *
(index0->v[0]-index2->v[0]) -
(index0->v[0]-index1->v[0]) *
(index0->v[1]-index2->v[1])) >= 0)
{
continue;
}
d_pcolormap = &((qbyte *)acolormap)[index0->v[4] & 0xFF00];
if (t_state & TT_REVERSE)
D_PolysetRecursiveTriangleReverseTrans(index0->v, index1->v, index2->v);
else
D_PolysetRecursiveTriangleTrans(index0->v, index1->v, index2->v);
}
Set_TransLevelF(currententity->alpha); //fixme: this is being called by every poly!
if (t_state & TT_ZERO)
return;
if (t_state & TT_ONE) //it's solid anyway.
drawfnc = D_PolysetRecursiveTriangle;
else
{
if (t_state & TT_REVERSE)
drawfnc = D_PolysetRecursiveTriangleReverseTrans;
else
drawfnc = D_PolysetRecursiveTriangleTrans;
}
}
else
#endif
drawfnc = D_PolysetRecursiveTriangle;
for (i=0 ; i<lnumtriangles ; i++)
{
@ -1377,19 +1351,6 @@ void D_DrawSubdiv32C (void)
continue;
}
st0 = pst + ptri[i].st_index[0];
st1 = pst + ptri[i].st_index[1];
st2 = pst + ptri[i].st_index[2];
index0->v[2] = st0->s;
index0->v[3] = st0->t;
index1->v[2] = st1->s;
index1->v[3] = st1->t;
index2->v[2] = st2->s;
index2->v[3] = st2->t;
d_pcolormap = &((qbyte *)acolormap)[index0->v[4] & 0xFF00];
D_PolysetRecursiveTriangle32Trans(index0->v, index1->v, index2->v);
@ -1408,17 +1369,13 @@ void D_DrawNonSubdivC (void)
int i;
int lnumtriangles;
mstvert_t *pst, *st0, *st1, *st2;
mstvert_t *pst, *stv;
pst = r_affinetridesc.pstverts;
pfv = r_affinetridesc.pfinalverts;
ptri = r_affinetridesc.ptriangles;
lnumtriangles = r_affinetridesc.numtriangles;
Set_TransLevelF(currententity->alpha);
if (t_state & TT_ZERO)
return;
for (i=0 ; i<lnumtriangles ; i++, ptri++)
{
index0 = pfv + ptri->xyz_index[0];
@ -1434,28 +1391,27 @@ void D_DrawNonSubdivC (void)
continue;
}
st0 = pst + ptri->st_index[0];
st1 = pst + ptri->st_index[1];
st2 = pst + ptri->st_index[2];
r_p0[0] = index0->v[0]; // u
r_p0[1] = index0->v[1]; // v
r_p0[2] = st0->s; // s
r_p0[3] = st0->t; // t
stv = pst + ptri->st_index[0];
r_p0[2] = stv->s; // s
r_p0[3] = stv->t; // t
r_p0[4] = index0->v[4]; // light
r_p0[5] = index0->v[5]; // iz
r_p1[0] = index1->v[0];
r_p1[1] = index1->v[1];
r_p1[2] = st1->s;
r_p1[3] = st1->t;
stv = pst + ptri->st_index[1];
r_p1[2] = stv->s;
r_p1[3] = stv->t;
r_p1[4] = index1->v[4];
r_p1[5] = index1->v[5];
r_p2[0] = index2->v[0];
r_p2[1] = index2->v[1];
r_p2[2] = st2->s;
r_p2[3] = st2->t;
stv = pst + ptri->st_index[2];
r_p2[2] = stv->s;
r_p2[3] = stv->t;
r_p2[4] = index2->v[4];
r_p2[5] = index2->v[5];
@ -1471,8 +1427,8 @@ void D_DrawNonSubdiv32C (void)
int i;
int lnumtriangles;
#if 0
stvert_t *pst, *st0, *st1, *st2;
#if 1
mstvert_t *pst, *stv;
pst = r_affinetridesc.pstverts;
#endif
pfv = r_affinetridesc.pfinalverts;
@ -1493,53 +1449,30 @@ void D_DrawNonSubdiv32C (void)
{
continue;
}
#if 0
st0 = pfv + ptri->st_index[0];
st1 = pfv + ptri->st_index[1];
st2 = pfv + ptri->st_index[2];
r_p0[0] = index0->v[0]; // u
r_p0[1] = index0->v[1]; // v
r_p0[2] = st0->s;//index0->v[2]; // s
r_p0[3] = st0->t;//index0->v[3]; // t
stv = pst + ptri->st_index[0];
r_p0[2] = stv->s;//index0->v[2]; // s
r_p0[3] = stv->t;//index0->v[3]; // t
r_p0[4] = index0->v[4]; // light
r_p0[5] = index0->v[5]; // iz
r_p1[0] = index1->v[0];
r_p1[1] = index1->v[1];
r_p1[2] = st1->s;//index1->v[2];
r_p1[3] = st1->t;//index1->v[3];
stv = pst + ptri->st_index[1];
r_p1[2] = stv->s;//index1->v[2];
r_p1[3] = stv->t;//index1->v[3];
r_p1[4] = index1->v[4];
r_p1[5] = index1->v[5];
r_p2[0] = index2->v[0];
r_p2[1] = index2->v[1];
r_p2[2] = st2->s;//index2->v[2];
r_p2[3] = st2->t;//index2->v[3];
stv = pst + ptri->st_index[2];
r_p2[2] = stv->s;//index2->v[2];
r_p2[3] = stv->t;//index2->v[3];
r_p2[4] = index2->v[4];
r_p2[5] = index2->v[5];
#else
r_p0[0] = index0->v[0]; // u
r_p0[1] = index0->v[1]; // v
r_p0[2] = index0->v[2]; // s
r_p0[3] = index0->v[3]; // t
r_p0[4] = index0->v[4]; // light
r_p0[5] = index0->v[5]; // iz
r_p1[0] = index1->v[0];
r_p1[1] = index1->v[1];
r_p1[2] = index1->v[2];
r_p1[3] = index1->v[3];
r_p1[4] = index1->v[4];
r_p1[5] = index1->v[5];
r_p2[0] = index2->v[0];
r_p2[1] = index2->v[1];
r_p2[2] = index2->v[2];
r_p2[3] = index2->v[3];
r_p2[4] = index2->v[4];
r_p2[5] = index2->v[5];
#endif
D_PolysetSetEdgeTable ();
D_RasterizeAliasPolySmoothC ();
@ -1891,14 +1824,12 @@ void InitGel (qbyte *palette)
}
#endif
#if !id386
/*
================
D_PolysetDrawSpans8
================
*/
void D_PolysetDrawSpans8 (spanpackage_t *pspanpackage)
void D_PolysetDrawSpans8C (spanpackage_t *pspanpackage)
{
int lcount;
qbyte *lpdest;
@ -1961,7 +1892,6 @@ void D_PolysetDrawSpans8 (spanpackage_t *pspanpackage)
pspanpackage++;
} while (pspanpackage->count != -999999);
}
#endif // !id386
/*
@ -2434,7 +2364,7 @@ void D_RasterizeAliasPolySmooth8C (void)
DrawSpans (pstart);
}
}
/*
void D_RasterizeAliasPolySmooth1Asm (void)
{
int initialleftheight, initialrightheight;
@ -2642,7 +2572,7 @@ void D_RasterizeAliasPolySmooth1Asm (void)
D_PolysetDrawSpans8 (pstart);
}
}
*/
/*
================

View File

@ -240,6 +240,8 @@ void R_AliasClipTriangle (mtriangle_t *ptri, void (*drawfnc) (void))
mtriangle_t mtri;
unsigned clipflags;
mstvert_t tst[3]; //temp st
mstvert_t *pst = r_affinetridesc.pstverts;
@ -336,18 +338,25 @@ void R_AliasClipTriangle (mtriangle_t *ptri, void (*drawfnc) (void))
// draw triangles
r_affinetridesc.ptriangles = &mtri;
r_affinetridesc.pfinalverts = fv[pingpong];
r_affinetridesc.pstverts = fstv[pingpong];
r_affinetridesc.pstverts = tst;
// FIXME: do all at once as trifan?
mtri.xyz_index[0] = 0;
mtri.st_index[0] = 0;
tst[0].s = fv[pingpong][0].v[2];
tst[0].t = fv[pingpong][0].v[3];
for (i=1 ; i<k-1 ; i++)
{
mtri.xyz_index[1] = i;
mtri.st_index[1] = i;
mtri.st_index[1] = 1;
tst[1].s = fv[pingpong][i].v[2];
tst[1].t = fv[pingpong][i].v[3];
mtri.xyz_index[2] = i+1;
mtri.st_index[2] = i+1;
mtri.st_index[2] = 2;
tst[2].s = fv[pingpong][i+1].v[2];
tst[2].t = fv[pingpong][i+1].v[3];
drawfnc ();
}
r_affinetridesc.pstverts = pst;

View File

@ -32,6 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h" // FIXME: shouldn't be needed (is needed for patch
// right now, but that should move)
#undef id386
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching
#define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the
@ -311,8 +313,8 @@ void R_AliasPreparePoints (void)
fv = pfinalverts;
av = pauxverts;
#if id386
if (currententity->alpha == 1) //use the asm routines if we have it, and don't have alpha
#if 0//id386
if (t_state & TT_ONE) //use the asm routines if we have it, and don't have alpha
{
if (r_pixbytes == 4)
drawfnc = D_PolysetDraw32;
@ -368,15 +370,6 @@ void R_AliasPreparePoints (void)
if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) )
continue; // completely clipped
pfv[0]->v[2] = pstverts[ptri->st_index[0]].s;
pfv[0]->v[3] = pstverts[ptri->st_index[0]].t;
pfv[1]->v[2] = pstverts[ptri->st_index[1]].s;
pfv[1]->v[3] = pstverts[ptri->st_index[1]].t;
pfv[2]->v[2] = pstverts[ptri->st_index[2]].s;
pfv[2]->v[3] = pstverts[ptri->st_index[2]].t;
if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) &
(ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) )
{ // totally unclipped
@ -883,6 +876,9 @@ void R_AliasDrawModel (alight_t *plighting)
extern qbyte transfactor;
extern qbyte transbackfac;
Set_TransLevelF(currententity->alpha);
if (t_state & TT_ZERO)
return;
r_amodels_drawn++;
@ -910,6 +906,14 @@ void R_AliasDrawModel (alight_t *plighting)
r_recursiveaffinetriangles;
r_affinetridesc.pstverts = (mstvert_t *)((qbyte *)paliashdr + paliashdr->stverts);
/* {
int i;
for (i = 0; i < pmdl->numstverts; i++)
{
r_affinetridesc.pstverts[i].s = rand()<<8;
r_affinetridesc.pstverts[i].t = rand()<<8;
}
}*/
if (r_affinetridesc.drawtype)
{

View File

@ -123,41 +123,6 @@ extern mtexinfo_t r_skytexinfo[6];
extern cvar_t gl_skyboxname;
char skyname[128];
void SWR_SetSky (char *name, float rotate, vec3_t axis)
{
int i;
Q_strncpyz (skyname, name, sizeof(skyname));
// skyrotate = rotate;
// VectorCopy (axis, skyaxis);
for (i=0 ; i<6 ; i++)
{
r_skytexinfo[i].texture = NULL;
}
}
qboolean SWR_CheckSky (void)
{
int i;
char pathname[MAX_QPATH];
if (!*skyname)
return true;
for (i=0 ; i<6 ; i++)
{
sprintf (pathname, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
if (COM_FCheckExists(pathname))
{
continue;// it exists, don't bother going for a tga version
}
sprintf (pathname, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
if (!CL_CheckOrDownloadFile(pathname, -1))
return false;
}
return true;
}
/*
================
@ -182,6 +147,45 @@ void R_LoadSkyBox (void)
}
#endif
}
void SWR_SetSky (char *name, float rotate, vec3_t axis)
{
int i;
Q_strncpyz (skyname, name, sizeof(skyname));
// skyrotate = rotate;
// VectorCopy (axis, skyaxis);
for (i=0 ; i<6 ; i++)
{
r_skytexinfo[i].texture = NULL;
}
R_LoadSkyBox();
}
qboolean SWR_CheckSky (void)
{
int i;
char pathname[MAX_QPATH];
if (!*skyname)
return true;
for (i=0 ; i<6 ; i++)
{
sprintf (pathname, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
if (COM_FCheckExists(pathname))
{
continue;// it exists, don't bother going for a tga version
}
sprintf (pathname, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
if (!CL_CheckOrDownloadFile(pathname, -1))
return false;
}
return true;
}
/*
================
R_InitSkyBox