diff options
author | Rob Clark <[email protected]> | 2017-01-14 07:59:42 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-01-22 14:10:42 -0500 |
commit | 16671e970444f154ffa60d2aaadee4d065eb6103 (patch) | |
tree | c55a2dac378ddbd5b4c217113bb1102a0f6c08fa /src/gallium/drivers/freedreno | |
parent | 4d9aa4f67d6316feea93901bf29b76a68c4333cd (diff) |
freedreno/a5xx: fix clear for uint/sint formats
Signed-off-by: Rob Clark <[email protected]>
Cc: "17.0" <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_draw.c | 47 |
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)); |