diff options
author | Keith Whitwell <[email protected]> | 2004-12-29 12:48:50 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2004-12-29 12:48:50 +0000 |
commit | 3b486d795d0aa5384846aabf0669b25b95e521b1 (patch) | |
tree | c3f359af7d85da22c6677f632c88267a8aa79d37 /src | |
parent | 13ae06cf36f9d04c0a04cdc19196f400d7a8c642 (diff) |
Get twoside-lit triangles working again
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_tris.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index 7bb850372dc..4f9a9647716 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -230,14 +230,39 @@ static struct { #define AREA_IS_CCW(a) (a > 0) #define GET_VERTEX(e) (vmesa->verts + (e * vmesa->vertexSize * sizeof(int))) -#define VERT_SET_RGBA(v, c) VIA_COLOR(v->ub4[coloroffset], c) -#define VERT_COPY_RGBA(v0, v1) v0->ui[coloroffset] = v1->ui[coloroffset] -#define VERT_SAVE_RGBA(idx) color[idx] = v[idx]->ui[coloroffset] -#define VERT_RESTORE_RGBA(idx) v[idx]->ui[coloroffset] = color[idx] -#define VERT_SET_SPEC(v, c) if (havespec) VIA_SPEC(v->ub4[5], c) -#define VERT_COPY_SPEC(v0, v1) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5]) -#define VERT_SAVE_SPEC(idx) if (havespec) spec[idx] = v[idx]->ui[5] -#define VERT_RESTORE_SPEC(idx) if (havespec) v[idx]->ui[5] = spec[idx] +#define VERT_SET_RGBA( v, c ) \ +do { \ + via_color_t *color = (via_color_t *)&((v)->ui[coloroffset]); \ + UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \ + UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \ + UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \ + UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \ +} while (0) + +#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset] + +#define VERT_SET_SPEC( v0, c ) \ +do { \ + if (havespec) { \ + UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \ + UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \ + UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \ + } \ +} while (0) +#define VERT_COPY_SPEC( v0, v1 ) \ +do { \ + if (havespec) { \ + v0->v.specular.red = v1->v.specular.red; \ + v0->v.specular.green = v1->v.specular.green; \ + v0->v.specular.blue = v1->v.specular.blue; \ + } \ +} while (0) + + +#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset] +#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx] +#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5] +#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx] #define LOCAL_VARS(n) \ |