summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_clear.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2009-12-07 20:35:42 +0100
committerRoland Scheidegger <sroland@vmware.com>2009-12-07 20:35:42 +0100
commit3456f9149b3009fcfce80054759d05883d3c4ee5 (patch)
treee584ac25fa3bbe29c15ab06eae1dccdf3dbf708a /src/gallium/drivers/softpipe/sp_clear.c
parentc36d1aacf4c70d76165c91cd7048c0f9f43b8571 (diff)
gallium/util: fix util_color_[un]pack[-ub] to be strict aliasing safe
use pointer to union instead of void pointer. gcc complained a lot, depending what the pointer originally actually was. Looks like it's in fact maybe legal to cast for instance uint pointers to union pointers as long as union contains a uint type, hence use this with some callers, other just use union util_color in the first place.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_clear.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c
index 8fac8e6e05..f98087deb8 100644
--- a/src/gallium/drivers/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
@@ -48,6 +48,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
double depth, unsigned stencil)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ union util_color uc;
unsigned cv;
uint i;
@@ -62,12 +63,12 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
- util_pack_color(rgba, ps->format, &cv);
- sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);
+ util_pack_color(rgba, ps->format, &uc);
+ sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui);
#if !TILE_CLEAR_OPTIMIZATION
/* non-cached surface */
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
#endif
}
}