diff options
Diffstat (limited to 'src/mesa/drivers/glide/fxvbtmp.h')
-rw-r--r-- | src/mesa/drivers/glide/fxvbtmp.h | 111 |
1 files changed, 55 insertions, 56 deletions
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index 0133758295c..8d7649c6bb0 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -27,17 +27,18 @@ */ -static void NAME(GLcontext *ctx, GLuint start, GLuint end ) +static void +NAME(GLcontext * ctx, GLuint start, GLuint end) { - fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; fxVertex *verts = fxMesa->verts; struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint tmu0_source = fxMesa->tmu_source[0]; GLuint tmu1_source = fxMesa->tmu_source[1]; - GLfloat (*tmu0_data)[4]; - GLfloat (*tmu1_data)[4]; - GLubyte (*color)[4]; - GLfloat (*proj)[4] = VB->ProjectedClipPtr->data; + GLfloat(*tmu0_data)[4]; + GLfloat(*tmu1_data)[4]; + GLubyte(*color)[4]; + GLfloat(*proj)[4] = VB->ProjectedClipPtr->data; fxVertex *v = &verts[start]; GLfloat sscale0 = fxMesa->s0scale; GLfloat tscale0 = fxMesa->t0scale; @@ -45,36 +46,36 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end ) GLfloat tscale1 = fxMesa->t1scale; GLubyte *clipmask = VB->ClipMask; GLuint i; - const GLfloat * const s = ctx->Viewport._WindowMap.m; + const GLfloat *const s = ctx->Viewport._WindowMap.m; if (IND & SETUP_TMU0) tmu0_data = VB->TexCoordPtr[tmu0_source]->data; if (IND & SETUP_TMU1) tmu1_data = VB->TexCoordPtr[tmu1_source]->data; - + if (IND & SETUP_RGBA) color = VB->ColorPtr[0]->data; if (VB->ClipOrMask) { - for (i = start ; i < end ; i++, v++) { + for (i = start; i < end; i++, v++) { if (!clipmask[i]) { if (IND & SETUP_XYZW) { - v->v.x = s[0] * proj[i][0] + s[12]; - v->v.y = s[5] * proj[i][1] + s[13]; - v->v.ooz = s[10] * proj[i][2] + s[14]; - v->v.oow = proj[i][3]; - + v->v.x = s[0] * proj[i][0] + s[12]; + v->v.y = s[5] * proj[i][1] + s[13]; + v->v.ooz = s[10] * proj[i][2] + s[14]; + v->v.oow = proj[i][3]; + if (IND & SETUP_SNAP) { #if defined(USE_IEEE) - const float snapper = (3L<<18); - v->v.x += snapper; - v->v.x -= snapper; - v->v.y += snapper; - v->v.y -= snapper; + const float snapper = (3L << 18); + v->v.x += snapper; + v->v.x -= snapper; + v->v.y += snapper; + v->v.y -= snapper; #else - v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f); - v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f); + v->v.x = ((int) (v->v.x * 16.0f)) * (1.0f / 16.0f); + v->v.y = ((int) (v->v.y * 16.0f)) * (1.0f / 16.0f); #endif } } @@ -85,34 +86,34 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end ) UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]); } if (IND & SETUP_TMU0) { - v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow; - v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow; + v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow; + v->v.tmuvtx[0].tow = tscale0 * tmu0_data[i][1] * v->v.oow; } if (IND & SETUP_TMU1) { - v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow; - v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow; + v->v.tmuvtx[1].sow = sscale1 * tmu1_data[i][0] * v->v.oow; + v->v.tmuvtx[1].tow = tscale1 * tmu1_data[i][1] * v->v.oow; } } } } else { - for (i = start ; i < end ; i++, v++) { + for (i = start; i < end; i++, v++) { if (IND & SETUP_XYZW) { - v->v.x = s[0] * proj[i][0] + s[12]; - v->v.y = s[5] * proj[i][1] + s[13]; - v->v.ooz = s[10] * proj[i][2] + s[14]; - v->v.oow = proj[i][3]; - + v->v.x = s[0] * proj[i][0] + s[12]; + v->v.y = s[5] * proj[i][1] + s[13]; + v->v.ooz = s[10] * proj[i][2] + s[14]; + v->v.oow = proj[i][3]; + if (IND & SETUP_SNAP) { #if defined(USE_IEEE) - const float snapper = (3L<<18); - v->v.x += snapper; - v->v.x -= snapper; - v->v.y += snapper; - v->v.y -= snapper; + const float snapper = (3L << 18); + v->v.x += snapper; + v->v.x -= snapper; + v->v.y += snapper; + v->v.y -= snapper; #else - v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f); - v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f); + v->v.x = ((int) (v->v.x * 16.0f)) * (1.0f / 16.0f); + v->v.y = ((int) (v->v.y * 16.0f)) * (1.0f / 16.0f); #endif } } @@ -123,29 +124,27 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end ) UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]); } if (IND & SETUP_TMU0) { - v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow; - v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow; + v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow; + v->v.tmuvtx[0].tow = tscale0 * tmu0_data[i][1] * v->v.oow; } if (IND & SETUP_TMU1) { - v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow; - v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow; + v->v.tmuvtx[1].sow = sscale1 * tmu1_data[i][0] * v->v.oow; + v->v.tmuvtx[1].tow = tscale1 * tmu1_data[i][1] * v->v.oow; } } } - + if ((IND & SETUP_XYZW) && - ctx->ProjectionMatrix.m[15] != 0.0F && - ctx->Fog.Enabled) - { - fx_fake_fog_w( ctx, v, VB, start, end ); + ctx->ProjectionMatrix.m[15] != 0.0F && ctx->Fog.Enabled) { + fx_fake_fog_w(ctx, v, VB, start, end); } /* Check for and enable projective texturing in each texture unit. */ - if (IND & (SETUP_TMU0|SETUP_TMU1)) { + if (IND & (SETUP_TMU0 | SETUP_TMU1)) { GLuint tmu0_sz = 2; GLuint tmu1_sz = 2; - GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | + GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | GR_STWHINT_W_DIFF_TMU1); if (VB->TexCoordPtr[tmu0_source]) @@ -155,15 +154,15 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end ) tmu1_sz = VB->TexCoordPtr[tmu1_source]->size; if (tmu0_sz == 4) { - project_texcoords( v, VB, 0, tmu0_source, start, end ); + project_texcoords(v, VB, 0, tmu0_source, start, end); if (tmu1_sz == 4) - project_texcoords( v, VB, 1, tmu1_source, start, end ); - else - copy_w( v, VB, 1, start, end ); - hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1); - } + project_texcoords(v, VB, 1, tmu1_source, start, end); + else + copy_w(v, VB, 1, start, end); + hs |= (GR_STWHINT_W_DIFF_TMU0 | GR_STWHINT_W_DIFF_TMU1); + } else if (tmu1_sz == 4) { - project_texcoords( v, VB, 1, tmu1_source, start, end ); + project_texcoords(v, VB, 1, tmu1_source, start, end); hs |= GR_STWHINT_W_DIFF_TMU1; } |