Mesa (master): r300g: don' t set sample positions to the pixel center if MSAA is disabled

Marek Olšák mareko at kemper.freedesktop.org
Thu Jan 10 14:40:45 UTC 2013


Module: Mesa
Branch: master
Commit: 2f89949b666889a61196657511b1dee4418ae865
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f89949b666889a61196657511b1dee4418ae865

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Jan 10 15:23:56 2013 +0100

r300g: don't set sample positions to the pixel center if MSAA is disabled

but an MSAA resource is bound. This effectively makes the MSAA disable switch
not affect rasterization, but it still affects the alpha-to-one and
alpha-to-coverage states. This hardware just lacks a proper MSAA disable
switch.

This fixes graphics corruption in sauerbraten.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59194

---

 src/gallium/drivers/r300/r300_emit.c    |   12 ++++--------
 src/gallium/drivers/r300/r300_state.c   |    2 --
 src/gallium/drivers/r300/r300_texture.c |    2 +-
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 825038a..cb6c46e 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -566,7 +566,7 @@ void r300_emit_fb_state_pipelined(struct r300_context *r300,
 
     struct pipe_framebuffer_state* fb =
             (struct pipe_framebuffer_state*)r300->fb_state.state;
-    unsigned i, num_samples, num_cbufs = fb->nr_cbufs;
+    unsigned i, num_cbufs = fb->nr_cbufs;
     unsigned mspos0, mspos1;
     CS_LOCALS(r300);
 
@@ -593,14 +593,10 @@ void r300_emit_fb_state_pipelined(struct r300_context *r300,
         OUT_CS(R300_US_OUT_FMT_UNUSED);
     }
 
-    /* Multisampling. Depends on framebuffer sample count.
-     * These are pipelined regs and as such cannot be moved
-     * to the AA state.
+    /* Set sample positions. It depends on the framebuffer sample count.
+     * These are pipelined regs and as such cannot be moved to the AA state.
      */
-    num_samples = r300->msaa_enable ? r300->num_samples : 1;
-
-    /* Sample positions. */
-    switch (num_samples) {
+    switch (r300->num_samples) {
     default:
         mspos0 = r300_get_mspos(0, sample_locs_1x);
         mspos1 = r300_get_mspos(1, sample_locs_1x);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 1e7cff9..4a5a5a8 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1309,8 +1309,6 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     }
 
     if (last_msaa_enable != r300->msaa_enable) {
-        r300_mark_atom_dirty(r300, &r300->fb_state_pipelined);
-
         if (r300->alpha_to_coverage) {
             r300_mark_atom_dirty(r300, &r300->dsa_state);
         }
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 4eb9a23..4be6d50 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -1002,7 +1002,7 @@ r300_texture_create_object(struct r300_screen *rscreen,
     }
 
     if (SCREEN_DBG_ON(rscreen, DBG_MSAA) && base->nr_samples > 1) {
-        fprintf(stderr, "r300: %i MSAA %s buffer created\n",
+        fprintf(stderr, "r300: %ix MSAA %s buffer created\n",
                 base->nr_samples,
                 util_format_is_depth_or_stencil(base->format) ? "depth" : "color");
     }




More information about the mesa-commit mailing list