From d811446e6cf0a3e9ad0cc4f5898db33031698c32 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 22 Jul 2019 14:02:14 +0200 Subject: [PATCH] u_blitter: enable msaa when dst num samples is > 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/gallium/auxiliary/util/u_blitter.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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, -- 2.7.4