diff options
author | Brian Paul <[email protected]> | 2008-09-05 10:16:27 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-09-05 10:16:27 -0600 |
commit | a267934b23aca1c39d228c23392862f8068c2968 (patch) | |
tree | 8be86f7c2a2b0ce32af9a06de661f49fdbc0a93d /src/gallium/drivers/cell/ppu | |
parent | a1886d539158fcc692d0d45985465be8e4bbe077 (diff) |
cell: convert clear color if needed
Diffstat (limited to 'src/gallium/drivers/cell/ppu')
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_clear.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index 207c96b9f6d..c9c0c721bbe 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -35,6 +35,7 @@ #include <stdint.h> #include "pipe/p_inlines.h" #include "util/u_memory.h" +#include "util/u_pack_color.h" #include "cell/common.h" #include "cell_clear.h" #include "cell_context.h" @@ -45,6 +46,24 @@ /** + * Convert packed pixel from one format to another. + */ +static unsigned +convert_color(enum pipe_format srcFormat, unsigned srcColor, + enum pipe_format dstFormat) +{ + ubyte r, g, b, a; + unsigned dstColor; + + util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a); + util_pack_color_ub(r, g, b, a, dstFormat, &dstColor); + + return dstColor; +} + + + +/** * Called via pipe->clear() */ void @@ -70,6 +89,11 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, else { /* clear color buffer */ surfIndex = 0; + + if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) { + clearValue = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue, + ps->format); + } } |