u_blitter: add a msaa parameter to util_blitter_clear

Fixes: ea5b7de138 ("radeonsi: make gl_SampleMaskIn = 0x1 when MSAA is disabled")

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2019-07-22 16:14:20 +02:00
committed by Marek Olšák
parent d811446e6c
commit e9cf8c1d30
8 changed files with 22 additions and 13 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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 ||

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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);
}
/**

View File

@@ -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;