From: Marek Olšák Date: Thu, 10 Jan 2013 14:23:56 +0000 (+0100) Subject: r300g: don't set sample positions to the pixel center if MSAA is disabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f89949b666889a61196657511b1dee4418ae865;p=mesa.git 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 --- diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 825038a9dc9..cb6c46e5e6c 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 1e7cff91f9a..4a5a5a89b84 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 4eb9a230790..4be6d5067d2 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"); }