summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2003-12-09 16:09:24 +0000
committerKeith Whitwell <[email protected]>2003-12-09 16:09:24 +0000
commit425deefdd04fbc58aa1c357697ce602ff3013516 (patch)
tree18002a8fcfecaf7ec079e1fcc0c9b5bdaa194586 /src/mesa/drivers
parent8592ba94b85b3f0f93ae875eece259b4626a6759 (diff)
Fix VERT_SET_RGBA, VERT_SET_SPEC macros to account for change to floating
point colors throughout mesa.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i830/i830_tris.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_tris.c b/src/mesa/drivers/dri/i830/i830_tris.c
index 66720c1efc4..285287422ba 100644
--- a/src/mesa/drivers/dri/i830/i830_tris.c
+++ b/src/mesa/drivers/dri/i830/i830_tris.c
@@ -216,25 +216,6 @@ static struct {
#define VERTEX i830Vertex
#define TAB rast_tab
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define I830_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define I830_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-
#define DEPTH_SCALE (imesa->depth_scale)
#define UNFILLED_TRI unfilled_tri
#define UNFILLED_QUAD unfilled_quad
@@ -244,13 +225,36 @@ do { \
#define AREA_IS_CCW( a ) (a > 0)
#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
-#define VERT_SET_RGBA( v, c ) I830_COLOR( v->ub4[coloroffset], c )
+#define VERT_SET_RGBA( v, c ) \
+do { \
+ i830_color_t *color = (i830_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_SET_SPEC( v, c ) if (havespec) I830_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]