summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-28 17:32:23 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-28 18:18:46 -0700
commit25105276b38451439516928d188e07f2eb3e250e (patch)
treebf28d7d0d0f48be97afeb2eda2548f832eacbb16
parent425f270fcbfdbfce98adaf9da4b8eb7360f34447 (diff)
Cell: minor optimization for flat shading
-rw-r--r--src/mesa/pipe/cell/spu/spu_tri.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/mesa/pipe/cell/spu/spu_tri.c
index aad28f1036f..19a231d9c4d 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/mesa/pipe/cell/spu/spu_tri.c
@@ -200,16 +200,35 @@ static INLINE void
eval_coeff( struct setup_stage *setup, uint slot,
float x, float y, float result[4][4])
{
- uint i;
- const float *dadx = setup->coef[slot].dadx;
- const float *dady = setup->coef[slot].dady;
+ switch (spu.vertex_info.interp_mode[slot]) {
+ case INTERP_CONSTANT:
+ {
+ uint i;
+ for (i = 0; i < 4; i++) {
+ result[QUAD_TOP_LEFT][i] =
+ result[QUAD_TOP_RIGHT][i] =
+ result[QUAD_BOTTOM_LEFT][i] =
+ result[QUAD_BOTTOM_RIGHT][i] = setup->coef[slot].a0[i];
+ }
+ }
+ break;
- /* loop over XYZW comps */
- for (i = 0; i < 4; i++) {
- result[QUAD_TOP_LEFT][i] = setup->coef[slot].a0[i] + x * dadx[i] + y * dady[i];
- result[QUAD_TOP_RIGHT][i] = result[0][i] + dadx[i];
- result[QUAD_BOTTOM_LEFT][i] = result[0][i] + dady[i];
- result[QUAD_BOTTOM_RIGHT][i] = result[0][i] + dadx[i] + dady[i];
+ case INTERP_LINEAR:
+ /* fall-through, for now */
+ default:
+ {
+ uint i;
+ const float *dadx = setup->coef[slot].dadx;
+ const float *dady = setup->coef[slot].dady;
+
+ /* loop over XYZW comps */
+ for (i = 0; i < 4; i++) {
+ result[QUAD_TOP_LEFT][i] = setup->coef[slot].a0[i] + x * dadx[i] + y * dady[i];
+ result[QUAD_TOP_RIGHT][i] = result[0][i] + dadx[i];
+ result[QUAD_BOTTOM_LEFT][i] = result[0][i] + dady[i];
+ result[QUAD_BOTTOM_RIGHT][i] = result[0][i] + dadx[i] + dady[i];
+ }
+ }
}
}