summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_draw.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
index ffd3e3b765d..7a2fafcf913 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
@@ -214,35 +214,44 @@ fd5_clear(struct fd_context *ctx, unsigned buffers,
if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
continue;
+ enum pipe_format pfmt = pfb->cbufs[i]->format;
+
// XXX I think RB_CLEAR_COLOR_DWn wants to take into account SWAP??
- float f[4];
- switch (fd5_pipe2swap(pfb->cbufs[i]->format)) {
+ union pipe_color_union swapped;
+ switch (fd5_pipe2swap(pfmt)) {
case WZYX:
- f[0] = color->f[0];
- f[1] = color->f[1];
- f[2] = color->f[2];
- f[3] = color->f[3];
+ swapped.ui[0] = color->ui[0];
+ swapped.ui[1] = color->ui[1];
+ swapped.ui[2] = color->ui[2];
+ swapped.ui[3] = color->ui[3];
break;
case WXYZ:
- f[2] = color->f[0];
- f[1] = color->f[1];
- f[0] = color->f[2];
- f[3] = color->f[3];
+ swapped.ui[2] = color->ui[0];
+ swapped.ui[1] = color->ui[1];
+ swapped.ui[0] = color->ui[2];
+ swapped.ui[3] = color->ui[3];
break;
case ZYXW:
- f[3] = color->f[0];
- f[0] = color->f[1];
- f[1] = color->f[2];
- f[2] = color->f[3];
+ swapped.ui[3] = color->ui[0];
+ swapped.ui[0] = color->ui[1];
+ swapped.ui[1] = color->ui[2];
+ swapped.ui[2] = color->ui[3];
break;
case XYZW:
- f[3] = color->f[0];
- f[2] = color->f[1];
- f[1] = color->f[2];
- f[0] = color->f[3];
+ swapped.ui[3] = color->ui[0];
+ swapped.ui[2] = color->ui[1];
+ swapped.ui[1] = color->ui[2];
+ swapped.ui[0] = color->ui[3];
break;
}
- util_pack_color(f, pfb->cbufs[i]->format, &uc);
+
+ if (util_format_is_pure_uint(pfmt)) {
+ util_format_write_4ui(pfmt, swapped.ui, 0, &uc, 0, 0, 0, 1, 1);
+ } else if (util_format_is_pure_sint(pfmt)) {
+ util_format_write_4i(pfmt, swapped.i, 0, &uc, 0, 0, 0, 1, 1);
+ } else {
+ util_pack_color(swapped.f, pfmt, &uc);
+ }
OUT_PKT4(ring, REG_A5XX_RB_BLIT_CNTL, 1);
OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(BLIT_MRT0 + i));