[Mesa-dev] multisample clears

Dave Airlie airlied at gmail.com
Sun Mar 3 19:54:01 PST 2013


I've been playing with softpipe msaa on and off, but I hit a problem
with the clears and am just wondering if the state tracker should be
doing something like this.

Or maybe only if any bound buffer has nr_samples > 1, or fallback to
the non-quad draw method.

I can't see how else the driver could distinguish a multisample clear.

The other problem I have and not figuring out is if rendering to a
buffer with multisample off, then turning it on is meant to be
meaningful, if you have to clear
the buffer in between, then with this fixed it should be cool.

Dave.

>From e1ee59d87ba42d8a58be640ee1fd2b952414f45e Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied at redhat.com>
Date: Mon, 4 Mar 2013 13:39:17 +1000
Subject: [PATCH] st/mesa: enable multisample in clear quad code

Not sure if this is correct at all
---
 src/mesa/state_tracker/st_cb_clear.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_clear.c
b/src/mesa/state_tracker/st_cb_clear.c
index 4aa0bc1..649d7bd 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -282,7 +282,14 @@ clear_with_quad(struct gl_context *ctx,
    cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
    cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
    cso_set_sample_mask(st->cso_context, ~0);
-   cso_set_rasterizer(st->cso_context, &st->clear.raster);
+
+   {
+      struct pipe_rasterizer_state rs = st->clear.raster;
+
+      if (st->ctx->Multisample.Enabled)
+         rs.multisample = 1;
+      cso_set_rasterizer(st->cso_context, &rs);
+   }

    /* viewport state: viewport matching window dims */
    {
-- 
1.8.1.2


More information about the mesa-dev mailing list