u_blitter: add a msaa parameter to util_blitter_clear
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 22 Jul 2019 14:14:20 +0000 (16:14 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 23 Jul 2019 18:42:20 +0000 (14:42 -0400)
Fixes: ea5b7de138b ("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>
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_blitter.h
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/radeonsi/si_clear.c
src/gallium/drivers/svga/svga_pipe_clear.c
src/gallium/drivers/v3d/v3dx_draw.c
src/gallium/drivers/vc4/vc4_draw.c

index 396e23294a6e1dcbf02e2520292a4d94e1f0aaee..8d6909ec4261b4ad7ebdf8ebeb08927b0e168726 100644 (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,
index a7c931c01cad0ee81530d0399e0daaa8ab9d2160..a57e09f5fd1fa76f6d906d90ea9065e13390a1c2 100644 (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
index 4ac2589a9a716fc68782142f402fb97aaa858f27..cda702e78f27533f78b3f8e9107ed403828ed402 100644 (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 ||
index 34075f687afb17fd7bcc9fd469519f96adeb0dfe..84f265b189ba2a4ad1ad567b284835d29df2b5a7 100644 (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 */
index 0e8808b6c13aeb91184ed1ea2dd504d37744633b..a83f65c6f1be5cb5cbcca9e834816b82413f7c1c 100644 (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) {
index d1287178c56a1dd251b6208b550e51c70c947dce..6aa74d5b69aba724374d96a1a654db6b5f7b8be8 100644 (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);
 }
 
 
index 744d0c9c2119744536963dc517924e1f64202629..ff34b8d049bb102b3fd337ce5e7ca3573e16f9e1 100644 (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);
 }
 
 /**
index df95c313f34c9851da51a9594506c69dc2d99566..5ac658c27ae4fa4274ce565cf813702386482a86 100644 (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;