summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-14 16:37:13 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-14 16:37:13 -0700
commitc28b112ce37022aa6e00ac4557ad6fe5a57ae578 (patch)
tree45cc38765c4fbafea9f6ce51681b759a01b7b556 /src/mesa
parenteff70f67c558c90c5419b43729a6dc8a9a8c47ec (diff)
clamp colors during float->int conversion
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/cell/spu/spu_tri.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/mesa/pipe/cell/spu/spu_tri.c
index b42b321c32..ddd5e662d2 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/mesa/pipe/cell/spu/spu_tri.c
@@ -236,6 +236,10 @@ pack_color(const float color[4])
uint g = (uint) (color[1] * 255.0);
uint b = (uint) (color[2] * 255.0);
uint a = (uint) (color[3] * 255.0);
+ r = MIN2(r, 255);
+ g = MIN2(g, 255);
+ b = MIN2(b, 255);
+ a = MIN2(a, 255);
switch (spu.fb.color_format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
return (a << 24) | (r << 16) | (g << 8) | b;