aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-05-20 12:27:39 -0600
committerBrian <[email protected]>2007-05-20 12:27:39 -0600
commit9e8a961dd7d7b717a9fb4ecdea1c1b60ea355efe (patch)
tree60c87644ec38f4693ceecbf440b120b02e2d07e6 /src/mesa/drivers/dri
parentaa133a9dae53bc6aa50b88ee43deb8b34e8d0029 (diff)
Overhaul/simplify SWvertex and SWspan attribute handling.
Instead of separate fog/specular/texcoord/varying code, just treat all of them as generic attributes. Simplifies the point/line/triangle functions.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tris.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_native_vb.c18
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tritmp.h46
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tris.c16
4 files changed, 44 insertions, 44 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_tris.c b/src/mesa/drivers/dri/ffb/ffb_tris.c
index ca0e514dc0e..9fae8c8283e 100644
--- a/src/mesa/drivers/dri/ffb/ffb_tris.c
+++ b/src/mesa/drivers/dri/ffb/ffb_tris.c
@@ -138,10 +138,10 @@ static void ffb_translate_vertex(GLcontext *ctx, const ffb_vertex *src,
const GLfloat ty = m[13];
const GLfloat tz = m[14];
- dst->win[0] = sx * src->x + tx;
- dst->win[1] = sy * src->y + ty;
- dst->win[2] = sz * src->z + tz;
- dst->win[3] = 1.0;
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = sx * src->x + tx;
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = sy * src->y + ty;
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = sz * src->z + tz;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
dst->color[0] = FFB_UBYTE_FROM_COLOR(src->color[0].red);
dst->color[1] = FFB_UBYTE_FROM_COLOR(src->color[0].green);
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
index 81bcf802c71..75cf0e2ed2d 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
@@ -44,7 +44,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
UNVIEWPORT_VARS;
CARD32 *p = (CARD32 *)src + 10 - mmesa->vertex_size;
- dst->win[3] = 1.0;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
switch ( format ) {
case TEX1_VERTEX_FORMAT:
@@ -75,17 +75,17 @@ void TAG(translate_vertex)(GLcontext *ctx,
dst->attrib[FRAG_ATTRIB_TEX0][1] = LE32_IN_FLOAT( p++ );
#endif
dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
- dst->win[3] = LE32_IN_FLOAT( p++ );
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = LE32_IN_FLOAT( p++ );
case NOTEX_VERTEX_FORMAT:
- dst->specular[2] = ((GLubyte *)p)[0];
- dst->specular[1] = ((GLubyte *)p)[1];
- dst->specular[0] = ((GLubyte *)p)[2];
- dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3];
+ dst->attrib[FRAG_ATTRIB_COL1][2] = UBYTE_TO_FLOAT(((GLubyte *)p)[0]);
+ dst->attrib[FRAG_ATTRIB_COL1][1] = UBYTE_TO_FLOAT(((GLubyte *)p)[1]);
+ dst->attrib[FRAG_ATTRIB_COL1][0] = UBYTE_TO_FLOAT(((GLubyte *)p)[2]);
+ dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3]; /*XXX int->float?*/
p++;
case TINY_VERTEX_FORMAT:
- dst->win[2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
dst->color[2] = ((GLubyte *)p)[0];
dst->color[1] = ((GLubyte *)p)[1];
@@ -96,8 +96,8 @@ void TAG(translate_vertex)(GLcontext *ctx,
{
GLuint xy = LE32_IN( p );
- dst->win[0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
- dst->win[1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
}
}
diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h
index 696fc02250f..2321bd414ff 100644
--- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h
+++ b/src/mesa/drivers/dri/s3v/s3v_tritmp.h
@@ -43,12 +43,12 @@
#define SORT_LINE_VERT() \
do { \
- if(v[0].win[1] <= v[1].win[1]) { \
+ if(v[0].attrib[FRAG_ATTRIB_WPOS][1] <= v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \
\
idx[0] = 0; \
idx[1] = 1; \
\
- } else if (v[0].win[1] > v[1].win[1]) { \
+ } else if (v[0].attrib[FRAG_ATTRIB_WPOS][1] > v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \
\
idx[0] = 1; \
idx[1] = 0; \
@@ -58,19 +58,19 @@ do { \
#define SET_LINE_VERT() \
do { \
- x[0] = (v[idx[0]].win[0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[0] = fy[0] = dPriv->h - v[idx[0]].win[1]; \
- z[0] = (v[idx[0]].win[2]) * 1024.0f * 32.0f; /* 0x8000; */ \
+ x[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \
+ y[0] = fy[0] = dPriv->h - v[idx[0]].attrib[FRAG_ATTRIB_WPOS][1]; \
+ z[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000; */ \
\
- x[1] = (v[idx[1]].win[0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[1] = dPriv->h - v[idx[1]].win[1]; \
- z[1] = (v[idx[1]].win[2]) * 1024.0f * 32.0f; /* 0x8000 */ \
+ x[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \
+ y[1] = dPriv->h - v[idx[1]].attrib[FRAG_ATTRIB_WPOS][1]; \
+ z[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000 */ \
} while(0)
#define SET_LINE_XY() \
do { \
- tmp = v[idx[0]].win[0]; \
- tmp2 = v[idx[1]].win[0]; \
+ tmp = v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0]; \
+ tmp2 = v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0]; \
\
dx01 = x[0] - x[1]; \
dy01 = y[0] - y[1]; \
@@ -265,7 +265,7 @@ do { \
#define SORT_VERT() \
do { \
for (i=0; i<3; i++) \
- fy[i] = v[i].win[1]; \
+ fy[i] = v[i].attrib[FRAG_ATTRIB_WPOS][1]; \
\
if (fy[1] > fy[0]) { /* (fy[1] > fy[0]) */ \
\
@@ -305,9 +305,9 @@ do { \
do { \
for (i=0; i<3; i++) \
{ \
- x[i] = ((v[idx[i]].win[0]) * /* 0x100000*/ 1024.0 * 1024.0); \
- y[i] = fy[i] = (dPriv->h - v[idx[i]].win[1]); \
- z[i] = ((v[idx[i]].win[2]) * /* 0x8000 */ 1024.0 * 32.0); \
+ x[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][0]) * /* 0x100000*/ 1024.0 * 1024.0); \
+ y[i] = fy[i] = (dPriv->h - v[idx[i]].attrib[FRAG_ATTRIB_WPOS][1]); \
+ z[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][2]) * /* 0x8000 */ 1024.0 * 32.0); \
} \
\
ydiff = fy[0] - (float)y[0]; \
@@ -420,9 +420,9 @@ do { \
v2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1] \
* (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
\
- w0 = (v[idx[0]].win[3]); \
- w1 = (v[idx[1]].win[3]); \
- w2 = (v[idx[2]].win[3]); \
+ w0 = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][3]); \
+ w1 = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][3]); \
+ w2 = (v[idx[2]].attrib[FRAG_ATTRIB_WPOS][3]); \
} while (0)
#define SET_BASEUV() \
@@ -732,8 +732,8 @@ DEBUG(("***\n"));
#if (IND & S3V_RAST_CULL_BIT)
cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
+ ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
+ (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
if (cull < vmesa->cull_zero /* -0.02f */) return;
#endif
@@ -842,8 +842,8 @@ static void TAG(s3v_quad)( s3vContextPtr vmesa,
#if (IND & S3V_RAST_CULL_BIT)
cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
+ ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
+ (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
if (cull < vmesa->cull_zero /* -0.02f */) goto second; /* return; */ /* (a) */
#endif
@@ -897,8 +897,8 @@ second:
#if (IND & S3V_RAST_CULL_BIT)
cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
+ ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
+ (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
if (cull < /* -0.02f */ vmesa->cull_zero) return;
#endif
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
index 4ba2f40b9e8..96f9ae27fc1 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
@@ -142,10 +142,10 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (fxMesa->vertexFormat == TDFX_LAYOUT_TINY) {
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = 1.0;
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = src->x - fxMesa->x_offset;
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = src->z;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
dst->color[0] = src->color[2];
dst->color[1] = src->color[1];
@@ -155,10 +155,10 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
else {
GLfloat w = 1.0 / src->rhw;
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = src->rhw;
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = src->x - fxMesa->x_offset;
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = src->z;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = src->rhw;
dst->color[0] = src->color[2];
dst->color[1] = src->color[1];