diff options
author | Jonathan Marek <[email protected]> | 2019-08-12 11:43:26 -0400 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2019-11-25 20:23:22 +0100 |
commit | 5159db60fccf17b00b8da4257dac027b6e2327ef (patch) | |
tree | f2d13d1756afb992ef2f5a8ddf1e777355f42f3f /src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | |
parent | 2214f99c07abe119c1e657999a875b7ae7e6c2de (diff) |
etnaviv: implement 64bpp clear
At the same time, update etna_clear_blit_pack_rgba to work with integer
formats.
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_clear_blit.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index 51d16aa19f7..42dc50e2dff 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -66,15 +66,29 @@ etna_blit_save_state(struct etna_context *ctx) ctx->num_fragment_sampler_views, ctx->sampler_view); } -uint32_t -etna_clear_blit_pack_rgba(enum pipe_format format, const float *rgba) +uint64_t +etna_clear_blit_pack_rgba(enum pipe_format format, const union pipe_color_union *color) { union util_color uc; - util_pack_color(rgba, format, &uc); - if (util_format_get_blocksize(format) == 2) - return uc.ui[0] << 16 | (uc.ui[0] & 0xffff); - else - return uc.ui[0]; + + if (util_format_is_pure_uint(format)) { + util_format_write_4ui(format, color->ui, 0, &uc, 0, 0, 0, 1, 1); + } else if (util_format_is_pure_sint(format)) { + util_format_write_4i(format, color->i, 0, &uc, 0, 0, 0, 1, 1); + } else { + util_pack_color(color->f, format, &uc); + } + + switch (util_format_get_blocksize(format)) { + case 1: + uc.ui[0] = uc.ui[0] << 8 | (uc.ui[0] & 0xff); + case 2: + uc.ui[0] = uc.ui[0] << 16 | (uc.ui[0] & 0xffff); + case 4: + uc.ui[1] = uc.ui[0]; + default: + return (uint64_t) uc.ui[1] << 32 | uc.ui[0]; + } } static void |