From e9cf8c1d3010e9eada5a7921239ad7895f249b5c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 22 Jul 2019 16:14:20 +0200 Subject: [PATCH] u_blitter: add a msaa parameter to util_blitter_clear MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: ea5b7de138b ("radeonsi: make gl_SampleMaskIn = 0x1 when MSAA is disabled") Tested-by: Michel Dänzer Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_blitter.c | 14 ++++++++------ src/gallium/auxiliary/util/u_blitter.h | 3 ++- src/gallium/drivers/r300/r300_blit.c | 3 ++- src/gallium/drivers/r600/r600_blit.c | 3 ++- src/gallium/drivers/radeonsi/si_clear.c | 3 ++- src/gallium/drivers/svga/svga_pipe_clear.c | 3 ++- src/gallium/drivers/v3d/v3dx_draw.c | 3 ++- src/gallium/drivers/vc4/vc4_draw.c | 3 ++- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 396e23294a6..8d6909ec426 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1451,7 +1451,8 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, unsigned clear_buffers, const union pipe_color_union *color, double depth, unsigned stencil, - void *custom_blend, void *custom_dsa) + void *custom_blend, void *custom_dsa, + bool msaa) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; @@ -1477,7 +1478,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, if (num_layers > 1 && ctx->has_layered) { blitter_get_vs_func get_vs = get_vs_layered; - blitter_set_common_draw_rect_state(ctx, false, false); + blitter_set_common_draw_rect_state(ctx, false, msaa); blitter->draw_rectangle(blitter, ctx->velem_state, get_vs, 0, 0, width, height, (float) depth, num_layers, type, &attrib); @@ -1489,7 +1490,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, else get_vs = get_vs_passthrough_pos; - blitter_set_common_draw_rect_state(ctx, false, false); + blitter_set_common_draw_rect_state(ctx, false, msaa); blitter->draw_rectangle(blitter, ctx->velem_state, get_vs, 0, 0, width, height, (float) depth, 1, type, &attrib); @@ -1505,11 +1506,12 @@ void util_blitter_clear(struct blitter_context *blitter, unsigned width, unsigned height, unsigned num_layers, unsigned clear_buffers, const union pipe_color_union *color, - double depth, unsigned stencil) + double depth, unsigned stencil, + bool msaa) { util_blitter_clear_custom(blitter, width, height, num_layers, clear_buffers, color, depth, stencil, - NULL, NULL); + NULL, NULL, msaa); } void util_blitter_custom_clear_depth(struct blitter_context *blitter, @@ -1518,7 +1520,7 @@ void util_blitter_custom_clear_depth(struct blitter_context *blitter, { static const union pipe_color_union color; util_blitter_clear_custom(blitter, width, height, 0, 0, &color, depth, 0, - NULL, custom_dsa); + NULL, custom_dsa, false); } void util_blitter_default_dst_texture(struct pipe_surface *dst_templ, diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index a7c931c01ca..a57e09f5fd1 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -204,7 +204,8 @@ void util_blitter_clear(struct blitter_context *blitter, unsigned width, unsigned height, unsigned num_layers, unsigned clear_buffers, const union pipe_color_union *color, - double depth, unsigned stencil); + double depth, unsigned stencil, + bool msaa); /** * Check if the blitter (with the help of the driver) can blit between diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 4ac2589a9a7..cda702e78f2 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -366,7 +366,8 @@ static void r300_clear(struct pipe_context* pipe, /* Clear using the blitter. */ r300_blitter_begin(r300, R300_CLEAR); util_blitter_clear(r300->blitter, width, height, 1, - buffers, color, depth, stencil); + buffers, color, depth, stencil, + util_framebuffer_get_num_samples(fb) > 1); r300_blitter_end(r300); } else if (r300->zmask_clear.dirty || r300->hiz_clear.dirty || diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 34075f687af..84f265b189b 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -522,7 +522,8 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers, r600_blitter_begin(ctx, R600_CLEAR); util_blitter_clear(rctx->blitter, fb->width, fb->height, util_framebuffer_get_num_layers(fb), - buffers, color, depth, stencil); + buffers, color, depth, stencil, + util_framebuffer_get_num_samples(fb) > 1); r600_blitter_end(ctx); /* disable fast clear */ diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c index 0e8808b6c13..a83f65c6f1b 100644 --- a/src/gallium/drivers/radeonsi/si_clear.c +++ b/src/gallium/drivers/radeonsi/si_clear.c @@ -663,7 +663,8 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers, si_blitter_begin(sctx, SI_CLEAR); util_blitter_clear(sctx->blitter, fb->width, fb->height, util_framebuffer_get_num_layers(fb), - buffers, color, depth, stencil); + buffers, color, depth, stencil, + sctx->framebuffer.nr_samples > 1); si_blitter_end(sctx); if (sctx->db_depth_clear) { diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c index d1287178c56..6aa74d5b69a 100644 --- a/src/gallium/drivers/svga/svga_pipe_clear.c +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -77,7 +77,8 @@ clear_buffers_with_quad(struct svga_context *svga, fb->width, fb->height, 1, /* num_layers */ clear_buffers, color, - depth, stencil); + depth, stencil, + util_framebuffer_get_num_samples(fb) > 1); } diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 744d0c9c211..ff34b8d049b 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -947,7 +947,8 @@ v3d_draw_clear(struct v3d_context *v3d, v3d->framebuffer.width, v3d->framebuffer.height, util_framebuffer_get_num_layers(&v3d->framebuffer), - buffers, color, depth, stencil); + buffers, color, depth, stencil, + util_framebuffer_get_num_samples(&v3d->framebuffer) > 1); } /** diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c index df95c313f34..5ac658c27ae 100644 --- a/src/gallium/drivers/vc4/vc4_draw.c +++ b/src/gallium/drivers/vc4/vc4_draw.c @@ -578,7 +578,8 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers, vc4->framebuffer.height, 1, zsclear, - &dummy_color, depth, stencil); + &dummy_color, depth, stencil, + false); buffers &= ~zsclear; if (!buffers) return; -- 2.30.2