Francisco Jerez
2009-Oct-05 04:47 UTC
[Nouveau] [PATCH] nv10/exa: Allow component-alpha masks.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- src/nv10_exa.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/nv10_exa.c b/src/nv10_exa.c index 71184b1..62cc9aa 100644 --- a/src/nv10_exa.c +++ b/src/nv10_exa.c @@ -97,8 +97,6 @@ static Bool NV10CheckTexture(PicturePtr Picture) return FALSE; if (Picture->filter != PictFilterNearest && Picture->filter != PictFilterBilinear) return FALSE; - if (Picture->componentAlpha) - return FALSE; /* we cannot repeat on NV10 because NPOT textures do not support this. unfortunately. */ if (Picture->repeat != RepeatNone) /* we can repeat 1x1 textures */ @@ -114,8 +112,6 @@ static Bool NV10CheckBuffer(PicturePtr Picture) if ((w > 4096) || (h > 4096)) return FALSE; - if (Picture->componentAlpha) - return FALSE; if (!NV10DstFormat(Picture->format)) return FALSE; return TRUE; @@ -513,12 +509,14 @@ unsigned int color0 = 0, color1 = 0; if ( ! mask ) rc0_in_rgb |= B_RGB_ONE; - else - if ( mask->format == PICT_x8r8g8b8 ) /*no alpha? ignore it*/ - rc0_in_rgb |= B_RGB_ONE; - else - rc0_in_rgb |= 0x00190000; /*B = a_1*/ - + else if (mask->componentAlpha && PICT_FORMAT_RGB(mask->format)) + rc0_in_rgb |= 0x00090000; /*B = rgb_1*/ + else if (PICT_FORMAT_A(mask->format)) + rc0_in_rgb |= 0x00190000; /*B = a_1*/ + else /*no alpha? ignore it*/ + rc0_in_rgb |= B_RGB_ONE; + + BEGIN_RING(chan, celcius, NV10TCL_RC_IN_ALPHA(0), 6); OUT_RING (chan, rc0_in_alpha); OUT_RING (chan, rc1_in_alpha); -- 1.6.3.3
Francisco Jerez
2009-Oct-05 13:46 UTC
[Nouveau] [PATCHv2] nv10/exa: Allow component-alpha masks.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- v2: Remove some useless whitespace I had accidentally introduced. src/nv10_exa.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/nv10_exa.c b/src/nv10_exa.c index 71184b1..6d6e33b 100644 --- a/src/nv10_exa.c +++ b/src/nv10_exa.c @@ -97,8 +97,6 @@ static Bool NV10CheckTexture(PicturePtr Picture) return FALSE; if (Picture->filter != PictFilterNearest && Picture->filter != PictFilterBilinear) return FALSE; - if (Picture->componentAlpha) - return FALSE; /* we cannot repeat on NV10 because NPOT textures do not support this. unfortunately. */ if (Picture->repeat != RepeatNone) /* we can repeat 1x1 textures */ @@ -114,8 +112,6 @@ static Bool NV10CheckBuffer(PicturePtr Picture) if ((w > 4096) || (h > 4096)) return FALSE; - if (Picture->componentAlpha) - return FALSE; if (!NV10DstFormat(Picture->format)) return FALSE; return TRUE; @@ -513,12 +509,13 @@ unsigned int color0 = 0, color1 = 0; if ( ! mask ) rc0_in_rgb |= B_RGB_ONE; - else - if ( mask->format == PICT_x8r8g8b8 ) /*no alpha? ignore it*/ - rc0_in_rgb |= B_RGB_ONE; - else - rc0_in_rgb |= 0x00190000; /*B = a_1*/ - + else if (mask->componentAlpha && PICT_FORMAT_RGB(mask->format)) + rc0_in_rgb |= 0x00090000; /*B = rgb_1*/ + else if (PICT_FORMAT_A(mask->format)) + rc0_in_rgb |= 0x00190000; /*B = a_1*/ + else /*no alpha? ignore it*/ + rc0_in_rgb |= B_RGB_ONE; + BEGIN_RING(chan, celcius, NV10TCL_RC_IN_ALPHA(0), 6); OUT_RING (chan, rc0_in_alpha); OUT_RING (chan, rc1_in_alpha); -- 1.6.3.3