u_blitter: enable msaa when dst num samples is > 1

Commit ea5b7de138 broke some piglit tests on radeonsi (Bonaire hardware).
This commit fixes half of the regression by enabling msaa if the dest surface has
more than 1 sample (instead of hardcoding it to false).

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 14:02:14 +02:00 committed by Marek Olšák
parent ae392d73c9
commit d811446e6c

View file

@ -2235,6 +2235,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
bool msaa;
unsigned num_layers;
assert(dstsurf->texture);
@ -2261,6 +2262,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
fb_state.zsbuf = 0;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
msaa = util_framebuffer_get_num_samples(&fb_state) > 1;
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
@ -2269,12 +2271,12 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
if (num_layers > 1 && ctx->has_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_layered,
dstx, dsty, dstx+width, dsty+height, 0,
num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
} else {
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_passthrough_pos_generic,
dstx, dsty, dstx+width, dsty+height, 0,
@ -2413,7 +2415,8 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, sample_mask);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_common_draw_rect_state(ctx, false,
util_framebuffer_get_num_samples(&fb_state) > 1);
blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height);
blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_passthrough_pos,
0, 0, zsurf->width, zsurf->height, depth,
@ -2613,7 +2616,8 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
fb_state.zsbuf = NULL;
pipe->set_framebuffer_state(pipe, &fb_state);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_common_draw_rect_state(ctx, false,
util_framebuffer_get_num_samples(&fb_state) > 1);
blitter_set_dst_dimensions(ctx, src->width0, src->height0);
blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_passthrough_pos,
0, 0, src->width0, src->height0,
@ -2663,7 +2667,8 @@ void util_blitter_custom_color(struct blitter_context *blitter,
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_common_draw_rect_state(ctx, false,
util_framebuffer_get_num_samples(&fb_state) > 1);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_passthrough_pos,
0, 0, dstsurf->width, dstsurf->height,
@ -2725,7 +2730,8 @@ void util_blitter_custom_shader(struct blitter_context *blitter,
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_common_draw_rect_state(ctx, false,
util_framebuffer_get_num_samples(&fb_state) > 1);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, ctx->velem_state, get_custom_vs,
0, 0, dstsurf->width, dstsurf->height,