Fix gcc 4.1 new type-punned ptr breaks antialias. warnings
This commit is contained in:
@@ -210,8 +210,8 @@ main (int argc, char **argv)
|
||||
OFFSET (gr, pool.f1, "pool_f1");
|
||||
OFFSET (gr, pool.f255, "pool_f255");
|
||||
|
||||
OFFSET (gr, pool.ftemp1, "pool_fTemp1");
|
||||
OFFSET (gr, pool.ftemp2, "pool_fTemp2");
|
||||
OFFSET (gr, pool.temp1.f, "pool_fTemp1");
|
||||
OFFSET (gr, pool.temp2.f, "pool_fTemp2");
|
||||
|
||||
SIZEOF (gr,"GlideRoot");
|
||||
NEWLINE;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.8.13 2005/08/13 21:06:56 jwrdegoede
|
||||
** Last needed 64 bit fixes for h5/h3, complete 64 bit support for cvg
|
||||
**
|
||||
** Revision 1.1.1.1.8.12 2005/06/10 14:17:53 jwrdegoede
|
||||
** Fix compilation when GL_X86 is not defined
|
||||
**
|
||||
@@ -1367,7 +1370,9 @@ struct _GlideRoot_s {
|
||||
float fHalf;
|
||||
float f1;
|
||||
float f255;
|
||||
float ftemp1, ftemp2; /* temps to convert floats to ints */
|
||||
/* temps to convert floats to ints */
|
||||
union { float f; FxI32 i; FxU32 u; } temp1;
|
||||
union { float f; FxI32 i; FxU32 u; } temp2;
|
||||
float fIntTruncBias;
|
||||
|
||||
#if GLIDE_PACKED_RGB
|
||||
@@ -2699,10 +2704,10 @@ _grCVGFifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
*/
|
||||
#if GLIDE_PACKED_RGB
|
||||
#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \
|
||||
((_GlideRoot.pool.ftemp1 = (float)((float)(__fpVal) + (float)(__fpBias))), \
|
||||
((_GlideRoot.pool.temp1.f = (float)((float)(__fpVal) + (float)(__fpBias))), \
|
||||
GR_ASSERT((__fpVal) >= 0.0f), \
|
||||
GR_ASSERT((__fpVal) < 256.0f), \
|
||||
(((*(const FxU32*)&_GlideRoot.pool.ftemp1) & (__fpMask)) << (__fpShift)))
|
||||
((_GlideRoot.pool.temp1.u & (__fpMask)) << (__fpShift)))
|
||||
|
||||
#define RGBA_COMP_CLAMP(__fpVal, __compToken) \
|
||||
RGBA_COMP(__fpVal, kPackBias##__compToken, kPackShift##__compToken, kPackMask##__compToken)
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.8.4 2005/08/13 21:06:57 jwrdegoede
|
||||
** Last needed 64 bit fixes for h5/h3, complete 64 bit support for cvg
|
||||
**
|
||||
** Revision 1.1.1.1.8.3 2005/06/09 18:32:08 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
@@ -270,34 +273,30 @@ _grDrawTextureLine_Default(const void *a, const void *b)
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 91);
|
||||
|
||||
#define DX _GlideRoot.pool.ftemp1
|
||||
#define ADY _GlideRoot.pool.ftemp2
|
||||
#define DX _GlideRoot.pool.temp1
|
||||
#define ADY _GlideRoot.pool.temp2
|
||||
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
{
|
||||
FxI32 i, j;
|
||||
FxU32 dataElem;
|
||||
FxU32 vSize;
|
||||
int i;
|
||||
FxU32 vSize, dataElem;
|
||||
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, 4) - FARRAY(a, 4);
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = FARRAY(b, 4) - FARRAY(a, 4);
|
||||
if (ADY.i < 0) {
|
||||
const void *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
/* (*(long *)&ADY) = i; */
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
|
||||
DX = FARRAY(b, 0) - FARRAY(a, 0);
|
||||
j = *(int *)&DX;
|
||||
j &= 0x7fffffffL; /* abs(adx) */
|
||||
DX.f = FARRAY(b, 0) - FARRAY(a, 0);
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0))
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0))
|
||||
return;
|
||||
|
||||
vSize = gc->state.vData.vSize + 8;
|
||||
@@ -305,7 +304,7 @@ _grDrawTextureLine_Default(const void *a, const void *b)
|
||||
TRI_STRIP_BEGIN(kSetupCullDisable | kSetupStrip, 4, vSize,
|
||||
SSTCP_PKT3_BDDDDD | (1<<15));
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
TRI_SETF(FARRAY(b, 0));
|
||||
dataElem = 0;
|
||||
TRI_SETF(FARRAY(b, 4) - _GlideRoot.pool.fHalf);
|
||||
@@ -1388,35 +1387,31 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((_GlideRoot.pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
@@ -1715,35 +1710,31 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((_GlideRoot.pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.8.6 2005/08/13 21:06:57 jwrdegoede
|
||||
** Last needed 64 bit fixes for h5/h3, complete 64 bit support for cvg
|
||||
**
|
||||
** Revision 1.1.1.1.8.5 2005/06/17 14:18:49 jwrdegoede
|
||||
** Fix few warnings when USE_X86=1 is not set
|
||||
**
|
||||
@@ -493,8 +496,8 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
0x02, sizeof(FxU32) << 1, SSTCP_PKT3_BDDDDD);
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
_GlideRoot.pool.ftemp1 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
_GlideRoot.pool.ftemp2 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
_GlideRoot.pool.temp1.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
_GlideRoot.pool.temp2.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
|
||||
/* draw a little triangle, with the lower left corner at pixel center. */
|
||||
|
||||
@@ -508,9 +511,9 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
*/
|
||||
|
||||
/* Mask off the real fractional bits from the mantissa */
|
||||
x = ((*(FxU32*)&_GlideRoot.pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
x = ((_GlideRoot.pool.temp1.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
y = ((*(FxU32*)&_GlideRoot.pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
y = ((_GlideRoot.pool.temp2.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
|
||||
/* Lower right corner */
|
||||
@@ -577,21 +580,21 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
0x02, sizeof(FxU32) << 1, SSTCP_PKT3_BDDDDD);
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
_GlideRoot.pool.ftemp1 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
_GlideRoot.pool.temp1.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
oow *
|
||||
gc->state.Viewport.hwidth +
|
||||
gc->state.Viewport.ox +
|
||||
bias);
|
||||
_GlideRoot.pool.ftemp2 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
_GlideRoot.pool.temp2.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
oow *
|
||||
gc->state.Viewport.hheight +
|
||||
gc->state.Viewport.oy +
|
||||
bias);
|
||||
|
||||
/* Mask off the real fractional bits from the mantissa */
|
||||
x = ((*(FxU32*)&_GlideRoot.pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
x = ((_GlideRoot.pool.temp1.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
y = ((*(FxU32*)&_GlideRoot.pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
y = ((_GlideRoot.pool.temp2.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
|
||||
/* Lower right cornder */
|
||||
@@ -650,13 +653,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
* except the data set up is from the pointer array and
|
||||
* its data layout
|
||||
*/
|
||||
int j;
|
||||
FxI32 sCount;
|
||||
FxU32 vertexParamOffset;
|
||||
FxI32 stride;
|
||||
FxI32 sCount, stride;
|
||||
|
||||
#define DX _GlideRoot.pool.ftemp1
|
||||
#define ADY _GlideRoot.pool.ftemp2
|
||||
#define DX _GlideRoot.pool.temp1
|
||||
#define ADY _GlideRoot.pool.temp2
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grDrawLineStrip", 91);
|
||||
|
||||
@@ -679,8 +680,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -698,23 +698,18 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
}
|
||||
|
||||
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
|
||||
DX.f = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) {
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) {
|
||||
#ifdef GLIDE_DEBUG
|
||||
gc->expected_counter -= (gc->state.vData.vSize << 2 );
|
||||
gc->checkCounter -= ((gc->state.vData.vSize+1) << 2 );
|
||||
@@ -731,10 +726,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
*/
|
||||
DA_CONT(kSetupCullDisable | kSetupStrip, gc->cmdTransportInfo.paramMask,
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
{
|
||||
int i;
|
||||
FxU32 dataElem;
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset));
|
||||
dataElem = 0;
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset+4) - _GlideRoot.pool.fHalf);
|
||||
@@ -833,8 +829,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
float oowa, oowb = 0.0f, owa, owb, tmp1, tmp2, fax, fay, fbx, fby;
|
||||
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
float *a,*b;
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -869,30 +864,25 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = tmp2 - tmp1;
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
owa = oowb; owb = oowa;
|
||||
fay = tmp2;
|
||||
fby = tmp1;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
|
||||
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
fbx = FARRAY(b, gc->state.vData.vertexInfo.offset)
|
||||
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = fbx - fax;
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) {
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) {
|
||||
#ifdef GLIDE_DEBUG
|
||||
gc->expected_counter -= (gc->state.vData.vSize << 2 );
|
||||
gc->checkCounter -= ((gc->state.vData.vSize+1) << 2 );
|
||||
@@ -904,7 +894,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(fbx);
|
||||
DA_SETF(fby - _GlideRoot.pool.fHalf);
|
||||
DA_VP_SETFS(b,oowb);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.8.1 2005/06/17 14:18:49 jwrdegoede
|
||||
** Fix few warnings when USE_X86=1 is not set
|
||||
**
|
||||
** Revision 1.1.1.1 1999/12/07 21:42:34 joseph
|
||||
** Initial checkin into SourceForge.
|
||||
**
|
||||
@@ -210,31 +213,31 @@ GR_DDFUNC(_trisetup_nogradients,
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1;
|
||||
const FxU32 culltest = (gc->state.cull_mode << 31UL);
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) && (((FxI32)(j ^ culltest)) >= 0)) {
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
(((FxI32)(_GlideRoot.pool.temp1.i ^ culltest)) >= 0)) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
** $Revision$
|
||||
** $Date$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.6.3 2005/06/09 18:32:28 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
** Revision 1.1.1.1.6.2 2005/05/25 08:56:23 jwrdegoede
|
||||
** Make h5 and h3 tree 64 bit clean. This is ported over from the non-devel branch so this might be incomplete
|
||||
**
|
||||
@@ -988,10 +991,10 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
*/
|
||||
#if GLIDE_PACKED_RGB
|
||||
#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \
|
||||
((gc->pool.ftemp1 = (float)((float)(__fpVal + (float)(__fpBias))), \
|
||||
((gc->pool.temp1.f = (float)((float)(__fpVal + (float)(__fpBias))), \
|
||||
GR_ASSERT((__fpVal) >= 0.0f), \
|
||||
GR_ASSERT((__fpVal) < 256.0f), \
|
||||
(((*(const FxU32*)&gc->pool.ftemp1) & (__fpMask)) << (__fpShift)))
|
||||
((gc->pool.temp1.u & (__fpMask)) << (__fpShift)))
|
||||
|
||||
#define RGBA_COMP_CLAMP(__fpVal, __compToken) \
|
||||
RGBA_COMP(__fpVal, kPackBias##__compToken, kPackShift##__compToken, kPackMask##__compToken)
|
||||
|
||||
@@ -183,8 +183,8 @@ main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#if GLIDE_PACKED_RGB
|
||||
OFFSET (gc, pool.ftemp1, "fTemp1");
|
||||
OFFSET (gc, pool.ftemp2, "fTemp2");
|
||||
OFFSET (gc, pool.temp1.f, "fTemp1");
|
||||
OFFSET (gc, pool.temp2.f, "fTemp2");
|
||||
#endif
|
||||
|
||||
HEADER ("GlideRoot");
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.4.13 2005/06/10 14:17:54 jwrdegoede
|
||||
** Fix compilation when GL_X86 is not defined
|
||||
**
|
||||
** Revision 1.2.4.12 2005/05/25 08:56:23 jwrdegoede
|
||||
** Make h5 and h3 tree 64 bit clean. This is ported over from the non-devel branch so this might be incomplete
|
||||
**
|
||||
@@ -1011,7 +1014,9 @@ typedef struct GrGC_s
|
||||
} stats;
|
||||
|
||||
struct {
|
||||
float ftemp1, ftemp2; /* temps to convert floats to ints */
|
||||
/* temps to convert floats to ints */
|
||||
union { float f; FxI32 i; FxU32 u; } temp1;
|
||||
union { float f; FxI32 i; FxU32 u; } temp2;
|
||||
} pool;
|
||||
|
||||
#if GLIDE_HW_TRI_SETUP
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.6.6 2005/08/13 21:07:02 jwrdegoede
|
||||
** Last needed 64 bit fixes for h5/h3, complete 64 bit support for cvg
|
||||
**
|
||||
** Revision 1.1.1.1.6.5 2005/06/09 18:32:28 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
@@ -1453,35 +1456,32 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
gc->pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
gc->pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&gc->pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((gc->pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((gc->pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
@@ -1641,35 +1641,31 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
gc->pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
gc->pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&gc->pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((gc->pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((gc->pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.6.8 2005/06/09 18:32:28 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
** Revision 1.2.6.7 2005/05/25 08:56:23 jwrdegoede
|
||||
** Make h5 and h3 tree 64 bit clean. This is ported over from the non-devel branch so this might be incomplete
|
||||
**
|
||||
@@ -442,8 +445,8 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
0x02, sizeof(FxU32) << 1, SSTCP_PKT3_BDDDDD);
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
gc->pool.ftemp1 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
gc->pool.ftemp2 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
gc->pool.temp1.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
gc->pool.temp2.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
|
||||
/* draw a little triangle, with the lower left corner at pixel center. */
|
||||
|
||||
@@ -458,9 +461,9 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
|
||||
/* Mask off the real fractional bits from the mantissa */
|
||||
/* [dBorca] Hack alert: bad type-punning with gcc -O2 */
|
||||
x = ((*(FxU32*)&gc->pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
x = ((gc->pool.temp1.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
y = ((*(FxU32*)&gc->pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
y = ((gc->pool.temp2.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
|
||||
/* Lower right corner */
|
||||
@@ -527,21 +530,21 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
0x02, sizeof(FxU32) << 1, SSTCP_PKT3_BDDDDD);
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
gc->pool.ftemp1 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
gc->pool.temp1.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
oow *
|
||||
gc->state.Viewport.hwidth +
|
||||
gc->state.Viewport.ox +
|
||||
bias);
|
||||
gc->pool.ftemp2 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
gc->pool.temp2.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
oow *
|
||||
gc->state.Viewport.hheight +
|
||||
gc->state.Viewport.oy +
|
||||
bias);
|
||||
|
||||
/* Mask off the real fractional bits from the mantissa */
|
||||
x = ((*(FxU32*)&gc->pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
x = ((gc->pool.temp1.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
y = ((*(FxU32*)&gc->pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
y = ((gc->pool.temp2.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
|
||||
/* Lower right cornder */
|
||||
@@ -600,13 +603,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
* except the data set up is from the pointer array and
|
||||
* its data layout
|
||||
*/
|
||||
int j;
|
||||
FxI32 sCount;
|
||||
FxI32 stride, sCount;
|
||||
FxU32 vertexParamOffset;
|
||||
FxI32 stride;
|
||||
|
||||
#define DX gc->pool.ftemp1
|
||||
#define ADY gc->pool.ftemp2
|
||||
#define DX gc->pool.temp1
|
||||
#define ADY gc->pool.temp2
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grDrawLineStrip", 91);
|
||||
|
||||
@@ -631,8 +632,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -650,23 +650,18 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
|
||||
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) {
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) {
|
||||
#ifdef GLIDE_DEBUG
|
||||
gc->expected_counter -= (gc->state.vData.vSize << 2 );
|
||||
gc->checkCounter -= ((gc->state.vData.vSize+1) << 2 );
|
||||
@@ -683,10 +678,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
*/
|
||||
DA_CONT(kSetupCullDisable | kSetupStrip, gc->cmdTransportInfo.paramMask,
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
{
|
||||
int i;
|
||||
FxU32 dataElem;
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset));
|
||||
dataElem = 0;
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset+4) - _GlideRoot.pool.fHalf);
|
||||
@@ -785,8 +781,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
float oowa, oowb = 0.0f, owa, owb, tmp1, tmp2, fax, fay, fbx, fby;
|
||||
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
float *a,*b;
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -821,36 +816,31 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = tmp2 - tmp1;
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
owa = oowb; owb = oowa;
|
||||
fay = tmp2;
|
||||
fby = tmp1;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
|
||||
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
fbx = FARRAY(b, gc->state.vData.vertexInfo.offset)
|
||||
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = fbx - fax;
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) goto all_done_vp;
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) goto all_done_vp;
|
||||
|
||||
DA_CONT(kSetupCullDisable | kSetupStrip, gc->cmdTransportInfo.paramMask,
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(fbx);
|
||||
DA_SETF(fby - _GlideRoot.pool.fHalf);
|
||||
DA_VP_SETFS(b,oowb);
|
||||
|
||||
@@ -1119,10 +1119,10 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
*/
|
||||
#if GLIDE_PACKED_RGB
|
||||
#define RGBA_COMP(__fpVal, __fpBias, __fpShift, __fpMask) \
|
||||
((gc->pool.ftemp1 = (float)((float)(__fpVal + (float)(__fpBias))), \
|
||||
((gc->pool.temp1.f = (float)((float)(__fpVal + (float)(__fpBias))), \
|
||||
GR_ASSERT((__fpVal) >= 0.0f), \
|
||||
GR_ASSERT((__fpVal) < 256.0f), \
|
||||
(((*(const FxU32*)&gc->pool.ftemp1) & (__fpMask)) << (__fpShift)))
|
||||
((gc->pool.temp1.u & (__fpMask)) << (__fpShift)))
|
||||
|
||||
#define RGBA_COMP_CLAMP(__fpVal, __compToken) \
|
||||
RGBA_COMP(__fpVal, kPackBias##__compToken, kPackShift##__compToken, kPackMask##__compToken)
|
||||
|
||||
@@ -186,8 +186,8 @@ main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#if GLIDE_PACKED_RGB
|
||||
OFFSET (gc, pool.ftemp1, "fTemp1");
|
||||
OFFSET (gc, pool.ftemp2, "fTemp2");
|
||||
OFFSET (gc, pool.temp1.f, "fTemp1");
|
||||
OFFSET (gc, pool.temp2.f, "fTemp2");
|
||||
#endif
|
||||
|
||||
HEADER ("GlideRoot");
|
||||
|
||||
@@ -1547,7 +1547,9 @@ typedef struct GrGC_s
|
||||
} stats;
|
||||
|
||||
struct {
|
||||
float ftemp1, ftemp2; /* temps to convert floats to ints */
|
||||
/* temps to convert floats to ints */
|
||||
union { float f; FxI32 i; FxU32 u; } temp1;
|
||||
union { float f; FxI32 i; FxU32 u; } temp2;
|
||||
} pool;
|
||||
|
||||
#if GLIDE_HW_TRI_SETUP
|
||||
|
||||
@@ -1458,35 +1458,32 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
gc->pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
gc->pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&gc->pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((gc->pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((gc->pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
@@ -1646,35 +1643,31 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[yindex] - fc[yindex];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
gc->pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
gc->pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&gc->pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((gc->pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((gc->pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.ftemp1, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[xindex]), FloatVal(fa[yindex]),
|
||||
FloatVal(fb[xindex]), FloatVal(fb[yindex]),
|
||||
FloatVal(fc[xindex]), FloatVal(fc[yindex]),
|
||||
gc->pool.temp1.f, gc->state.cull_mode, culltest);
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
|
||||
@@ -496,8 +496,8 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
0x02, sizeof(FxU32) << 1, SSTCP_PKT3_BDDDDD);
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
gc->pool.ftemp1 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
gc->pool.ftemp2 = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
gc->pool.temp1.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset) + bias;
|
||||
gc->pool.temp2.f = FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) + bias;
|
||||
|
||||
/* draw a little triangle, with the lower left corner at pixel center. */
|
||||
|
||||
@@ -511,9 +511,9 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
*/
|
||||
|
||||
/* Mask off the real fractional bits from the mantissa */
|
||||
x = ((*(FxU32*)&gc->pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
x = ((gc->pool.temp1.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
y = ((*(FxU32*)&gc->pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
y = ((gc->pool.temp2.u & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
|
||||
(0x01UL << (22UL - kNumMantissaBits)));
|
||||
|
||||
/* Lower right corner */
|
||||
@@ -585,12 +585,12 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
y += lbias;
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
gc->pool.ftemp1 = (const float)x;
|
||||
gc->pool.ftemp2 = (const float)y;
|
||||
gc->pool.temp1.f = (const float)x;
|
||||
gc->pool.temp2.f = (const float)y;
|
||||
|
||||
/* Correct the bias to get rid of the fractional bits */
|
||||
x = /*(volatile float)*/gc->pool.ftemp1 - lbias;
|
||||
y = /*(volatile float)*/gc->pool.ftemp2 - lbias;
|
||||
x = /*(volatile float)*/gc->pool.temp1.f - lbias;
|
||||
y = /*(volatile float)*/gc->pool.temp2.f - lbias;
|
||||
|
||||
/* Lower right corner */
|
||||
DA_SETF(x);
|
||||
@@ -686,25 +686,25 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
|
||||
/* Convert to 32-bit representation */
|
||||
|
||||
gc->pool.ftemp1 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
gc->pool.temp1.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset) *
|
||||
oow *
|
||||
gc->state.Viewport.hwidth +
|
||||
gc->state.Viewport.ox +
|
||||
0.5f);
|
||||
gc->pool.ftemp2 = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
gc->pool.temp2.f = (FARRAY(vPtr, gc->state.vData.vertexInfo.offset + 4) *
|
||||
oow *
|
||||
gc->state.Viewport.hheight +
|
||||
gc->state.Viewport.oy +
|
||||
0.5f);
|
||||
|
||||
fx = gc->pool.ftemp1;
|
||||
fy = gc->pool.ftemp2;
|
||||
fx = gc->pool.temp1.f;
|
||||
fy = gc->pool.temp2.f;
|
||||
|
||||
gc->pool.ftemp1 += lbias;
|
||||
gc->pool.ftemp2 += lbias;
|
||||
gc->pool.temp1.f += lbias;
|
||||
gc->pool.temp2.f += lbias;
|
||||
|
||||
fx = gc->pool.ftemp1 - lbias;
|
||||
fy = gc->pool.ftemp2 - lbias;
|
||||
fx = gc->pool.temp1.f - lbias;
|
||||
fy = gc->pool.temp2.f - lbias;
|
||||
|
||||
/* Lower right corner */
|
||||
DA_SETF(fx);
|
||||
@@ -770,13 +770,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
* except the data set up is from the pointer array and
|
||||
* its data layout
|
||||
*/
|
||||
int j;
|
||||
FxI32 sCount;
|
||||
FxI32 stride, sCount;
|
||||
FxU32 vertexParamOffset;
|
||||
FxI32 stride;
|
||||
|
||||
#define DX gc->pool.ftemp1
|
||||
#define ADY gc->pool.ftemp2
|
||||
#define DX gc->pool.temp1
|
||||
#define ADY gc->pool.temp2
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grDrawLineStrip", 91);
|
||||
|
||||
@@ -801,8 +799,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -820,23 +817,18 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
|
||||
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) {
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) {
|
||||
#ifdef GLIDE_DEBUG
|
||||
gc->expected_counter -= (gc->state.vData.vSize << 2 );
|
||||
gc->checkCounter -= ((gc->state.vData.vSize+1) << 2 );
|
||||
@@ -853,10 +845,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
*/
|
||||
DA_CONT(kSetupCullDisable | kSetupStrip, gc->cmdTransportInfo.paramMask,
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
{
|
||||
int i;
|
||||
FxU32 dataElem;
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset));
|
||||
dataElem = 0;
|
||||
DA_SETF(FARRAY(b, gc->state.vData.vertexInfo.offset+4) - _GlideRoot.pool.fHalf);
|
||||
@@ -955,8 +948,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
float oowa, oowb = 0.0f, owa, owb, tmp1, tmp2, fax, fay, fbx, fby;
|
||||
|
||||
while (sCount > 0) {
|
||||
FxI32 k, i;
|
||||
FxI32 vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
FxI32 k, vcount = sCount >= LINES_BUFFER ? LINES_BUFFER : sCount;
|
||||
float *a,*b;
|
||||
GR_SET_EXPECTED_SIZE((gc->state.vData.vSize << 2) * vcount, vcount);
|
||||
DA_BEGIN;
|
||||
@@ -991,36 +983,31 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
ADY.f = tmp2 - tmp1;
|
||||
if (ADY.i < 0) {
|
||||
float *tv;
|
||||
owa = oowb; owb = oowa;
|
||||
fay = tmp2;
|
||||
fby = tmp1;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(int *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
}
|
||||
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
|
||||
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
fbx = FARRAY(b, gc->state.vData.vertexInfo.offset)
|
||||
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = fbx - fax;
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/* check for zero-length lines */
|
||||
if ((j >= i) && (j == 0)) goto all_done_vp;
|
||||
if ((DX.i >= ADY.i) && (DX.i == 0)) goto all_done_vp;
|
||||
|
||||
DA_CONT(kSetupCullDisable | kSetupStrip, gc->cmdTransportInfo.paramMask,
|
||||
0x04UL, vertexParamOffset, SSTCP_PKT3_BDDDDD);
|
||||
{
|
||||
/* x major */
|
||||
if (j >= i) {
|
||||
if (DX.i >= ADY.i) {
|
||||
DA_SETF(fbx);
|
||||
DA_SETF(fby - _GlideRoot.pool.fHalf);
|
||||
DA_VP_SETFS(b,oowb);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.6 2005/06/10 14:17:56 jwrdegoede
|
||||
** Fix compilation when GL_X86 is not defined
|
||||
**
|
||||
** Revision 1.1.2.5 2005/05/25 08:51:52 jwrdegoede
|
||||
** Add #ifdef GL_X86 around x86 specific code
|
||||
**
|
||||
@@ -920,7 +923,9 @@ struct _GlideRoot_s {
|
||||
float f1;
|
||||
float f255;
|
||||
float f256;
|
||||
float ftemp1, ftemp2; /* temps to convert floats to ints */
|
||||
/* temps to convert floats to ints */
|
||||
union { float f; FxI32 i; FxU32 u; } temp1;
|
||||
union { float f; FxI32 i; FxU32 u; } temp2;
|
||||
} pool;
|
||||
|
||||
struct { /* environment data */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.5 2005/06/16 18:58:32 jwrdegoede
|
||||
** Fix 2 sst1 bugs accidently introduced by warning fixes
|
||||
**
|
||||
** Revision 1.1.2.4 2005/06/09 18:32:35 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
@@ -1970,35 +1973,31 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
dyBC = fb[1] - fc[1];
|
||||
|
||||
/* Stash the area in the float pool for easy access */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
|
||||
{
|
||||
const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO((291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest));
|
||||
/* Zero-area triangles are BAD!! */
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GDBG_INFO((291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest));
|
||||
|
||||
goto done;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((_GlideRoot.pool.temp1.i ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if ((gc->state.cull_mode != GR_CULL_DISABLE) &&
|
||||
((j ^ (culltest << 31)) >= 0)) {
|
||||
|
||||
GDBG_INFO((291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest));
|
||||
|
||||
goto done;
|
||||
}
|
||||
GDBG_INFO((291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
|
||||
FloatVal(fa[0]), FloatVal(fa[1]),
|
||||
FloatVal(fb[0]), FloatVal(fb[1]),
|
||||
FloatVal(fc[0]), FloatVal(fc[1]),
|
||||
_GlideRoot.pool.temp1.f, gc->state.cull_mode, culltest));
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} /* end culling test */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.7 2005/06/16 18:58:32 jwrdegoede
|
||||
** Fix 2 sst1 bugs accidently introduced by warning fixes
|
||||
**
|
||||
** Revision 1.1.2.6 2005/06/09 18:32:35 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
@@ -215,7 +218,7 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -316,16 +319,15 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -368,7 +370,7 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
SET_GW_CMD( fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
|
||||
SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[0] );
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
FSET_GW_ENTRY( fifoPtr, 2, snap_xa );
|
||||
@@ -679,7 +681,7 @@ GDBG_INFO((285,"p0,1y: %g %g dpdy: %g\n",dpBC * dxAB,dpAB * dxBC,dpdy));
|
||||
|
||||
/* write triangle command */
|
||||
triangle_command:
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.temp1.f );
|
||||
fifoPtr+=1;
|
||||
|
||||
if (((FxU32)fifoPtr) & 0x7) {
|
||||
@@ -920,7 +922,7 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -1019,16 +1021,15 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +1038,7 @@ _grVpDrawTriangle( const void *va, const void *vb, const void *vc )
|
||||
|
||||
GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
GR_SETF( hw->FvA.x, snap_xa);
|
||||
@@ -1359,7 +1360,7 @@ GDBG_INFO((285,"p0,1y: %g %g dpdy: %g\n",dpBC * dxAB,dpAB * dxBC,dpdy));
|
||||
}
|
||||
|
||||
/* Draw the triangle by writing the area to the triangleCMD register */
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.temp1.f ) );
|
||||
_GlideRoot.stats.trisDrawn++;
|
||||
|
||||
GR_CHECK_SIZE_SLOPPY();
|
||||
@@ -1451,10 +1452,10 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
#endif
|
||||
fx = *vPtr + bias;
|
||||
fy = *(vPtr+1) + bias;
|
||||
_GlideRoot.pool.ftemp1 = (float)fx;
|
||||
_GlideRoot.pool.ftemp2 = (float)fy;
|
||||
x = *(int *)&_GlideRoot.pool.ftemp1;
|
||||
y = *(int *)&_GlideRoot.pool.ftemp2;
|
||||
_GlideRoot.pool.temp1.f = (float)fx;
|
||||
_GlideRoot.pool.temp2.f = (float)fy;
|
||||
x = _GlideRoot.pool.temp1.i;
|
||||
y = _GlideRoot.pool.temp2.i;
|
||||
x <<= SST_XY_FRACBITS; /* convert to fixed point */
|
||||
x += SST_XY_HALF; /* and center within pixel */
|
||||
|
||||
@@ -1525,10 +1526,10 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
fy = FARRAY(vPtr, 4)*oow*gc->state.Viewport.hheight
|
||||
+ gc->state.Viewport.oy + bias;
|
||||
|
||||
_GlideRoot.pool.ftemp1 = (float)fx;
|
||||
_GlideRoot.pool.ftemp2 = (float)fy;
|
||||
x = *(int *)&_GlideRoot.pool.ftemp1;
|
||||
y = *(int *)&_GlideRoot.pool.ftemp2;
|
||||
_GlideRoot.pool.temp1.f = (float)fx;
|
||||
_GlideRoot.pool.temp2.f = (float)fy;
|
||||
x = _GlideRoot.pool.temp1.i;
|
||||
y = _GlideRoot.pool.temp2.i;
|
||||
x <<= SST_XY_FRACBITS; /* convert to fixed point */
|
||||
x += SST_XY_HALF; /* and center within pixel */
|
||||
|
||||
@@ -1702,11 +1703,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
{
|
||||
#define FN_NAME "_grDrawLineStrip"
|
||||
|
||||
int i;
|
||||
float m, dp;
|
||||
#define DX _GlideRoot.pool.ftemp1
|
||||
#define ADY _GlideRoot.pool.ftemp2
|
||||
#define DX _GlideRoot.pool.temp1
|
||||
#define ADY _GlideRoot.pool.temp2
|
||||
|
||||
int i,j;
|
||||
float *fp;
|
||||
struct dataList_s *dlp;
|
||||
FxI32 index;
|
||||
@@ -1756,30 +1757,25 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = snap_yb - snap_ya;
|
||||
i = *(long *)&ADY;
|
||||
if ( i < 0 ) {
|
||||
ADY.f = snap_yb - snap_ya;
|
||||
if ( ADY.i < 0 ) {
|
||||
float *tv, ts;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
ts = snap_xa; snap_xa = snap_xb; snap_xb = ts;
|
||||
ts = snap_ya; snap_ya = snap_yb; snap_yb = ts;
|
||||
}
|
||||
|
||||
DX = snap_xb - snap_xa;
|
||||
j = *(long *)&DX;
|
||||
if (j < 0 ) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = snap_xb - snap_xa;
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/*
|
||||
** X major line
|
||||
*/
|
||||
if (j >= i ) { /* if (adx > ady) */
|
||||
if (j == 0) goto all_done; /* check for zero-length lines */
|
||||
if (DX.i >= ADY.i) { /* if (adx > ady) */
|
||||
if (DX.i == 0) goto all_done; /* check for zero-length lines */
|
||||
/* start up divide and overlap with as much integer stuff as possible*/
|
||||
m = _GlideRoot.pool.f1 / DX;
|
||||
m = _GlideRoot.pool.f1 / DX.f;
|
||||
dlp = gc->dataList;
|
||||
GR_SETF(hw->FvA.x, snap_xa);
|
||||
dp = snap_xb;
|
||||
@@ -1824,18 +1820,18 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 );
|
||||
}
|
||||
}
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,_GlideRoot.pool.ftemp1) );
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD, DX.f) );
|
||||
|
||||
GR_SETF(hw->FvB.x, snap_xa);
|
||||
GR_SETF(hw->FvB.y, snap_ya + _GlideRoot.pool.fHalf);
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,-_GlideRoot.pool.ftemp1));
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD, -DX.f));
|
||||
}
|
||||
|
||||
/*
|
||||
** Y major line
|
||||
*/
|
||||
else {
|
||||
m = _GlideRoot.pool.f1 / ADY;
|
||||
m = _GlideRoot.pool.f1 / ADY.f;
|
||||
dlp = gc->dataList;
|
||||
GR_SETF(hw->FvA.y, snap_ya);
|
||||
dp = snap_yb;
|
||||
@@ -1941,31 +1937,26 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
/*
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(long *)&ADY;
|
||||
if ( i < 0 ) {
|
||||
ADY.f = tmp2 - tmp1;
|
||||
if ( ADY.i < 0 ) {
|
||||
float *tv, ts;
|
||||
owa = oowb; owb = oowa;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
ADY.i ^= 0x80000000; /* ady = -ady; */
|
||||
ts = fax; fax = fbx; fbx = ts;
|
||||
ts = fay; fay = fby; fby = ts;
|
||||
}
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(long *)&DX;
|
||||
if (j < 0 ) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
DX.f = fbx - fax;
|
||||
DX.i &= 0x7fffffff; /* abs(adx) */
|
||||
|
||||
/*
|
||||
** X major line
|
||||
*/
|
||||
if (j >= i ) { /* if (adx > ady) */
|
||||
if (j == 0) goto all_done_vp; /* check for zero-length lines */
|
||||
if (DX.i >= ADY.i ) { /* if (adx > ady) */
|
||||
if (DX.i == 0) goto all_done_vp; /* check for zero-length lines */
|
||||
/* start up divide and overlap with as much integer stuff as possible*/
|
||||
m = _GlideRoot.pool.f1 / DX;
|
||||
m = _GlideRoot.pool.f1 / DX.f;
|
||||
dlp = gc->dataList;
|
||||
GR_SETF(hw->FvA.x, fax);
|
||||
GR_SETF(hw->FvB.x, fbx);
|
||||
@@ -2174,18 +2165,18 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
}
|
||||
}
|
||||
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,_GlideRoot.pool.ftemp1) );
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD, DX.f) );
|
||||
|
||||
GR_SETF(hw->FvB.x, fax);
|
||||
GR_SETF(hw->FvB.y, fay + _GlideRoot.pool.fHalf);
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,-_GlideRoot.pool.ftemp1));
|
||||
P6FENCE_CMD( GR_SETF(hw->FtriangleCMD, -DX.f) );
|
||||
}
|
||||
|
||||
/*
|
||||
** Y major line
|
||||
*/
|
||||
else {
|
||||
m = _GlideRoot.pool.f1 / ADY;
|
||||
m = _GlideRoot.pool.f1 / ADY.f;
|
||||
dlp = gc->dataList;
|
||||
GR_SETF(hw->FvA.y, fay);
|
||||
GR_SETF(hw->FvB.y, fby);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.5 2005/05/25 08:51:52 jwrdegoede
|
||||
** Add #ifdef GL_X86 around x86 specific code
|
||||
**
|
||||
** Revision 1.1.2.4 2004/10/04 09:35:59 dborca
|
||||
** second cut at Glide3x for Voodoo1/Rush (massive update):
|
||||
** delayed validation, vertex snapping, clip coordinates, strip/fan_continue, bugfixes.
|
||||
@@ -1755,13 +1758,13 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* non packed color */
|
||||
/* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.rgbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.rgbInfo.offset+GR_COLOR_OFFSET_GREEN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
gc->dataList[curTriSize + 2].i = gc->state.vData.rgbInfo.offset+GR_COLOR_OFFSET_BLUE;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)(void *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].bddr = 0;
|
||||
curTriSize += 3;
|
||||
params += 3;
|
||||
@@ -1773,13 +1776,13 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* packed color, argb */
|
||||
/* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_R;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_G;
|
||||
gc->dataList[curTriSize + 2].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)(void *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_B;
|
||||
curTriSize += 3;
|
||||
params += 3;
|
||||
@@ -1791,7 +1794,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
|
||||
if (i & STATE_REQUIRES_OOZ) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.zInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->Z;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->Z;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -1803,7 +1806,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
if (i & STATE_REQUIRES_IT_ALPHA) {
|
||||
if (gc->state.vData.colorType == GR_FLOAT) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.aInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -1814,7 +1817,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
else {
|
||||
/* packed color, argb */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_A;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -1828,10 +1831,10 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* always output to ALL chips, saves from having to change CHIP field */
|
||||
if (i & STATE_REQUIRES_ST_TMU0) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.st0Info.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->S;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->S;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.st0Info.offset + GR_TEXTURE_OFFSET_T;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->T;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->T;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
curTriSize += 2;
|
||||
params += 2;
|
||||
@@ -1843,7 +1846,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* we squeeze FBI.OOW in here for sequential writes in the simple case */
|
||||
if (i & STATE_REQUIRES_OOW_FBI) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.qInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->W;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->W;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -1857,7 +1860,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* We do this a bit differently for grouped writes */
|
||||
gc->dataList[curTriSize + 0].i = packMask;
|
||||
gc->dataList[curTriSize + 0].addr =
|
||||
(float *) GWH_GEN_ADDRESS(&tmu0->FvA.x);
|
||||
(float *)(void *) GWH_GEN_ADDRESS(&tmu0->FvA.x);
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
if (gc->state.vData.q0Info.mode == GR_PARAM_ENABLE)
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.q0Info.offset;
|
||||
@@ -1867,7 +1870,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
else
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.wInfo.offset;
|
||||
}
|
||||
gc->dataList[curTriSize + 1].addr = 0L;
|
||||
gc->dataList[curTriSize + 1].addr = NULL;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
|
||||
if (gwpSize & 1)
|
||||
@@ -1883,7 +1886,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,* */
|
||||
/* followed by the FtriangleCMD reg */
|
||||
gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
|
||||
gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
|
||||
gc->dataList[curTriSize].addr = (float *)(void *)&hw->FtriangleCMD;
|
||||
|
||||
/* 6 X,Y values plus AREA = 7, plus parameters */
|
||||
if (gwHeaderNum) {
|
||||
@@ -1958,13 +1961,13 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* non packed color */
|
||||
/* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.rgbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.rgbInfo.offset+GR_COLOR_OFFSET_GREEN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
gc->dataList[curTriSize + 2].i = gc->state.vData.rgbInfo.offset+GR_COLOR_OFFSET_BLUE;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)(void *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].bddr = 0;
|
||||
curTriSize += 3;
|
||||
params += 3;
|
||||
@@ -1973,13 +1976,13 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* packed color, argb */
|
||||
/* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->RED;
|
||||
gc->dataList[curTriSize + 0].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_R;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->GRN;
|
||||
gc->dataList[curTriSize + 1].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_G;
|
||||
gc->dataList[curTriSize + 2].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)(void *)&hw->BLU;
|
||||
gc->dataList[curTriSize + 2].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_B;
|
||||
curTriSize += 3;
|
||||
params += 3;
|
||||
@@ -1988,7 +1991,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
|
||||
if (i & STATE_REQUIRES_OOZ) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.zInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->Z;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->Z;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -1997,7 +2000,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
if (i & STATE_REQUIRES_IT_ALPHA) {
|
||||
if (gc->state.vData.colorType == GR_FLOAT) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.aInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -2005,7 +2008,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
else {
|
||||
/* packed color, argb */
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.pargbInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->ALF;
|
||||
gc->dataList[curTriSize + 0].bddr = gc->state.vData.pargbInfo.offset + GR_PARGB_A;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -2016,11 +2019,11 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* always output to ALL chips, saves from having to change CHIP field */
|
||||
if (i & STATE_REQUIRES_ST_TMU0) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.st0Info.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->S;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->S;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.st0Info.offset
|
||||
+ GR_TEXTURE_OFFSET_T;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&hw->T;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&hw->T;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
curTriSize += 2;
|
||||
params += 2;
|
||||
@@ -2029,7 +2032,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
/* we squeeze FBI.OOW in here for sequential writes in the simple case */
|
||||
if (i & STATE_REQUIRES_OOW_FBI) {
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.qInfo.offset;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&hw->W;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&hw->W;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -2047,7 +2050,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
else
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.wInfo.offset;
|
||||
}
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&tmu0->W;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&tmu0->W;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
curTriSize += 2;
|
||||
params += 1;
|
||||
@@ -2060,10 +2063,10 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
packerFlag = 0;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
gc->dataList[curTriSize + 1].i = gc->state.vData.st1Info.offset;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)&tmu1->S;
|
||||
gc->dataList[curTriSize + 1].addr = (float *)(void *)&tmu1->S;
|
||||
gc->dataList[curTriSize + 1].bddr = 0;
|
||||
gc->dataList[curTriSize + 2].i = gc->state.vData.st1Info.offset + GR_TEXTURE_OFFSET_T;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)&tmu1->T;
|
||||
gc->dataList[curTriSize + 2].addr = (float *)(void *)&tmu1->T;
|
||||
gc->dataList[curTriSize + 2].bddr = 0;
|
||||
curTriSize += 3;
|
||||
params += 2;
|
||||
@@ -2085,7 +2088,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
else
|
||||
gc->dataList[curTriSize + 0].i = gc->state.vData.wInfo.offset;
|
||||
}
|
||||
gc->dataList[curTriSize + 0].addr = (float *)&tmu1->W;
|
||||
gc->dataList[curTriSize + 0].addr = (float *)(void *)&tmu1->W;
|
||||
gc->dataList[curTriSize + 0].bddr = 0;
|
||||
curTriSize += 1;
|
||||
params += 1;
|
||||
@@ -2107,7 +2110,7 @@ GR_DDFUNC(_grRebuildDataList, void, ( void ))
|
||||
gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,* */
|
||||
/* followed by the FtriangleCMD reg */
|
||||
gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
|
||||
gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
|
||||
gc->dataList[curTriSize].addr = (float *)(void *)&hw->FtriangleCMD;
|
||||
|
||||
/* 6 X,Y values plus AREA = 7, plus parameters */
|
||||
_GlideRoot.curTriSize = (6 + curTriSize + (params<<1)) <<2;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.4 2005/06/09 18:32:35 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
** Revision 1.1.2.3 2005/05/25 08:51:52 jwrdegoede
|
||||
** Add #ifdef GL_X86 around x86 specific code
|
||||
**
|
||||
@@ -617,7 +620,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
const float *fb = (const float *)vb;
|
||||
const float *fc = (const float *)vc;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
int ii, ia, ib, ic;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
@@ -713,16 +716,15 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -731,7 +733,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
|
||||
GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
GR_SETF( hw->FvA.x, snap_xa );
|
||||
@@ -811,7 +813,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
}
|
||||
|
||||
/* Draw the triangle by writing the area to the triangleCMD register */
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.temp1.f ) );
|
||||
_GlideRoot.stats.trisDrawn++;
|
||||
|
||||
GR_CHECK_SIZE();
|
||||
@@ -831,7 +833,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
int ii, ia, ib, ic;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
@@ -928,16 +930,15 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -980,7 +981,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
SET_GW_CMD( fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
|
||||
SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[0] );
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
FSET_GW_ENTRY( fifoPtr, 2, snap_xa );
|
||||
@@ -1049,7 +1050,7 @@ GR_DDFUNC(_trisetup_mixed_datalist, FxI32, ( const void *va, const void *vb, con
|
||||
|
||||
/* write triangle command */
|
||||
triangle_command:
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.temp1.f );
|
||||
fifoPtr+=1;
|
||||
|
||||
if (((FxU32)fifoPtr) & 0x7) {
|
||||
@@ -1151,7 +1152,7 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
const float *fb = (const float *)vb;
|
||||
const float *fc = (const float *)vc;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
int ii, ia, ib, ic;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
@@ -1273,16 +1274,15 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
SET_GW_CMD( fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
|
||||
SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[0] );
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
FSET_GW_ENTRY( fifoPtr, 2, snap_xa );
|
||||
@@ -1660,7 +1660,7 @@ GDBG_INFO((285,"p0,1y: %g %g dpdy: %g\n",dpBC * dxAB,dpAB * dxBC,dpdy));
|
||||
|
||||
/* write triangle command */
|
||||
triangle_command:
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.temp1.f );
|
||||
fifoPtr+=1;
|
||||
|
||||
if (((FxU32)fifoPtr) & 0x7) {
|
||||
@@ -1931,7 +1931,7 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
const float *fb = (const float *)vb;
|
||||
const float *fc = (const float *)vc;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
int ii, ia, ib, ic;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
@@ -2051,16 +2051,15 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2069,7 +2068,7 @@ _vp_trisetup_mixed_datalist( const void *va, const void *vb, const void *vc, FxB
|
||||
|
||||
GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
GR_SETF( hw->FvA.x, snap_xa);
|
||||
@@ -2421,7 +2420,7 @@ GDBG_INFO((285,"p0,1y: %g %g dpdy: %g\n",dpBC * dxAB,dpAB * dxBC,dpdy));
|
||||
}
|
||||
|
||||
/* Draw the triangle by writing the area to the triangleCMD register */
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.temp1.f ) );
|
||||
_GlideRoot.stats.trisDrawn++;
|
||||
|
||||
GR_CHECK_SIZE_SLOPPY();
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.2.4 2005/06/09 18:32:35 jwrdegoede
|
||||
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
|
||||
**
|
||||
** Revision 1.1.2.3 2005/05/25 08:51:52 jwrdegoede
|
||||
** Add #ifdef GL_X86 around x86 specific code
|
||||
**
|
||||
@@ -156,7 +159,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -236,16 +239,15 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.1 = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -288,7 +290,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
SET_GW_CMD( fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
|
||||
SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[0] );
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
FSET_GW_ENTRY( fifoPtr, 2, snap_xa );
|
||||
@@ -350,7 +352,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
|
||||
/* write triangle command */
|
||||
triangle_command:
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.temp1.f );
|
||||
fifoPtr+=1;
|
||||
|
||||
if (((FxU32)fifoPtr) & 0x7) {
|
||||
@@ -430,7 +432,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float ooa, dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j,culltest;
|
||||
int i,culltest;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -514,16 +516,15 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0)
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0)
|
||||
return 0;
|
||||
|
||||
/* Backface culling, use sign bit as test */
|
||||
if (gc->state.cull_mode != GR_CULL_DISABLE) {
|
||||
if ((j ^ (culltest<<31)) >= 0) {
|
||||
if ((_GlideRoot.pool.temp1.i ^ (culltest<<31)) >= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +533,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
|
||||
GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
|
||||
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
|
||||
ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.temp1.f;
|
||||
/* GMT: note that we spread out our PCI writes */
|
||||
/* write out X & Y for vertex A */
|
||||
GR_SETF( hw->FvA.x, snap_xa );
|
||||
@@ -605,7 +606,7 @@ GR_DDFUNC(_trisetup, FxI32, ( const void *va, const void *vb, const void *vc ))
|
||||
}
|
||||
|
||||
/* Draw the triangle by writing the area to the triangleCMD register */
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.temp1.f ) );
|
||||
_GlideRoot.stats.trisDrawn++;
|
||||
|
||||
GR_CHECK_SIZE();
|
||||
@@ -636,7 +637,7 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j;
|
||||
int i;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -710,12 +711,11 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
dyBC = snap_yb - snap_yc;
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.stats.trisProcessed++;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
}
|
||||
|
||||
triangle_command:
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
|
||||
FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.temp1.f );
|
||||
fifoPtr += 1;
|
||||
|
||||
if (((FxU32)fifoPtr) & 0x7) {
|
||||
@@ -859,7 +859,7 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
const float *fb = (const float *)vb + xindex;
|
||||
const float *fc = (const float *)vc + xindex;
|
||||
float dxAB, dxBC, dyAB, dyBC;
|
||||
int i,j;
|
||||
int i;
|
||||
union { float f; int i; } ay;
|
||||
union { float f; int i; } by;
|
||||
union { float f; int i; } cy;
|
||||
@@ -947,12 +947,11 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
GR_SETF( hw->FvB.y, snap_yb );
|
||||
|
||||
/* this is where we store the area */
|
||||
_GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.pool.temp1.f = dxAB * dyBC - dxBC * dyAB;
|
||||
_GlideRoot.stats.trisProcessed++;
|
||||
|
||||
/* Zero-area triangles are BAD!! */
|
||||
j = *(long *)&_GlideRoot.pool.ftemp1;
|
||||
if ((j & 0x7FFFFFFF) == 0) {
|
||||
if ((_GlideRoot.pool.temp1.i & 0x7FFFFFFF) == 0) {
|
||||
GR_CHECK_SIZE_SLOPPY();
|
||||
return 0;
|
||||
}
|
||||
@@ -992,7 +991,7 @@ GR_DDFUNC(_trisetup_nogradients, FxI32, ( const void *va, const void *vb, const
|
||||
}
|
||||
|
||||
/* Draw the triangle by writing the area to the triangleCMD register */
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
|
||||
P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.temp1.f ) );
|
||||
_GlideRoot.stats.trisDrawn++;
|
||||
|
||||
GR_CHECK_SIZE();
|
||||
|
||||
@@ -1049,7 +1049,14 @@ typedef struct sstregs { // THE CHIP
|
||||
#define GET16(s) s
|
||||
#define SET(d,s) d = s
|
||||
#define SET16(d,s) d = s
|
||||
#define SETF(d,s) (*(float *)&(d)) = s
|
||||
#define SETF(d,s) *((float *)((void *)(&(d)))) = s
|
||||
/*
|
||||
do { \
|
||||
union { float f; FxU32 u; } uni; \
|
||||
uni.f = s; \
|
||||
d = uni.u; \
|
||||
} while(0)
|
||||
*/
|
||||
|
||||
// SET macros for FBI
|
||||
#define SET_FBI(d,s) SET (*(&(d)+0x100),s)
|
||||
|
||||
@@ -105,8 +105,8 @@
|
||||
#define IGET(A) A
|
||||
#define ISET(A,D) A = (D)
|
||||
#else
|
||||
#define IGET(A) sst1InitRead32((FxU32 *) &(A))
|
||||
#define ISET(A,D) sst1InitWrite32((FxU32 *) &(A), D)
|
||||
#define IGET(A) sst1InitRead32((FxU32 *)(void *)&(A))
|
||||
#define ISET(A,D) sst1InitWrite32((FxU32 *)(void *)&(A), D)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user