diff options
author | Marek Olšák <[email protected]> | 2013-07-01 02:57:21 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-07-08 20:25:18 +0200 |
commit | 87669c3654fa22491fed68781d31cdec75c2a96c (patch) | |
tree | 408a1f8fad00e0f3474f67a90b4c2239a7ae91c6 | |
parent | 085c695488acc3408bf455ea3f97517a68cad714 (diff) |
r600g: implement fast MSAA color clear for integer textures
this also fixes the fast clear with multiple colorbuffers and each having
a different format
Reviewed-by: Alex Deucher <[email protected]>
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 1cdd1c81109..3b8a28b7fe8 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -416,17 +416,22 @@ static boolean is_simple_msaa_resolve(const struct pipe_blit_info *info) static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned offset, unsigned size, unsigned char value); -static void evergreen_set_clear_color(struct pipe_context *ctx, - struct pipe_surface *cbuf, +static void evergreen_set_clear_color(struct pipe_surface *cbuf, const union pipe_color_union *color) { - struct r600_context *rctx = (struct r600_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer.state; unsigned *clear_value = ((struct r600_texture *)cbuf->texture)->color_clear_value; union util_color uc; memset(&uc, 0, sizeof(uc)); - util_pack_color(color->f, fb->cbufs[0]->format, &uc); + + if (util_format_is_pure_uint(cbuf->format)) { + util_format_write_4ui(cbuf->format, color->ui, 0, &uc, 0, 0, 0, 1, 1); + } else if (util_format_is_pure_sint(cbuf->format)) { + util_format_write_4i(cbuf->format, color->i, 0, &uc, 0, 0, 0, 1, 1); + } else { + util_pack_color(color->f, cbuf->format, &uc); + } + memcpy(clear_value, &uc, 2 * sizeof(uint32_t)); } @@ -448,10 +453,8 @@ static bool can_fast_clear_color(struct pipe_context *ctx) return false; } - /* cannot pack color for pure integer formats */ /* 128-bit formats are unuspported */ - if (util_format_is_pure_integer(fb->cbufs[i]->format) || - util_format_get_blocksizebits(fb->cbufs[i]->format) > 64) { + if (util_format_get_blocksizebits(fb->cbufs[i]->format) > 64) { return false; } @@ -479,7 +482,7 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers, for (i = 0; i < fb->nr_cbufs; i++) { struct r600_texture *tex = (struct r600_texture *)fb->cbufs[i]->texture; - evergreen_set_clear_color(ctx, fb->cbufs[i], color); + evergreen_set_clear_color(fb->cbufs[i], color); r600_clear_buffer(ctx, fb->cbufs[i]->texture, tex->cmask_offset, tex->cmask_size, 0); tex->dirty_level_mask |= 1 << fb->cbufs[i]->u.tex.level; |