From aa932364fec79079429fc267f9fe49db43584514 Mon Sep 17 00:00:00 2001 From: koolsmoky <> Date: Sat, 22 Jan 2005 14:52:02 +0000 Subject: [PATCH] enabled packed argb for cmd packet type 3 --- glide2x/cvg/glide/src/Makefile.win32 | 2 +- glide2x/cvg/glide/src/ddgump.c | 13 +- glide2x/cvg/glide/src/diglide.c | 39 ++- glide2x/cvg/glide/src/fxglide.h | 68 ++--- glide2x/cvg/glide/src/gaa.c | 132 ++++++++- glide2x/cvg/glide/src/gdraw.c | 38 +-- glide2x/cvg/glide/src/gglide.c | 51 ++-- glide2x/cvg/glide/src/glide.rc | 4 + glide2x/cvg/glide/src/gpci.c | 35 ++- glide2x/cvg/glide/src/gsst.c | 9 +- glide2x/cvg/glide/src/gtexdl.c | 14 +- glide2x/cvg/glide/src/guclip.c | 7 +- glide2x/cvg/glide/src/gxdraw.c | 9 +- glide2x/cvg/glide/src/xdraw2.asm | 7 +- glide2x/cvg/glide/src/xdraw2.inc | 416 +++++++++++++-------------- 15 files changed, 487 insertions(+), 357 deletions(-) diff --git a/glide2x/cvg/glide/src/Makefile.win32 b/glide2x/cvg/glide/src/Makefile.win32 index f5eef77..7d688ed 100644 --- a/glide2x/cvg/glide/src/Makefile.win32 +++ b/glide2x/cvg/glide/src/Makefile.win32 @@ -84,7 +84,7 @@ endif CDEFS = -D__WIN32__ -DDIRECTX -DFX_DLL_ENABLE -D__3Dfx_PCI_CFG__ # general -CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_PACKED_RGB=0 -DGLIDE_TRI_CULLING=1 -DGLIDE_DEFAULT_GAMMA=1.3f -DGLIDE_LIB=1 +CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_PACKED_RGB=1 -DGLIDE_TRI_CULLING=1 -DGLIDE_DEFAULT_GAMMA=1.3f -DGLIDE_LIB=1 #CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE3_SCALER # special sli buffer clears diff --git a/glide2x/cvg/glide/src/ddgump.c b/glide2x/cvg/glide/src/ddgump.c index f52e8b4..045b9e1 100644 --- a/glide2x/cvg/glide/src/ddgump.c +++ b/glide2x/cvg/glide/src/ddgump.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.2 2000/10/03 18:28:33 mercury +** 003-clean_up_cvg-000, cvg tree cleanup. +** ** Revision 1.1.1.1 1999/12/07 21:49:08 joseph ** Initial checkin into SourceForge. ** @@ -296,7 +299,7 @@ GR_ENTRY(guMPDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const Gr _gumpTexCombineFunction(0); /* render first pass */ - grDrawTriangle(a, b, c); + TRISETUP(a, b, c); /* second pass */ @@ -362,7 +365,7 @@ GR_ENTRY(guMPDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const Gr REG_GROUP_END(); /* render other pass */ - grDrawTriangle(a, b, c); + TRISETUP(a, b, c); /* restore */ REG_GROUP_BEGIN(BROADCAST_ID, fbzColorPath, regCount, regMask); @@ -451,7 +454,7 @@ GR_ENTRY(guMPDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const Gr REG_GROUP_END(); /* render first pass */ - grDrawTriangle(a, b, c); + TRISETUP(a, b, c); /* second pass */ /* xxx may sometimes need to copy texture coordinates */ @@ -518,7 +521,7 @@ GR_ENTRY(guMPDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const Gr REG_GROUP_END(); /* render second pass */ - grDrawTriangle(a, b, c); + TRISETUP(a, b, c); /* if bias, third pass */ if (fogP) { @@ -542,7 +545,7 @@ GR_ENTRY(guMPDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const Gr REG_GROUP_END(); /* render third pass */ - grDrawTriangle(a, b, c); + TRISETUP(a, b, c); } REG_GROUP_BEGIN(BROADCAST_ID, fbzColorPath, regCount, regMask); diff --git a/glide2x/cvg/glide/src/diglide.c b/glide2x/cvg/glide/src/diglide.c index 3a09ae9..c617b8e 100644 --- a/glide2x/cvg/glide/src/diglide.c +++ b/glide2x/cvg/glide/src/diglide.c @@ -19,6 +19,10 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1.2.2 2004/12/23 20:45:56 koolsmoky +** converted to nasm syntax +** added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations +** ** Revision 1.1.1.1.2.1 2004/12/12 15:18:58 koolsmoky ** changes to support new cpuid; moved single_precision_asm(), double_precision_asm() from cpudetect.asm ** @@ -148,6 +152,9 @@ void single_precision_asm() fldcw WORD PTR [esp] pop eax } +#elif __GNUC__ + asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n " + "and $0x0000fcff, %eax \n movl %eax, (%esp) \n fldcw (%esp) \n pop %eax"); #else #error "Need to implement single_precision_asm() for this compiler" #endif @@ -171,6 +178,10 @@ void double_precision_asm() fldcw WORD PTR [esp] pop eax } +#elif __GNUC__ + asm("push %eax \n fnclex \n fstcw (%esp) \n movw (%esp), %eax \n " + "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%esp) \n " + "fldcw (%esp) \n pop %eax"); #else #error "Need to implement double_precision_asm() for this compiler" #endif @@ -263,26 +274,26 @@ _grSwizzleColor(GrColor_t *color) break; case GR_COLORFORMAT_ABGR: - red = *color & 0x00ff; - blue = (*color >> 16) & 0xff; - *color &= 0xff00ff00; - *color |= ((red << 16) | blue); + red = (*color & 0x000000ff) << 16; /* 00RR0000 */ + blue = (*color & 0x00ff0000) >> 16; /* 000000BB */ + *color &= 0xff00ff00; /* AA00GG00 */ + *color |= (red | blue); /* AARRGGBB */ break; case GR_COLORFORMAT_RGBA: - blue = (*color & 0x0000ff00) >> 8; - green = (*color & 0x00ff0000) >> 16; - red = (*color & 0xff000000) >> 24; - alpha = (*color & 0x000000ff); - *color = (alpha << 24) | (red << 16) | (green << 8) | blue; + blue = (*color & 0x0000ff00) >> 8; /* 000000BB */ + green = (*color & 0x00ff0000) >> 8; /* 0000GG00 */ + red = (*color & 0xff000000) >> 8; /* 00RR0000 */ + alpha = (*color & 0x000000ff) << 24; /* AA000000 */ + *color = alpha | red | green | blue; /* AARRGGBB */ break; case GR_COLORFORMAT_BGRA: - blue = (*color & 0xff000000) >> 24; - green = (*color & 0x00ff0000) >> 16; - red = (*color & 0x0000ff00) >> 8; - alpha = (*color & 0x000000ff); - *color = (alpha << 24) | (red << 16) | (green << 8) | blue; + blue = (*color & 0xff000000) >> 24; /* 000000BB */ + green = (*color & 0x00ff0000) >> 8; /* 0000GG00 */ + red = (*color & 0x0000ff00) << 8; /* 00RR0000 */ + alpha = (*color & 0x000000ff) << 24; /* AA000000 */ + *color = alpha | red | green | blue; /* AARRGGBB */ break; default: diff --git a/glide2x/cvg/glide/src/fxglide.h b/glide2x/cvg/glide/src/fxglide.h index 005edc0..3058ee5 100644 --- a/glide2x/cvg/glide/src/fxglide.h +++ b/glide2x/cvg/glide/src/fxglide.h @@ -19,6 +19,10 @@ ** ** $Header$ ** $Log$ +** Revision 1.2.2.2 2004/12/23 20:45:56 koolsmoky +** converted to nasm syntax +** added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations +** ** Revision 1.2.2.1 2004/12/12 15:17:18 koolsmoky ** support new cpuid ** @@ -519,12 +523,12 @@ struct _GrState_s */ typedef FxI32 (FX_CALL* GrTriSetupProc)(const void*, const void*, const void*); -#if GLIDE_PACKED_RBG -typedef GrTriSetupProc GrTriSetupProcVector[6]; -#else typedef GrTriSetupProc GrTriSetupProcVector[2]; +#if GLIDE_PACKED_RGB +typedef GrTriSetupProcVector GrTriSetupProcArchVector[3]; +#else +typedef GrTriSetupProcVector GrTriSetupProcArchVector[1]; #endif -typedef GrTriSetupProcVector GrTriSetupProcArchVector; /* Decalrations of the dispatchable procs found in xdraw2.asm and * xtexdl.c for teh triangle and texture download procs respectively. @@ -631,30 +635,15 @@ typedef struct GrGC_s GrState state; /* state of Glide/SST */ -#if GLIDE_DISPATCH_SETUP || GLIDE_DISPATCH_DOWNLOAD - struct { #if GLIDE_DISPATCH_SETUP + struct { /* Current triangle rendering proc specialized for culling/no * culling and viewport/window coordinates. */ - GrTriSetupProc triSetupProc; - - /* Vector to choose triangle rendering proc from based - * on culling or no-cull this vector should be specialized - * on viewport vs window coordinates. - */ - GrTriSetupProcVector* coorTriSetupVector; -#endif /* GLIDE_DISPATCH_SETUP */ - -#if GLIDE_DISPATCH_DOWNLOAD - /* Vector of texture download procs specialized by size - * and processor vendor type. - */ - GrTexDownloadProcVector* texDownloadProcs; -#endif /* GLIDE_DISPATCH_DOWNLOAD */ + GrTriSetupProc triSetupProc; } curArchProcs; -#endif /* GLIDE_DISPATCH_SETUP || GLIDE_DISPATCH_DOWNLOAD */ - +#endif /* GLIDE_DISPATCH_SETUP */ + struct cmdTransportInfo { FxU32 triPacketHdr; /* Pre-computed packet header for * independent triangles. @@ -1017,21 +1006,12 @@ extern GrGCFuncs _curGCFuncs; void _grMipMapInit(void); #if GLIDE_DISPATCH_SETUP -#define TRISETUP_NORGB(__cullMode) (((__cullMode) == GR_CULL_DISABLE) \ - ? (*gc->curArchProcs.coorTriSetupVector)[0] \ - : (*gc->curArchProcs.coorTriSetupVector)[1]) -#if GLIDE_PACKED_RBG -#define TRISETUP_RGB(__cullMode) (((__cullMode) == GR_CULL_DISABLE) \ - ? (*gc->curArchProcs.coorTriSetupVector)[2] \ - : (*gc->curArchProcs.coorTriSetupVector)[3]) -#define TRISETUP_ARGB(__cullMode) (((__cullMode) == GR_CULL_DISABLE) \ - ? (*gc->curArchProcs.coorTriSetupVector)[4] \ - : (*gc->curArchProcs.coorTriSetupVector)[5]) - -#else /* !GLIDE_PACKED_RGB */ -#define TRISETUP_RGB(__cullMode) TRISETUP_NORGB(__cullMode) -#define TRISETUP_ARGB(__cullMode) TRISETUP_NORGB(__cullMode) +#define TRISETUP_NORGB (*_GlideRoot.deviceArchProcs.curTriProcs + 0) +#if GLIDE_PACKED_RGB +#define TRISETUP_RGB (*_GlideRoot.deviceArchProcs.curTriProcs + 1) +#define TRISETUP_ARGB (*_GlideRoot.deviceArchProcs.curTriProcs + 2) #endif /* !GLIDE_PACKED_RGB */ +#define PROC_SELECT_TRISETUP(__procVector, __cullMode) (__procVector)[(__cullMode) != GR_CULL_DISABLE] #define TRISETUP (*gc->curArchProcs.triSetupProc) #else /* !GLIDE_DISPATCH_SETUP */ FxI32 FX_CSTYLE @@ -2027,11 +2007,21 @@ _grCVGFifoDump_Linear(const FxU32* const linearPacketAddr); * probably do something silly like wrap around zero. */ #if GLIDE_PACKED_RGB -#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \ +/*#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \ ((_GlideRoot.pool.ftemp1 = (float)((float)(__fpVal) + (float)(__fpBias))), \ GR_ASSERT((__fpVal) >= 0.0f), \ GR_ASSERT((__fpVal) < 256.0f), \ - (((*(const FxU32*)&_GlideRoot.pool.ftemp1) & (__fpMask)) << (__fpShift))) + (((*(const FxU32*)&_GlideRoot.pool.ftemp1) & (__fpMask)) << (__fpShift)))*/ +/* dpc - 10 feb 1998 - + * Some apps send color values outside of the range [0..255] + */ +#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \ +((_GlideRoot.pool.ftemp1 = (float)((float)(__fpVal) + (float)(__fpBias))), \ + ((((float)(__fpVal)) > 255.0f) \ + ? (__fpMask) \ + : ((((float)(__fpVal)) < 0.0f) \ + ? 0x00UL \ + : ((*(const FxU32*)&_GlideRoot.pool.ftemp1) & (__fpMask)))) << (__fpShift)) #define RGBA_COMP_CLAMP(__fpVal, __compToken) \ RGBA_COMP(__fpVal, kPackBias##__compToken, kPackShift##__compToken, kPackMask##__compToken) diff --git a/glide2x/cvg/glide/src/gaa.c b/glide2x/cvg/glide/src/gaa.c index d91c87b..23bfab7 100644 --- a/glide2x/cvg/glide/src/gaa.c +++ b/glide2x/cvg/glide/src/gaa.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1 1999/12/07 21:49:09 joseph +** Initial checkin into SourceForge. +** ** ** 64 5/18/98 12:15p Peter ** crybaby check for alpha enable @@ -366,19 +369,19 @@ GR_ENTRY(grAADrawPoint, void, (const GrVertex *e)) a.a = b.a = _GlideRoot.pool.f0; - grDrawTriangle(&a, &b, e); /* A B E */ + TRISETUP(&a, &b, e); /* A B E */ b.x -= 2.0F; /* compute point D */ b.y += 2.0F; - grDrawTriangle(&a, e, &b); /* A E D */ + TRISETUP(&a, e, &b); /* A E D */ a.x += 2.0F; /* compute point C */ a.y += 2.0F; - grDrawTriangle(&b, e, &a); /* D E C */ + TRISETUP(&b, e, &a); /* D E C */ b.x += 2.0F; b.y -= 2.0F; - grDrawTriangle(&a, e, &b); /* C E B */ + TRISETUP(&a, e, &b); /* C E B */ } #endif /* GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP */ @@ -663,6 +666,23 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) v2->a = 0.0f; datalist = gc->tsuDataList; +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + TRI_SET(packedColor); + datalist++; + } +#endif + while( *datalist != 0 ) { TRI_SETF(FARRAY(v2, *datalist)); datalist++; @@ -680,6 +700,23 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) v1->a = 0.0f; datalist = gc->tsuDataList; +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + TRI_SET(packedColor); + datalist++; + } +#endif /* GLIDE_PACKED_RGB */ + while( *datalist != 0 ) { TRI_SETF(FARRAY(v1, *datalist)); datalist++; @@ -692,6 +729,25 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) TRI_SETF( v2->x ); TRI_SETF( v2->y ); + +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + packedColor |= RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_A_OFFSET << 2)), A); + datalist++; + + TRI_SET(packedColor); + } +#endif /* GLIDE_PACKED_RGB */ while( *datalist != 0 ) { TRI_SETF(FARRAY(v2, *datalist)); @@ -703,6 +759,25 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) TRI_SETF( v1->x ); TRI_SETF( v1->y ); + +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + packedColor |= RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_A_OFFSET << 2)), A); + datalist++; + + TRI_SET(packedColor); + } +#endif /* GLIDE_PACKED_RGB */ while( *datalist != 0 ) { TRI_SETF(FARRAY(v1, *datalist)); @@ -719,6 +794,23 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) v2->a = 0.0f; datalist = gc->tsuDataList; +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v2, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + TRI_SET(packedColor); + datalist++; + } +#endif /* GLIDE_PACKED_RGB */ + while( *datalist != 0 ) { TRI_SETF(FARRAY(v2, *datalist)); datalist++; @@ -736,6 +828,22 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) v1->a = 0.0f; datalist = gc->tsuDataList; +#if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { + FxU32 packedColor = 0x00; + + if (*datalist == (GR_VERTEX_R_OFFSET << 2)) { + packedColor = (RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_B_OFFSET << 2)), B) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_G_OFFSET << 2)), G) | + RGBA_COMP_CLAMP(FARRAY(v1, (GR_VERTEX_R_OFFSET << 2)), R)); + + datalist++; + } + + TRI_SET(packedColor); + datalist++; + } +#endif /* GLIDE_PACKED_RGB */ while( *datalist != 0 ) { TRI_SETF(FARRAY(v1, *datalist)); @@ -797,10 +905,10 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) f.y += _GlideRoot.pool.f1; f.a = 0.F; - grDrawTriangle(&a, v2, &b); - grDrawTriangle(&a, v2, v1); - grDrawTriangle(v1, &f, &e); - grDrawTriangle(v1, v2, &f); + TRISETUP(&a, v2, &b); + TRISETUP(&a, v2, v1); + TRISETUP(v1, &f, &e); + TRISETUP(v1, v2, &f); } else { /* Y major line */ a.x += _GlideRoot.pool.f1; a.a = 0.F; @@ -811,10 +919,10 @@ GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) f.x -= _GlideRoot.pool.f1; f.a = 0.F; - grDrawTriangle(&a, &b, v2); - grDrawTriangle(v1, &a, v2); - grDrawTriangle(v1, &f, &e); - grDrawTriangle(v1, v2, &f); + TRISETUP(&a, &b, v2); + TRISETUP(v1, &a, v2); + TRISETUP(v1, &f, &e); + TRISETUP(v1, v2, &f); } gc->state.cull_mode = cullSave; diff --git a/glide2x/cvg/glide/src/gdraw.c b/glide2x/cvg/glide/src/gdraw.c index 12d3cf4..36213f5 100644 --- a/glide2x/cvg/glide/src/gdraw.c +++ b/glide2x/cvg/glide/src/gdraw.c @@ -19,6 +19,10 @@ ** ** $Header$ ** $Log$ + ** Revision 1.4.2.1 2004/12/23 20:45:56 koolsmoky + ** converted to nasm syntax + ** added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations + ** ** Revision 1.4 2000/01/28 20:52:17 joseph ** Changes to support building shared libraries with PIC support. ** @@ -781,7 +785,8 @@ GR_ENTRY(grDrawPlanarPolygon, /* now all the gradients are loaded into the chip, so we just have to */ /* draw all the rest of the triangles */ for (i = i+1; i < nVerts - 1; i++) { - _trisetup_nogradients(firstv, &vList[iList[i]], &vList[iList[i+1]]); + //_trisetup_nogradients(firstv, &vList[iList[i]], &vList[iList[i+1]]); + TRISETUP(firstv, &vList[iList[i]], &vList[iList[i+1]]); } } all_done: @@ -819,7 +824,8 @@ GR_ENTRY(grDrawPlanarPolygonVertexList, void, (int nVerts, const GrVertex vList[ /* now all the gradients are loaded into the chip, so we just have to */ /* draw all the rest of the triangles */ for (i = i+1; i < nVerts - 1; i++) { - _trisetup_nogradients(firstv, &vList[i], &vList[i+1]); + //_trisetup_nogradients(firstv, &vList[i], &vList[i+1]); + TRISETUP(firstv, &vList[i], &vList[i+1]); } all_done: @@ -894,25 +900,23 @@ __doPolyVertexSend: const int* dataList = gc->tsuDataList; #if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { - FxBool doColorP = FXFALSE; FxU32 packedColor = 0x00; if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) | RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R)); - doColorP = FXTRUE; dataList++; } if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A); - doColorP = FXTRUE; dataList++; } - if (doColorP) TRI_SET(packedColor); + TRI_SET(packedColor); } #endif /* GLIDE_PACKED_RGB */ @@ -957,7 +961,7 @@ __doPolyVertexSend: { int i; for (i = 1; i < nVerts - 1; i++) { - grDrawTriangle(&vList[iList[0]], &vList[iList[i]], &vList[iList[i+1]]); + TRISETUP(&vList[iList[0]], &vList[iList[i]], &vList[iList[i+1]]); } } #endif /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */ @@ -1016,37 +1020,23 @@ __doPolyVertexSend: const int* dataList = gc->tsuDataList; #if GLIDE_PACKED_RGB - /* dpc - 10 feb 1998 - - * Some apps send color values outside of the range [0..255] - */ -#undef RGBA_COMP -#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \ -((_GlideRoot.pool.ftemp1 = (float)((float)(__fpVal) + (float)(__fpBias))), \ - ((((float)(__fpVal)) > 255.0f) \ - ? (__fpMask) \ - : ((((float)(__fpVal)) < 0.0f) \ - ? 0x00UL \ - : ((*(const FxU32*)&_GlideRoot.pool.ftemp1) & (__fpMask)))) << (__fpShift)) - + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { - FxBool doColorP = FXFALSE; FxU32 packedColor = 0x00; if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) | RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R)); - doColorP = FXTRUE; dataList++; } if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A); - doColorP = FXTRUE; dataList++; } - if (doColorP) TRI_SET(packedColor); + TRI_SET(packedColor); } #endif /* GLIDE_PACKED_RGB */ @@ -1091,7 +1081,7 @@ __doPolyVertexSend: int i; for (i = 1; i < nVerts - 1; i++) { - grDrawTriangle(&vList[0], &vList[i], &vList[i+1]); + TRISETUP(&vList[0], &vList[i], &vList[i+1]); } } #endif /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */ diff --git a/glide2x/cvg/glide/src/gglide.c b/glide2x/cvg/glide/src/gglide.c index 94f9e49..7d3107a 100644 --- a/glide2x/cvg/glide/src/gglide.c +++ b/glide2x/cvg/glide/src/gglide.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.2.2.4 2004/12/27 20:46:37 koolsmoky +** added dll entry point to call grGlideShutdown when a process is detached +** ** Revision 1.2.2.3 2004/12/23 21:03:14 koolsmoky ** swapinterval ** @@ -797,10 +800,10 @@ GR_ENTRY(grBufferSwap, void, (int swapInterval)) vSync = (swapInterval > 0); /* when triple buffering, vsync must be enabled and swapbuffer interval must be 0 */ - if (gc->grColBuf >= 3) { + /*if (gc->grColBuf >= 3) { vSync = FXTRUE; swapInterval = 0; - } + }*/ if (swapInterval > 0) swapInterval--; @@ -2149,29 +2152,35 @@ _grUpdateTriPacketHdr(FxU32 paramMask, * select on cpu type as well to determine if we should * do sw culling or not. */ - if ((paramMask & SSTCP_PKT3_PACKEDCOLOR) == SSTCP_PKT3_PACKEDCOLOR) { - const FxU32 colorComp = paramMask & COLOR_COMP_MASK; + { + GrTriSetupProcVector* curTriProcVector = TRISETUP_NORGB; - switch(colorComp) { - case COLOR_COMP_ARGB: - gc->curArchProcs.triSetupProc = TRISETUP_ARGB(cullMode); - break; +#if GLIDE_PACKED_RGB + if ((paramMask & SSTCP_PKT3_PACKEDCOLOR) == SSTCP_PKT3_PACKEDCOLOR) { + const FxU32 colorComp = paramMask & COLOR_COMP_MASK; - case COLOR_COMP_RGB: - gc->curArchProcs.triSetupProc = TRISETUP_RGB(cullMode); - break; + switch(colorComp) { + case COLOR_COMP_ARGB: + curTriProcVector = TRISETUP_ARGB; + break; - /* If no rgb data then it is not worthwhile to pack - * just alpha so just mask off the packed color bit - * and just use the looping proc. - */ - default: - gc->curArchProcs.triSetupProc = TRISETUP_NORGB(cullMode); - paramMask &= ~SSTCP_PKT3_PACKEDCOLOR; - break; + case COLOR_COMP_RGB: + curTriProcVector = TRISETUP_RGB; + break; + + /* If no rgb data then it is not worthwhile to pack + * just alpha so just mask off the packed color bit + * and just use the looping proc. + */ + default: + curTriProcVector = TRISETUP_NORGB; + paramMask &= ~SSTCP_PKT3_PACKEDCOLOR; + break; + } } - } else { - gc->curArchProcs.triSetupProc = TRISETUP_NORGB(cullMode); +#endif + + gc->curArchProcs.triSetupProc = PROC_SELECT_TRISETUP(*curTriProcVector, cullMode); } #endif /* GLIDE_DISPATCH_SETUP */ diff --git a/glide2x/cvg/glide/src/glide.rc b/glide2x/cvg/glide/src/glide.rc index d5562f5..7adc3f8 100644 --- a/glide2x/cvg/glide/src/glide.rc +++ b/glide2x/cvg/glide/src/glide.rc @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1.2.1 2004/12/12 15:29:44 koolsmoky +** cosmetics +** ** Revision 1.1.1.1 1999/12/07 21:49:10 joseph ** Initial checkin into SourceForge. ** @@ -64,6 +67,7 @@ BEGIN VALUE "ProductName", PRODNAME VALUE "ProductVersion", VERSIONSTR VALUE "Graphics Subsystem", HWSTR + VALUE "Contact", "The Glide Open Source Project http://glide.sourceforge.net/" END END BLOCK "VarFileInfo" diff --git a/glide2x/cvg/glide/src/gpci.c b/glide2x/cvg/glide/src/gpci.c index 57544aa..91e65db 100644 --- a/glide2x/cvg/glide/src/gpci.c +++ b/glide2x/cvg/glide/src/gpci.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1.2.5 2005/01/13 16:09:05 koolsmoky +** Restict calls to pciOpen() pciClose() when compiled with DIRECTX option. this fixes problems with the win32 miniport opened in exclusive mode. +** ** Revision 1.1.1.1.2.4 2005/01/02 04:15:53 koolsmoky ** disabled mtrr's on sli slave devices ** @@ -245,24 +248,28 @@ #if GLIDE_DISPATCH_SETUP /* Collection of all of the known procs for a given system */ -#if GLIDE_PACKED_RBG -static GrTriSetupProc _triSetupProcs[][6] = -#else /* !GLIDE_PACKED_RBG */ -static GrTriSetupProc _triSetupProcs[][2] = -#endif /* !GLIDE_PACKED_RBG */ +#if GLIDE_PACKED_RGB +static GrTriSetupProc _triSetupProcs[][3][2] = +#else /* !GLIDE_PACKED_RGB */ +static GrTriSetupProc _triSetupProcs[][1][2] = +#endif /* !GLIDE_PACKED_RGB */ { /* Default Procs */ - { _trisetup, _trisetup_cull -#if GLIDE_PACKED_RBG - , _trisetup_rgb, _trisetup_cull_rgb, _trisetup_argb, _trisetup_cull_argb -#endif /* GLIDE_PACKED_RBG */ + { + {_trisetup, _trisetup_cull} +#if GLIDE_PACKED_RGB + ,{_trisetup_rgb, _trisetup_cull_rgb}, + {_trisetup_argb, _trisetup_cull_argb} +#endif /* GLIDE_PACKED_RGB */ } #if GL_AMD3D /* 3DNow!(tm) Procs */ - ,{ _trisetup_3DNow, _trisetup_cull_3DNow -#if GLIDE_PACKED_RBG - , _trisetup_rgb_3DNow, _trisetup_cull_rgb_3DNow, _trisetup_argb_3DNow, _trisetup_cull_argb_3DNow -#endif /* GLIDE_PACKED_RBG */ + ,{ + {_trisetup_3DNow, _trisetup_cull_3DNow} +#if GLIDE_PACKED_RGB + ,{_trisetup_rgb_3DNow, _trisetup_cull_rgb_3DNow}, + {_trisetup_argb_3DNow, _trisetup_cull_argb_3DNow} +#endif /* GLIDE_PACKED_RGB */ } #endif /* GL_AMD3D */ }; @@ -336,7 +343,7 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) case DLL_PROCESS_ATTACH: if (!pciOpen()) { GDBG_INFO(80, "pci bus could not be opened\n"); - GR_RETURN(FXFALSE); + return FALSE; } GDBG_INFO(80, "DllMain: DLL_PROCESS_ATTACH\n"); break; diff --git a/glide2x/cvg/glide/src/gsst.c b/glide2x/cvg/glide/src/gsst.c index f1bf243..7c449c6 100644 --- a/glide2x/cvg/glide/src/gsst.c +++ b/glide2x/cvg/glide/src/gsst.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.2.2.3 2005/01/13 16:09:06 koolsmoky +** Restict calls to pciOpen() pciClose() when compiled with DIRECTX option. this fixes problems with the win32 miniport opened in exclusive mode. +** ** Revision 1.2.2.2 2004/12/23 20:45:56 koolsmoky ** converted to nasm syntax ** added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations @@ -1362,12 +1365,6 @@ __errSliExit: /* We're effectively open now */ gc->open = FXTRUE; - /* Setup the procs that we can do w/o any mode knowledge */ -#if GLIDE_DISPATCH_SETUP || GLIDE_DISPATCH_DOWNLOAD - gc->curArchProcs.texDownloadProcs = _GlideRoot.deviceArchProcs.curTexProcs; - gc->curArchProcs.coorTriSetupVector = _GlideRoot.deviceArchProcs.curTriProcs; -#endif /* GLIDE_DISPATCH_SETUP || GLIDE_DISPATCH_DOWNLOAD */ - /*------------------------------------------------------ GC Init ------------------------------------------------------*/ diff --git a/glide2x/cvg/glide/src/gtexdl.c b/glide2x/cvg/glide/src/gtexdl.c index 54546a6..2d9781c 100644 --- a/glide2x/cvg/glide/src/gtexdl.c +++ b/glide2x/cvg/glide/src/gtexdl.c @@ -19,6 +19,10 @@ ** ** $Header$ ** $Log$ +** Revision 1.2.2.1 2004/12/23 20:45:56 koolsmoky +** converted to nasm syntax +** added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations +** ** Revision 1.2 2000/10/03 18:28:33 mercury ** 003-clean_up_cvg-000, cvg tree cleanup. ** @@ -505,10 +509,10 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial, _GlideRoot.stats.texBytes += max_s * (max_t - t + 1) * 4; - (*((*gc->curArchProcs.texDownloadProcs)[formatSel][widthSel]))(gc, - tmuBaseAddr, - max_s, t, max_t, - data); + (*((*_GlideRoot.deviceArchProcs.curTexProcs)[formatSel][widthSel]))(gc, + tmuBaseAddr, + max_s, t, max_t, + data); } #else /*------------------------------------------------------------ @@ -546,7 +550,7 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial, LINEAR_WRITE_END(); src8 += width; - tex_address += TEX_ROW_ADDR_INCR(1, thisLod); + tex_address += TEX_ROW_ADDR_INCR(1); } break; diff --git a/glide2x/cvg/glide/src/guclip.c b/glide2x/cvg/glide/src/guclip.c index 8b5d156..0469e67 100644 --- a/glide2x/cvg/glide/src/guclip.c +++ b/glide2x/cvg/glide/src/guclip.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1 1999/12/07 21:49:11 joseph +** Initial checkin into SourceForge. +** * * 12 12/15/97 5:52p Atai * disable obsolete glide2 api for glide3 @@ -293,9 +296,9 @@ GR_DIENTRY(guDrawTriangleWithClip, void, ) { #ifdef GLIDE3 - grDrawTriangle( (void *)a, (void *)b, (void *)c ); + TRISETUP( (void *)a, (void *)b, (void *)c ); #else - grDrawTriangle( a, b, c ); + TRISETUP( a, b, c ); #endif return; } diff --git a/glide2x/cvg/glide/src/gxdraw.c b/glide2x/cvg/glide/src/gxdraw.c index b208cda..4721c99 100644 --- a/glide2x/cvg/glide/src/gxdraw.c +++ b/glide2x/cvg/glide/src/gxdraw.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.1.1.1 1999/12/07 21:49:11 joseph + ** Initial checkin into SourceForge. + ** ** ** 61 3/17/98 3:00p Peter ** removed vertex sorting @@ -250,8 +253,8 @@ GR_DDFUNC(_trisetup_nogradients, const int* dataList = gc->tsuDataList; #if GLIDE_PACKED_RGB + if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { - FxBool doColorP = FXFALSE; FxU32 packedColor = 0x00; if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { @@ -259,16 +262,14 @@ GR_DDFUNC(_trisetup_nogradients, RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_G_OFFSET << 2)), G) | RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_R_OFFSET << 2)), R)); dataList++; - doColorP = FXTRUE; } if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { packedColor |= RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_A_OFFSET << 2)), A); dataList++; - doColorP = FXTRUE; } - if (doColorP) TRI_SET(packedColor); + TRI_SET(packedColor); } #endif /* GLIDE_PACKED_RGB */ diff --git a/glide2x/cvg/glide/src/xdraw2.asm b/glide2x/cvg/glide/src/xdraw2.asm index 37828d0..801ee0e 100644 --- a/glide2x/cvg/glide/src/xdraw2.asm +++ b/glide2x/cvg/glide/src/xdraw2.asm @@ -19,6 +19,9 @@ ;; $Header$ ;; $Revision$ ;; $Log$ +;; Revision 1.1.1.1.2.2 2005/01/13 16:11:39 koolsmoky +;; prepare for packed rgb +;; ;; Revision 1.1.1.1.2.1 2004/12/23 20:45:56 koolsmoky ;; converted to nasm syntax ;; added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations @@ -65,8 +68,8 @@ extrn _FifoMakeRoom %ifdef GL_AMD3D ;; 3dnow! -%MACRO WRITE_MM1_FIFO_ALIGNED 1 - movq [fifo+%1], mm1 ; store current param | previous param +%MACRO WRITE_MM1_FIFO_ALIGNED 0 + movq [fifo], mm1 ; store current param | previous param %ENDMACRO ; WRITE_MM1_FIFO_ALIGNED %MACRO WRITE_MM1LOW_FIFO 0 diff --git a/glide2x/cvg/glide/src/xdraw2.inc b/glide2x/cvg/glide/src/xdraw2.inc index 6f606d8..27620a8 100644 --- a/glide2x/cvg/glide/src/xdraw2.inc +++ b/glide2x/cvg/glide/src/xdraw2.inc @@ -20,6 +20,9 @@ ;; $Header$ ;; $Revision$ ;; $Log$ +;; Revision 1.1.1.1.2.2 2005/01/13 16:11:39 koolsmoky +;; prepare for packed rgb +;; ;; Revision 1.1.1.1.2.1 2004/12/23 20:45:56 koolsmoky ;; converted to nasm syntax ;; added x86 asm, 3dnow! triangle and mmx, 3dnow! texture download optimizations @@ -45,39 +48,36 @@ ;;-------------------------------------------------------------------------- ;; start AMD3D version ;;-------------------------------------------------------------------------- -%define gc edi ; points to graphics context -%define fifo ebp ; points to fifo entries +%define gc edi ; points to graphics context +%define fifo ebp ; points to fifo entries %define tempVal esi +%IF GLIDE_CULLING +%define fa eax ; vtx a from caller +%define fb ebx ; vtx b from caller +%define fc ecx ; vtx c from caller +%define cull edx ; cull mode +%define intArea ecx ; area temp storage + ;; Prologue stuff push edi ; save caller's register variable - mov gc,[_GlideRoot+curGC]; GR_DCL_GC + mov gc, [_GlideRoot+curGC]; GR_DCL_GC + + push esi ; save caller's register variable + mov fa, [esp + _va$] ; get base address of vertex A + + push ebx ; save caller's register variable + mov fb, [esp + _vb$] ; get base address of vertex B push ebp ; save frame pointer - push ebx ; save caller's register variable - -%IF GLIDE_CULLING -%define fa eax ; vtx a from caller -%define fb ebx ; vtx b from caller -%define fc ecx ; vtx c from caller - -%define cull edx ; cull mode -%define intArea ecx ; area temp storage - - mov fb, [esp + _vb$ - 4] ; get base address of vertex B - push esi ; save caller's register variable - mov cull, [gc + cull_mode]; get cull mode + mov fc, [esp + _vc$] ; get base address of vertex C + mov tempVal, [_GlideRoot+curTriSize] femms ; will use AMD3D, clear FPU/MMX registers - cmp cull, 0 ; culling enabled ? - mov tempVal, [_GlideRoot + curTriSize] - ;; Cull Check - jz .nocull ; nope, no culling - mov fa, [esp + _va$] ; get base address of vertex A movq mm2, [fc + X] ; yc | xc shl cull, 31 ; culltest << 31 @@ -115,63 +115,45 @@ ; Zero Area Triangle Check test intArea, 7fffffffh ; if ((j & 0x7FFFFFFF) == 0) - jz .__cullFail ; area zero, triangle culled + jz .__cullFail ; area zero, triangle culled xor intArea, cull ; if (j ^ (culltest << 31)) - jge .__cullFail ; triangle facing away from viewer, culled + jge .__cullFail ; triangle facing away from viewer, culled cmp ebx, tempVal ; fifo space required >= space available ? - jge .__triBegin ; yup, push out triangle data to Voodoo + jge .__triBegin ; yup, push out triangle data to Voodoo push __LINE__ ; line number inside this function push 0h ; pointer to function name = NULL push tempVal ; fifo space required - call _FifoMakeRoom ; note: updates fifoPtr - - add esp, 12 ; remove 3 DWORD arguments from stack - jmp .__triBegin ; merge back with short path - - ;; culling disabled - -.nocull: - ;; Check to make sure that we have enough room for - ;; the complete triangle packet. - - add tempVal, 4 ; fifo space needed - mov ebx, [gc + fifoRoom] ; fifo space available - - cmp ebx, tempVal ; fifo spce available >= space needed ? - jge .__triBegin ; yup, ready to draw triangle - - push __LINE__ ; line number inside this function - push 0h ; pointer to function name = NULL - - push tempVal ; fifo space needed - call _FifoMakeRoom ; note: updates fifoPtr + call _FifoMakeRoom ; note: updates fifoPtr add esp, 12 ; remove 3 DWORD arguments from stack nop ; filler %ELSE ; !GLIDE_CULLING - ;;;;;;;;;;;;;;;lea eax, [esp+ _va$] ; pointer to vertex pointers + push edi ; save caller's register variable + mov gc, [_GlideRoot+curGC]; GR_DCL_GC + push esi ; save caller's register variable - - mov tempVal, [_GlideRoot + curTriSize] ; data for whole triangle in bytes + mov tempVal, [_GlideRoot+curTriSize] ; data for whole triangle in bytes + + push ebx ; save caller's register variable mov ebx, [gc + fifoRoom] ; fifo space available + push ebp ; save frame pointer add tempVal, 4 ; fifo space needed (include 4-byte header) - femms ; will use AMD3D, clear FPU/MMX registers cmp ebx, tempVal ; fifo spce available >= space needed ? - jge .__triBegin ; yup, ready to draw triangle + jge .__triBegin ; yup, ready to draw triangle push __LINE__ ; line number inside this function push 0h ; pointer to function name = NULL push tempVal ; fifo space needed - call _FifoMakeRoom ; note: updates fifoPtr + call _FifoMakeRoom ; note: updates fifoPtr add esp, 12 ; remove 3 DWORD arguments from stack nop ; filler @@ -181,7 +163,8 @@ %define dlp ebx ; points to dataList structure %define dlpstrt ecx ; points to begin of dataList structure %define vertex edx ; the current vertex -%define packCol esi + + ALIGN 32 .__triBegin: mov eax, [gc+triPacketHdr]; Packet 3 header @@ -193,14 +176,14 @@ mov dlpstrt, dlp ; save pointer to start of dataList test fifo, 4 ; is fifo pointer qword aligned ? - jz .__fifo_aligned ; yes, it is qword aligned + jz .__fifo_aligned ; yes, it is qword aligned movq mm1, [vertex+X] ; y | x GR_FIFO_WRITE fifo, 0, eax ; write header to fifo; now qword aligned - add fifo, 12 ; fifoPtr += 3*sizeof(FxU32) + add fifo, 4 ; advance fifo for hdr; now qword aligned - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write y | x - nop ; filler + WRITE_MM1_FIFO_ALIGNED ; PCI write y | x + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) %IF GLIDE_PACK_RGB %IF GLIDE_PACK_ALPHA @@ -244,35 +227,37 @@ add dlp, 4 ; dlp++ test eax, eax ; end of list ? - jz .__paramLoopDoneWBone1 ; yes, one DWORD in "write buffer" + jz .__paramLoopDoneWBone1; yes, one DWORD in "write buffer" .__paramLoop1a: movd mm2, [eax+vertex] ; get next parameter + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ + punpckldq mm1, mm2 ; current param | previous param + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - mov eax, [dlp] ; offset = *(dlp + 1) - add dlp, 8 ; dlp += 2 - - punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param jz .__paramLoopDoneWBzero1; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jnz .__paramLoop1a ; nope, copy next parameter + + jnz .__paramLoop1a ; nope, copy next parameter nop ; filler - jmp .__paramLoopDoneWBone1 ; merge back into common stream + jmp .__paramLoopDoneWBone1; merge back into common stream %ELSE ; ! GLIDE_PACK_RGB ;; here: "write buffer" empty - mov eax, [dlp] ; Get first offset from the data list + mov eax,[dlp] ; Get first offset from the data list test eax, eax ; at end of list ? lea dlp, [dlp+4] ; dlp++ @@ -282,20 +267,22 @@ movd mm1, [eax+vertex] ; get next parameter mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jz .__paramLoopDoneWBone1 ; exit, write buffer contains one DWORD + jz .__paramLoopDoneWBone1; exit, write buffer contains one DWORD movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp += 2 - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param - test eax, eax ; at end of offset list (offset == 0) ? - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jnz .__paramLoop1a ; nope, copy next parameter + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + test eax, eax ; at end of offset list (offset == 0) ? + jnz .__paramLoop1a ; nope, copy next parameter nop ; filler jmp .__paramLoopDoneWBzero1; write buffer empty @@ -304,12 +291,12 @@ .__fifo_aligned: movd mm2, [vertex+X] ; y | x of vertex A - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - movd mm1, [gc+triPacketHdr]; Packet 3 header - punpckldq mm1, mm2 ; x | header - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write x | header + punpckldq mm1, mm2 ; x | header + WRITE_MM1_FIFO_ALIGNED ; PCI write x | header + + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) movd mm1, [vertex+Y] ; 0 | y of vertex A %IF GLIDE_PACK_RGB @@ -351,7 +338,7 @@ punpckldq mm1, mm4 ; RGB(A) | y mov eax, [dlp] ; get first offset from the data list - WRITE_MM1_FIFO_ALIGNED 0 ; PCI write y | RGB(A) + WRITE_MM1_FIFO_ALIGNED ; PCI write y | RGB(A) add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) add dlp, 4 ; dlp++ @@ -368,15 +355,17 @@ jz .__paramLoopDoneWBone1 ; exit, write buffer contains one DWORD movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp += 2 + add dlp, 4 ; dlp++ - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + jnz .__paramLoop1b ; nope, copy next parameter nop ; filler @@ -386,8 +375,8 @@ mov eax, [dlp] ; get first offset from the data list add dlp, 4 ; dlp++ - cmp eax, 0 ; end of list ? - jz .__paramLoopDoneWBone1 ; yes, "write buffer" has y data + test eax, eax ; end of list ? + jz .__paramLoopDoneWBone1; yes, "write buffer" has y data .__paramLoop1b: movd mm2, [eax+vertex] ; get next parameter @@ -398,15 +387,20 @@ punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + test eax, eax ; at end of offset list (offset == 0) ? jz .__paramLoopDoneWBzero1; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jnz .__paramLoop1b ; nope, copy next parameter + jnz .__paramLoop1b ; nope, copy next parameter %ENDIF .__paramLoopDoneWBone1: @@ -419,7 +413,7 @@ movd mm2, [vertex+X] ; 0 | x if vertex B punpckldq mm1, mm2 ; x | old param - WRITE_MM1_FIFO_ALIGNED 0 ; PCI write: x | old param + WRITE_MM1_FIFO_ALIGNED ; PCI write: x | old param add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) movd mm1, [vertex+Y] ; 0 | y of vertex B @@ -464,7 +458,7 @@ punpckldq mm1, mm4 ; RGB(A) | y mov eax, [dlp] ; get first offset from the data list - WRITE_MM1_FIFO_ALIGNED 0 ; PCI write y | RGB(A) + WRITE_MM1_FIFO_ALIGNED ; PCI write y | RGB(A) add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) add dlp, 4 ; dlp++ @@ -478,19 +472,21 @@ mov eax, [dlp] ; offset = *(dlp + 1) test eax, eax ; at end of offset list (offset == 0) ? - jz .__paramLoopDoneWBone2 ; exit, write buffer contains one DWORD + jz .__paramLoopDoneWBone2; exit, write buffer contains one DWORD movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp += 2 + add dlp, 4 ; dlp++ - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jnz .__paramLoop2b ; nope, copy next parameter + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + jnz .__paramLoop2b ; nope, copy next parameter nop ; filler jmp .__paramLoopDoneWBzero2; write buffer empty @@ -504,25 +500,26 @@ .__paramLoop2b: movd mm2, [eax+vertex] ; get next parameter + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ + punpckldq mm1, mm2 ; current param | previous param + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - mov eax, [dlp] ; offset = *(dlp + 1) - add dlp, 8 ; dlp += 2 - - punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param jz .__paramLoopDoneWBzero2; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jnz .__paramLoop2b ; nope, copy next parameter + jnz .__paramLoop2b ; nope, copy next parameter - nop ; filler - jmp .__paramLoopDoneWBone2 ; write buffer contains one DWORD + jmp .__paramLoopDoneWBone2; write buffer contains one DWORD %ENDIF @@ -532,10 +529,9 @@ mov dlp, dlpstrt ; Reset the dataList movq mm1, [vertex+X] ; y | x of vertex B - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + WRITE_MM1_FIFO_ALIGNED ; PCI write y | x of vertex B - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write y | x of vertex B - nop ; filler + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) %IF GLIDE_PACK_RGB %IF GLIDE_PACK_ALPHA @@ -583,21 +579,23 @@ .__paramLoop2a: movd mm2, [eax+vertex] ; get next parameter + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ + punpckldq mm1, mm2 ; current param | previous param + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - mov eax, [dlp] ; offset = *(dlp + 1) - add dlp, 8 ; dlp += 8 - - punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param jz .__paramLoopDoneWBzero2; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? + jnz .__paramLoop2a ; nope, copy next parameter nop ; filler @@ -617,20 +615,22 @@ movd mm1, [eax+vertex] ; get next parameter mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? + jz .__paramLoopDoneWBone2 ; exit, write buffer contains one DWORD - movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp += 2 - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param - test eax, eax ; at end of offset list (offset == 0) ? - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jnz .__paramLoop2a ; nope, copy next parameter + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + test eax, eax ; at end of offset list (offset == 0) ? + jnz .__paramLoop2a ; nope, copy next parameter %ENDIF ; GLIDE_PACK_RGB @@ -641,12 +641,10 @@ mov dlp, dlpstrt ; Reset the dataList movq mm1, [vertex+X] ; y | x of vertex C + WRITE_MM1_FIFO_ALIGNED ; PCI write y | x of vertex C + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write y | x of vertex C - nop ; filler - - %IF GLIDE_PACK_RGB %IF GLIDE_PACK_ALPHA ;; assumes color and alpha values < 256.0 @@ -693,25 +691,27 @@ .__paramLoop3a: movd mm2, [eax+vertex] ; get next parameter - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) mov eax, [dlp] ; offset = *(dlp + 1) - add dlp, 8 ; dlp += 2 + add dlp, 4 ; dlp++ - test eax, eax ; at end of offset list (offset == 0) ? punpckldq mm1, mm2 ; current param | previous param - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jz .__paramLoopDoneWBzero3; exit, "write buffer" empty + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + test eax, eax ; at end of offset list (offset == 0) ? + + jz .__paramLoopDoneWBzero3; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jnz .__paramLoop3a ; nope, copy next parameter + jnz .__paramLoop3a ; nope, copy next parameter nop ; filler - jmp .__paramLoopDoneWBone3 ; merge back into common stream + jmp .__paramLoopDoneWBone3; merge back into common stream %ELSE ; ! GLIDE_PACK_RGB @@ -727,22 +727,23 @@ movd mm1, [eax+vertex] ; get next parameter mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jz .__paramLoopDoneWBone3 ; exit, write buffer contains one DWORD + jz .__paramLoopDoneWBone3; exit, write buffer contains one DWORD movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp += 2 - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + test eax, eax ; at end of offset list (offset == 0) ? + jnz .__paramLoop3a ; nope, copy next parameter - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jnz .__paramLoop3a ; nope, copy next parameter - - mov esp, esp ; filler jmp .__paramLoopDoneWBzero3; write buffer empty %ENDIF ; GLIDE_PACK_RGB @@ -758,11 +759,10 @@ movd mm2, [vertex+X] ; 0 | x if vertex C punpckldq mm1, mm2 ; x | old param - WRITE_MM1_FIFO_ALIGNED 0 ; PCI write: x | old param + WRITE_MM1_FIFO_ALIGNED ; PCI write: x | old param add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) movd mm1, [vertex+Y] ; 0 | y of vertex C - mov esp, esp ; filler %IF GLIDE_PACK_RGB %IF GLIDE_PACK_ALPHA @@ -801,35 +801,37 @@ %ENDIF ; !GLIDE_PACK_ALPHA punpckldq mm1, mm4 ; RGB(A) | y - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - mov eax, [dlp] ; get first offset from the data list + add dlp, 4 ; dlp++ + WRITE_MM1_FIFO_ALIGNED ; PCI write y | RGB(A) - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write y | RGB(A) - nop ; filler - + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) test eax, eax ; end of list ? + jz .__paramLoopDoneWBzero3; yes, "write buffer" is empty + nop ; filler .__paramLoop3b: movd mm1, [eax+vertex] ; get next parameter mov eax, [dlp] ; offset = *(dlp + 1) test eax, eax ; at end of offset list (offset == 0) ? - jz .__paramLoopDoneWBone3 ; exit, write buffer contains one DWORD + jz .__paramLoopDoneWBone3; exit, write buffer contains one DWORD movd mm2, [eax+vertex] ; get next parameter - add dlp, 8 ; dlp++ + add dlp, 4 ; dlp++ - mov eax, [dlp-4] ; offset = *(dlp + 1) - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + mov eax, [dlp] ; offset = *(dlp + 1) + add dlp, 4 ; dlp++ punpckldq mm1, mm2 ; current param | previous param test eax, eax ; at end of offset list (offset == 0) ? - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param - jnz .__paramLoop3b ; nope, copy next parameter + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + jnz .__paramLoop3b ; nope, copy next parameter nop ; filler jmp .__paramLoopDoneWBzero3; write buffer empty @@ -840,26 +842,28 @@ add dlp, 4 ; dlp++ test eax, eax ; end of list ? - jz .__paramLoopDoneWBone3 ; yes, "write buffer" has y data + jz .__paramLoopDoneWBone3; yes, "write buffer" has y data .__paramLoop3b: movd mm2, [eax+vertex] ; get next parameter - add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) - mov eax, [dlp] ; offset = *(dlp + 1) - add dlp, 8 ; dlp += 2 punpckldq mm1, mm2 ; current param | previous param - cmp eax, 0 ; at end of offset list (offset == 0) ? - - WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param + add dlp, 4 ; dlp++ + + WRITE_MM1_FIFO_ALIGNED ; PCI write current param | previous param + add fifo, 8 ; fifoPtr += 2*sizeof(FxU32) + + test eax, eax ; at end of offset list (offset == 0) ? jz .__paramLoopDoneWBzero3; exit, "write buffer" empty movd mm1, [eax+vertex] ; get next parameter - mov eax, [dlp-4] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) + + add dlp, 4 ; dlp++ test eax, eax ; at end of offset list (offset == 0) ? - jnz .__paramLoop3b ; nope, copy next parameter + jnz .__paramLoop3b ; nope, copy next parameter %ENDIF .__paramLoopDoneWBone3: @@ -873,7 +877,7 @@ ;; Update gc->fifoPtr and gc->fifoRoom - mov ecx, [_GlideRoot + trisDrawn] ; _GlideRoot.stats.trisDrawn + mov ecx, [_GlideRoot + trisDrawn] ; _GlideRoot.stats.trisDrawn mov eax, fifo ; new fifo pointer mov ebx, [gc + fifoPtr] ; old fifo pointer @@ -885,7 +889,7 @@ mov ebp, [_GlideRoot + trisProcessed]; _GlideRoot.stats.trisProcessed sub eax, ebx ; new fifo ptr - old fifo ptr = additional fifo space used - mov [_GlideRoot + trisDrawn], ecx ; + mov [_GlideRoot + trisDrawn], ecx ; sub edx, eax ; new fifo space available mov eax, 1h ; return value = triangle drawn @@ -893,35 +897,35 @@ ;; Restore trashed registers - inc ebp ; _GlideRoot.stats.trisProcessed++ - pop esi ; restore caller's register variable + inc ebp ; _GlideRoot.stats.trisProcessed++ + pop esi ; restore caller's register variable - mov [_GlideRoot + trisProcessed], ebp ; - pop ebx ; restore caller's register variable + mov [_GlideRoot + trisProcessed], ebp ; + pop ebx ; restore caller's register variable - pop ebp ; restore frame pointer - pop edi ; restore caller's register variable + pop ebp ; restore frame pointer + pop edi ; restore caller's register variable - femms ; no more AMD3D code, clear FPU/MMX regs + femms ; no more AMD3D code, clear FPU/MMX regs - ret ; return to caller + ret ; return to caller %IF GLIDE_CULLING .__cullFail: - mov ebp, [_GlideRoot + trisProcessed]; triangles processed so far - xor eax, eax ; return value = triangle not drawn + mov ebp, [_GlideRoot + trisProcessed] ; triangles processed so far + xor eax, eax ; return value = triangle not drawn - femms ; no more AMD3D code, clear FPU/MMX regs + femms ; no more AMD3D code, clear FPU/MMX regs ;; Restore trashed registers - inc ebp ; _GlideRoot.stats.trisProcessed++; + inc ebp ; _GlideRoot.stats.trisProcessed++; pop esi mov [_GlideRoot + trisProcessed], ebp pop ebx - pop ebp ; restore frame pointer + pop ebp ; restore frame pointer pop edi ret @@ -968,9 +972,6 @@ mov cull, [gc + cull_mode] mov fc, [esp + _vc$] - test cull, cull - jz .nocull - shl cull, 31 ; culltest << 31 ;Area_Computation: @@ -1011,7 +1012,6 @@ jge .__triDone -.nocull: %ENDIF ; GLIDE_CULLING align 4 @@ -1062,39 +1062,39 @@ nop ; Avoid p5 agi w/ load of vertex ptr nop - mov eax, dword [vertex] ; X + mov eax, [vertex + X] ; X lea dlp, [gc + tsuDataList] ; Reset the dataList GR_FIFO_WRITE fifo, -8, eax ; PCI write X - mov eax, dword [vertex + 4] ; Y + mov eax, [vertex + Y] ; Y xor packCol, packCol ; Clear packed color GR_FIFO_WRITE fifo, -4, eax ; PCI write Y %IF GLIDE_PACK_RGB - fld dword [vertex + b] ; B + fld dword [vertex + b] ; B fadd dword [_GlideRoot + fBiasLo] ; BC GC - fld dword [vertex + g] ; G B + fld dword [vertex + g] ; G B fadd dword [_GlideRoot + fBiasHi] ; GC B - fld dword [vertex + r] ; R GC BC + fld dword [vertex + r] ; R GC BC fadd dword [_GlideRoot + fBiasHi] ; RC GC BC - fxch st2 ; BC GC RC + fxch st2 ; BC GC RC fstp dword [bias0] ; GC RC fstp dword [bias1] ; RC - mov packCol, dword [bias0] ; B + bias + mov packCol, [bias0] ; B + bias fstp dword [bias0] - mov eax, dword [bias1] ; G + bias - + mov eax, [bias1] ; G + bias + %IF GLIDE_PACK_ALPHA fld dword [vertex + a] fadd dword [_GlideRoot + fBiasHi] - and packCol, 00FFh ; B color component + and packCol, 000000FFh ; B color component and eax, 0000FF00h ; G component << 8 add dlp, 8 ; Packed RGB + A dataList entry @@ -1104,13 +1104,13 @@ nop fstp dword [bias1] - mov eax, dword [bias0] ; R + bias + mov eax, [bias0] ; R + bias - mov esi, dword [bias1] ; A + bias + mov esi, [bias1] ; A + bias and eax, 0000FF00h ; R component << 8 - and esi, 0FFFFFF00h ; A component << 8 - shl eax, 8 ; R << 16 + and esi, 0000FF00h ; A component << 8 + shl eax, 8 ; R << 8 or packCol, eax ; 00RRGGBB shl esi, 16 ; A << 16 @@ -1118,16 +1118,16 @@ or packCol, esi ; AARRGGBB nop %ELSE ; !GLIDE_PACK_ALPHA - and packCol, 00FFh ; B color component + and packCol, 000000FFh ; B color component and eax, 0000FF00h ; G component << 8 add dlp, 4 ; Next dataList item or packCol, eax - mov eax, dword [bias0] ; R + bias + mov eax, [bias0] ; R + bias and eax, 0000FF00h ; R component << 8 - shl eax, 8 ; R << 16 + shl eax, 8 ; R << 8 or packCol, eax ; 00RRGGBB %ENDIF ; !GLIDE_PACK_ALPHA @@ -1136,7 +1136,7 @@ %ENDIF ; GLIDE_PACK_RGB .__doParams: - mov eax, dword [dlp] ; Get first offset from the data list + mov eax, [dlp] ; Get first offset from the data list add dlp, 4 ; dlp++ cmp eax, 0 ; Are we done? @@ -1148,10 +1148,10 @@ nop .__paramLoop: - mov tempVal, dword [eax + vertex] ; Get the parameter from teh vertex + mov tempVal, [eax + vertex] ; Get the parameter from teh vertex add fifo, 4 ; fifoPtr += sizeof(FxU32) - mov eax, dword [dlp] ; offset = *(dlp + 1) + mov eax, [dlp] ; offset = *(dlp + 1) add dlp, 4 ; dlp++ cmp eax, 0 ; Are we done? @@ -1175,7 +1175,7 @@ mov [gc + fifoPtr], fifo sub eax, ebx - mov ebx, [_GlideRoot + trisDrawn] ; _GlideRoot.stats.trisDrawn++; + mov ebx, [_GlideRoot + trisDrawn] ; _GlideRoot.stats.trisDrawn++; sub [gc + fifoRoom], eax add ebx, 1