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
This commit is contained in:
Marek Olšák 2013-01-10 15:23:56 +01:00
parent 9a07b6bd74
commit 2f89949b66
3 changed files with 5 additions and 11 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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");
}