Mesa (master): r300g: fix color channel masks
Corbin Simpson
csimpson at kemper.freedesktop.org
Sun Feb 7 07:49:45 UTC 2010
Module: Mesa
Branch: master
Commit: c8b34616b345d7a64d39e0ea3d4f4006af0b9740
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8b34616b345d7a64d39e0ea3d4f4006af0b9740
Author: Marek Olšák <maraeo at gmail.com>
Date: Fri Feb 5 07:07:22 2010 +0100
r300g: fix color channel masks
glean/maskedClear passes again.
---
src/gallium/drivers/r300/r300_state.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index a5c0869..ca4d25a 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -155,6 +155,15 @@ static boolean blend_discard_if_src_alpha_color_1(unsigned srcRGB, unsigned srcA
dstA == PIPE_BLENDFACTOR_ONE);
}
+static unsigned bgra_cmask(unsigned mask)
+{
+ /* Gallium uses RGBA color ordering while R300 expects BGRA. */
+
+ return ((mask & PIPE_MASK_R) << 2) |
+ ((mask & PIPE_MASK_B) >> 2) |
+ (mask & (PIPE_MASK_G | PIPE_MASK_A));
+}
+
/* Create a new blend state based on the CSO blend state.
*
* This encompasses alpha blending, logic/raster ops, and blend dithering. */
@@ -290,16 +299,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
}
/* Color channel masks for all MRTs. */
- blend->color_channel_mask = state->rt[0].colormask;
+ blend->color_channel_mask = bgra_cmask(state->rt[0].colormask);
if (r300screen->caps->is_r500 && state->independent_blend_enable) {
if (state->rt[1].blend_enable) {
- blend->color_channel_mask |= (state->rt[1].colormask << 4);
+ blend->color_channel_mask |= bgra_cmask(state->rt[1].colormask) << 4;
}
if (state->rt[2].blend_enable) {
- blend->color_channel_mask |= (state->rt[2].colormask << 8);
+ blend->color_channel_mask |= bgra_cmask(state->rt[2].colormask) << 8;
}
if (state->rt[3].blend_enable) {
- blend->color_channel_mask |= (state->rt[3].colormask << 12);
+ blend->color_channel_mask |= bgra_cmask(state->rt[3].colormask) << 12;
}
}
More information about the mesa-commit
mailing list