diff options
author | Marek Olšák <maraeo@gmail.com> | 2013-02-01 20:59:38 +0100 |
---|---|---|
committer | Andreas Boll <andreas.boll.dev@gmail.com> | 2013-02-13 21:48:37 +0100 |
commit | fdfb299c22318ad54520de86fade5754848f8366 (patch) | |
tree | c41ee1234a1feb46aa3f2f78a1f4991503197538 | |
parent | 2389fcc8025458e4872b83feb72727ab38f07f33 (diff) |
r300g: fix blending with blend color and RGBA formats
NOTE: This is a candidate for the stable branches.
(cherry picked from commit f40a7fc34a601195191b1b2ffef55818a4086d5f)
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0467e91439..8a87aa876e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -467,6 +467,7 @@ static void r300_set_blend_color(struct pipe_context* pipe, (struct r300_blend_color_state*)r300->blend_color_state.state; struct pipe_blend_color c; enum pipe_format format = fb->nr_cbufs ? fb->cbufs[0]->format : 0; + float tmp; CB_LOCALS; state->state = *color; /* Save it, so that we can reuse it in set_fb_state */ @@ -493,6 +494,13 @@ static void r300_set_blend_color(struct pipe_context* pipe, c.color[2] = c.color[3]; break; + case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: + tmp = c.color[0]; + c.color[0] = c.color[2]; + c.color[2] = tmp; + break; + default:; } } @@ -903,6 +911,9 @@ r300_set_framebuffer_state(struct pipe_context* pipe, /* Need to reset clamping or colormask. */ r300_mark_atom_dirty(r300, &r300->blend_state); + /* Re-swizzle the blend color. */ + r300_set_blend_color(pipe, &((struct r300_blend_color_state*)r300->blend_color_state.state)->state); + /* If zsbuf is set from NULL to non-NULL or vice versa.. */ if (!!old_state->zsbuf != !!state->zsbuf) { r300_mark_atom_dirty(r300, &r300->dsa_state); |