summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/sis
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2003-12-09 16:14:24 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2003-12-09 16:14:24 +0000
commit9556a5286730aa6839b9aa7cbbb2fe815a318e28 (patch)
treee01d9effd7da7e8940d5ab2135477c0223e91660 /src/mesa/drivers/dri/sis
parent425deefdd04fbc58aa1c357697ce602ff3013516 (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/dri/sis')
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index abe6a3fb07..6c7865f6c4 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -267,31 +267,36 @@ static struct {
#define AREA_IS_CCW( a ) (a > 0)
#define GET_VERTEX(e) (smesa->verts + (e << smesa->vertex_stride_shift))
-#define VERT_SET_RGBA( v, c ) \
- do { \
- sis_color_t *vc = (sis_color_t *)&(v)->ui[coloroffset]; \
- vc->blue = (c)[2]; \
- vc->green = (c)[1]; \
- vc->red = (c)[0]; \
- vc->alpha = (c)[3]; \
- } while (0)
+#define VERT_SET_RGBA( v, c ) \
+do { \
+ sis_color_t *color = (sis_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_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SET_SPEC( v0, c ) \
- if (havespec) { \
- (v0)->v.specular.red = (c)[0]; \
- (v0)->v.specular.green = (c)[1]; \
- (v0)->v.specular.blue = (c)[2]; \
- }
+#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 ) \
- 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; \
- }
+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]