From: Pierre-Eric Pelloux-Prayer Date: Mon, 22 Jul 2019 12:02:14 +0000 (+0200) Subject: u_blitter: enable msaa when dst num samples is > 1 X-Git-Tag: upstream/19.3.0~3844 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d811446e6cf0a3e9ad0cc4f5898db33031698c32;p=platform%2Fupstream%2Fmesa.git u_blitter: enable msaa when dst num samples is > 1 Commit ea5b7de138b 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: ea5b7de138b ("radeonsi: make gl_SampleMaskIn = 0x1 when MSAA is disabled") Tested-by: Michel Dänzer Reviewed-by: Marek Olšák --- diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index b072677..396e232 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -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,