diff options
author | Eric Anholt <[email protected]> | 2019-11-08 14:49:44 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-04 19:02:59 +0000 |
commit | ab081970e07d97c4218a68341d8534693d27e474 (patch) | |
tree | 39f28c58c4474e40ec007485b52bccdb6a90da6b /src/gallium/drivers/freedreno | |
parent | b2a2cf492decf35e1e2c622e3c45e98333ec15d7 (diff) |
gallium: Add and use a helper for packing uc from a color_union.
The same pattern kept coming up, and we don't need to hit
util_format_write_4* to do it when we have util_format_pack_rgba().
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2744>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_draw.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_gmem.c | 8 |
2 files changed, 2 insertions, 14 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c index eec4de98d94..579d1cdaf88 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c @@ -318,13 +318,7 @@ fd5_clear(struct fd_context *ctx, unsigned buffers, break; } - 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); - } + util_pack_color_union(pfmt, &uc, &swapped); OUT_PKT4(ring, REG_A5XX_RB_BLIT_CNTL, 1); OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(BLIT_MRT0 + i)); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index b6f1d5f2281..c28eff3c082 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -1052,13 +1052,7 @@ emit_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) break; } - 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); - } + util_pack_color_union(pfmt, &uc, &swapped); OUT_PKT4(ring, REG_A6XX_RB_BLIT_DST_INFO, 1); OUT_RING(ring, A6XX_RB_BLIT_DST_INFO_TILE_MODE(TILE6_LINEAR) | |