diff options
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r128/r128_vb.c')
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_vb.c | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c index cf89f6b39..eb04e4473 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c @@ -2,7 +2,7 @@ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., - Cedar Park, Texas. + Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -46,32 +46,32 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define TEX0 \ do { \ - v->v.tu0 = tc0[i][0]; \ - v->v.tv0 = tc0[i][1]; \ + v->vert1.tu0 = tc0[i][0]; \ + v->vert1.tv0 = tc0[i][1]; \ } while (0) #define TEX1 \ do { \ - v->v.tu1 = tc1[i][0]; \ - v->v.tv1 = tc1[i][1]; \ + v->vert2.tu1 = tc1[i][0]; \ + v->vert2.tv1 = tc1[i][1]; \ } while (0) #define SPC \ do { \ GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->v.spec_frgb.r = spec[0]; \ - v->v.spec_frgb.g = spec[1]; \ - v->v.spec_frgb.b = spec[2]; \ + v->vert1.spec_frgb.r = spec[0]; \ + v->vert1.spec_frgb.g = spec[1]; \ + v->vert1.spec_frgb.b = spec[2]; \ } while (0) #define COL \ do { \ GLubyte *col = &(VB->Color[0]->data[i][0]); \ - v->v.dif_argb.a = col[3]; \ - v->v.dif_argb.r = col[0]; \ - v->v.dif_argb.g = col[1]; \ - v->v.dif_argb.b = col[2]; \ + v->vert1.dif_argb.a = col[3]; \ + v->vert1.dif_argb.r = col[0]; \ + v->vert1.dif_argb.g = col[1]; \ + v->vert1.dif_argb.b = col[2]; \ } while (0) #if 1 @@ -86,9 +86,9 @@ do { \ v = &(R128_DRIVER_DATA(VB)->verts[start]); \ for (i = start; i < end; i++, v++) { \ float oow = 1.0 / tc[i][3]; \ - v->v.rhw *= tc[i][3]; \ - v->v.tu0 *= oow; \ - v->v.tv0 *= oow; \ + v->vert1.rhw *= tc[i][3]; \ + v->vert1.tu0 *= oow; \ + v->vert1.tv0 *= oow; \ } \ } \ } while (0) @@ -101,9 +101,9 @@ do { \ v = &(R128_DRIVER_DATA(VB)->verts[start]); \ for (i = start; i < end; i++, v++) { \ float oow = 1.0 / tc[i][3]; \ - v->v.rhw2 *= tc[i][3]; \ - v->v.tu1 *= oow; \ - v->v.tv1 *= oow; \ + v->vert3.rhw2 *= tc[i][3]; \ + v->vert3.tu1 *= oow; \ + v->vert3.tv1 *= oow; \ } \ } \ } while (0) @@ -116,19 +116,19 @@ do { \ #define COORD \ do { \ GLfloat *win = VB->Win.data[i]; \ - v->v.x = win[0]; \ - v->v.y = r128height - win[1]; \ - v->v.z = scale * win[2]; \ - v->v.rhw = v->v.rhw2 = win[3]; \ + v->vert3.x = win[0]; \ + v->vert3.y = r128height - win[1]; \ + v->vert3.z = scale * win[2]; \ + v->vert3.rhw = v->vert3.rhw2 = win[3]; \ } while (0) #else #define COORD \ do { \ GLfloat *win = VB->Win.data[i]; \ - v->v.x = win[0]; \ - v->v.y = r128height - win[1]; \ - v->v.z = scale * win[2]; \ - v->v.rhw = win[3]; \ + v->vert1.x = win[0]; \ + v->vert1.y = r128height - win[1]; \ + v->vert1.z = scale * win[2]; \ + v->vert1.rhw = win[3]; \ } while (0) #endif @@ -144,23 +144,16 @@ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ GLfloat (*tc0)[4]; \ GLfloat (*tc1)[4]; \ GLfloat r128height = dPriv->h; \ - GLfloat scale; \ + GLfloat scale = r128ctx->depth_scale; \ int i; \ \ - (void) r128height; (void) r128ctx; \ + (void) r128height; (void) r128ctx; (void) scale; \ \ gl_import_client_data(VB, VB->ctx->RenderFlags, \ (VB->ClipOrMask \ ? VEC_WRITABLE | VEC_GOOD_STRIDE \ : VEC_GOOD_STRIDE)); \ \ - switch (VB->ctx->Visual->DepthBits) { \ - case 16: scale = 1.0 / 65536.0; break; \ - case 24: scale = 1.0 / 16777216.0; break; \ - case 32: scale = 1.0 / 4294967296.0; break; \ - default: scale = 1.0 / 65536.0; break; \ - } \ - \ tc0 = VB->TexCoordPtr[0]->data; \ tc1 = VB->TexCoordPtr[1]->data; \ \ @@ -264,14 +257,28 @@ void r128ChooseRasterSetupFunc(GLcontext *ctx) r128ContextPtr r128ctx = R128_CONTEXT(ctx); int funcIndex = R128_WIN_BIT | R128_RGBA_BIT; - if (ctx->Texture.Enabled & 0xf) { + r128ctx->vertsize = 8; + r128ctx->vc_format = R128_TEX0_VERTEX_FORMAT; + r128ctx->multitex = 0; + + if (ctx->Texture.Enabled & ENABLE_TEX0) { if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) funcIndex &= ~R128_RGBA_BIT; funcIndex |= R128_TEX0_BIT; } - if (ctx->Texture.Enabled & 0xf0) + if (ctx->Texture.Enabled & ENABLE_TEX1) { + /* GTH: we should really only enable the second texture unit + * when we're doing true multitexturing. I guess there aren't + * that many cases where apps will only bind a texture to the + * second texture unit, but it would definitely be a performance + * win in those cases. + */ + r128ctx->vertsize = 10; + r128ctx->vc_format = R128_TEX1_VERTEX_FORMAT; + r128ctx->multitex = 1; funcIndex |= R128_TEX1_BIT; + } /* FIXME: Verify this works properly */ if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) |