diff options
author | gareth <gareth> | 2001-05-01 03:57:57 +0000 |
---|---|---|
committer | gareth <gareth> | 2001-05-01 03:57:57 +0000 |
commit | f7f03669307de4cf8ca3bcd5059bf53e29f5ca27 (patch) | |
tree | aa06f384909aa707f07ccd165cd99077c73741a9 | |
parent | 099a980420ce1fbe8c190587f42e069b0cc05fb6 (diff) |
Fix blend modes with destination alpha (Steven Fuller).X_4_0_99_3-20010501-preimport
-rw-r--r-- | xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c | 59 |
2 files changed, 31 insertions, 30 deletions
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c index 00341ac7a..d1103ca73 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -47,7 +47,7 @@ #include "X86/common_x86_asm.h" #endif -#define TDFX_DATE "20010321" +#define TDFX_DATE "20010501" /* These are used in calls to FX_grColorMaskv() */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c index 289ecde4d..ecc876c54 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c @@ -60,6 +60,7 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) GrCmpFnc_t func; GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA; GrAlpha_t ref = ctx->Color.AlphaRef; + const int hasAlpha = ctx->Visual->AlphaBits > 0; if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { fprintf( stderr, "%s()\n", __FUNCTION__ ); @@ -119,13 +120,13 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; break; case GL_DST_ALPHA: - srcRGB = GR_BLEND_DST_ALPHA; + srcRGB = hasAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE; break; case GL_ONE_MINUS_DST_ALPHA: - srcRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + srcRGB = hasAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO; break; case GL_SRC_ALPHA_SATURATE: - srcRGB = GR_BLEND_ALPHA_SATURATE; + srcRGB = hasAlpha ? GR_BLEND_ALPHA_SATURATE : GR_BLEND_ZERO; break; default: srcRGB = GR_BLEND_ONE; @@ -138,23 +139,23 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) case GL_ONE: srcA = GR_BLEND_ONE; break; - case GL_DST_COLOR: - srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + case GL_DST_COLOR: /* Napalm only */ + srcA = hasAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE; break; - case GL_ONE_MINUS_DST_COLOR: - srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_DST_COLOR: /* Napalm only */ + srcA = hasAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO; break; - case GL_SRC_ALPHA: - srcA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + case GL_SRC_ALPHA: /* Napalm only */ + srcA = GR_BLEND_SRC_ALPHA; break; - case GL_ONE_MINUS_SRC_ALPHA: - srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_SRC_ALPHA: /* Napalm only */ + srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; break; - case GL_DST_ALPHA: - srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + case GL_DST_ALPHA: /* Napalm only */ + srcA = hasAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE; break; - case GL_ONE_MINUS_DST_ALPHA: - srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_DST_ALPHA: /* Napalm only */ + srcA = hasAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO; break; case GL_SRC_ALPHA_SATURATE: srcA = GR_BLEND_ONE; @@ -183,10 +184,10 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; break; case GL_DST_ALPHA: - dstRGB = GR_BLEND_DST_ALPHA; + dstRGB = hasAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE; break; case GL_ONE_MINUS_DST_ALPHA: - dstRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + dstRGB = hasAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO; break; default: dstRGB = GR_BLEND_ZERO; @@ -199,23 +200,23 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) case GL_ONE: dstA = GR_BLEND_ONE; break; - case GL_SRC_COLOR: - dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + case GL_SRC_COLOR: /* Napalm only */ + dstA = GR_BLEND_SRC_ALPHA; break; - case GL_ONE_MINUS_SRC_COLOR: - dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_SRC_COLOR: /* Napalm only */ + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; break; - case GL_SRC_ALPHA: - dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + case GL_SRC_ALPHA: /* Napalm only */ + dstA = GR_BLEND_SRC_ALPHA; break; - case GL_ONE_MINUS_SRC_ALPHA: - dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_SRC_ALPHA: /* Napalm only */ + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; break; - case GL_DST_ALPHA: - dstA = GR_BLEND_DST_ALPHA; /* Napalm only */ + case GL_DST_ALPHA: /* Napalm only */ + dstA = hasAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE; break; - case GL_ONE_MINUS_DST_ALPHA: - dstA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + case GL_ONE_MINUS_DST_ALPHA: /* Napalm only */ + dstA = hasAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO; break; default: dstA = GR_BLEND_ZERO; |