Skip to content
Snippets Groups Projects
Commit cfe14ab3 authored by Rob Clark's avatar Rob Clark :speech_balloon: Committed by Emil Velikov
Browse files

freedreno/a5xx: fix clear for uint/sint formats


Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 16671e97)
parent 250b1cad
No related branches found
No related tags found
No related merge requests found
...@@ -214,35 +214,44 @@ fd5_clear(struct fd_context *ctx, unsigned buffers, ...@@ -214,35 +214,44 @@ fd5_clear(struct fd_context *ctx, unsigned buffers,
if (!(buffers & (PIPE_CLEAR_COLOR0 << i))) if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
continue; continue;
enum pipe_format pfmt = pfb->cbufs[i]->format;
// XXX I think RB_CLEAR_COLOR_DWn wants to take into account SWAP?? // XXX I think RB_CLEAR_COLOR_DWn wants to take into account SWAP??
float f[4]; union pipe_color_union swapped;
switch (fd5_pipe2swap(pfb->cbufs[i]->format)) { switch (fd5_pipe2swap(pfmt)) {
case WZYX: case WZYX:
f[0] = color->f[0]; swapped.ui[0] = color->ui[0];
f[1] = color->f[1]; swapped.ui[1] = color->ui[1];
f[2] = color->f[2]; swapped.ui[2] = color->ui[2];
f[3] = color->f[3]; swapped.ui[3] = color->ui[3];
break; break;
case WXYZ: case WXYZ:
f[2] = color->f[0]; swapped.ui[2] = color->ui[0];
f[1] = color->f[1]; swapped.ui[1] = color->ui[1];
f[0] = color->f[2]; swapped.ui[0] = color->ui[2];
f[3] = color->f[3]; swapped.ui[3] = color->ui[3];
break; break;
case ZYXW: case ZYXW:
f[3] = color->f[0]; swapped.ui[3] = color->ui[0];
f[0] = color->f[1]; swapped.ui[0] = color->ui[1];
f[1] = color->f[2]; swapped.ui[1] = color->ui[2];
f[2] = color->f[3]; swapped.ui[2] = color->ui[3];
break; break;
case XYZW: case XYZW:
f[3] = color->f[0]; swapped.ui[3] = color->ui[0];
f[2] = color->f[1]; swapped.ui[2] = color->ui[1];
f[1] = color->f[2]; swapped.ui[1] = color->ui[2];
f[0] = color->f[3]; swapped.ui[0] = color->ui[3];
break; 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_PKT4(ring, REG_A5XX_RB_BLIT_CNTL, 1);
OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(BLIT_MRT0 + i)); OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(BLIT_MRT0 + i));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment