summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-29 11:22:57 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-29 11:23:44 -0700
commit7f2713a29ff46a608de0feac2f56f034dbc738cb (patch)
tree96e28e0331dc7e3e201f9a06c4b7d53b1da0510f /src
parent1aaed3856878a39beb5aab0402d2adb8b277e812 (diff)
Cell: use _pack_rgba8() from pack_rgba8.h to do float[4]->uint color conversion
texcyl.c is twice as fast now in non-texture mode
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/cell/spu/spu_tri.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/mesa/pipe/cell/spu/spu_tri.c
index 19a231d9c4..7c6a54134f 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/mesa/pipe/cell/spu/spu_tri.c
@@ -29,6 +29,8 @@
* Triangle rendering within a tile.
*/
+#include <pack_rgba8.h>
+
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "pipe/p_util.h"
@@ -38,7 +40,6 @@
#include "spu_tri.h"
-
/**
* Simplified types taken from other parts of Gallium
*/
@@ -252,19 +253,11 @@ eval_z( struct setup_stage *setup,
static INLINE uint
pack_color(const float color[4])
{
- uint r = (uint) (color[0] * 255.0);
- 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;
+ return _pack_rgba8(color[3], color[0], color[1], color[2]);
case PIPE_FORMAT_B8G8R8A8_UNORM:
- return (b << 24) | (g << 16) | (r << 8) | a;
+ return _pack_rgba8(color[2], color[1], color[0], color[3]);
default:
ASSERT(0);
return 0;