From f6cdaa9c81611f03f6e1eb2e4a5920b858f1673f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 Oct 2004 21:37:08 +0000 Subject: [PATCH] Add support for NV_blend_square, and print errors if an unsupported blend function is used. --- src/mesa/drivers/dri/sis/sis_context.c | 1 + src/mesa/drivers/dri/sis/sis_dd.c | 2 +- src/mesa/drivers/dri/sis/sis_state.c | 34 +++++++++++++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index a9b791f1011..0d15bfa5e90 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -65,6 +65,7 @@ static const char * const card_extensions[] = { "GL_ARB_multitexture", "GL_EXT_texture_lod_bias", + "GL_NV_blend_square", NULL }; diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index 010e1c5739b..4049a106b60 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -44,7 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" -#define DRIVER_DATE "20040925" +#define DRIVER_DATE "20041008" /* Return the width and height of the given buffer. */ diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index 422059b86b1..2cca1611df7 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -107,9 +107,7 @@ sisDDBlendFuncSeparate( GLcontext *ctx, __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; - /* TODO: in ICD, if no blend, it will reset these value */ - /* blending enable */ - current->hwDstSrcBlend = 0x10000; /* Default destination alpha */ + current->hwDstSrcBlend = 0; switch (dfactorRGB) { @@ -131,12 +129,21 @@ sisDDBlendFuncSeparate( GLcontext *ctx, case GL_ONE_MINUS_SRC_ALPHA: current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_ALPHA; break; + case GL_DST_COLOR: + current->hwDstSrcBlend |= SiS_D_DST_COLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_COLOR; + break; case GL_DST_ALPHA: current->hwDstSrcBlend |= SiS_D_DST_ALPHA; break; case GL_ONE_MINUS_DST_ALPHA: current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_ALPHA; break; + default: + fprintf(stderr, "Unknown dst blend function 0x%x\n", dfactorRGB); + break; } switch (sfactorRGB) @@ -147,27 +154,36 @@ sisDDBlendFuncSeparate( GLcontext *ctx, case GL_ONE: current->hwDstSrcBlend |= SiS_S_ONE; break; + case GL_SRC_COLOR: + current->hwDstSrcBlend |= SiS_S_SRC_COLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_COLOR; + break; case GL_SRC_ALPHA: current->hwDstSrcBlend |= SiS_S_SRC_ALPHA; break; case GL_ONE_MINUS_SRC_ALPHA: current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_ALPHA; break; - case GL_DST_ALPHA: - current->hwDstSrcBlend |= SiS_S_DST_ALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: - current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_ALPHA; - break; case GL_DST_COLOR: current->hwDstSrcBlend |= SiS_S_DST_COLOR; break; case GL_ONE_MINUS_DST_COLOR: current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_COLOR; break; + case GL_DST_ALPHA: + current->hwDstSrcBlend |= SiS_S_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_ALPHA; + break; case GL_SRC_ALPHA_SATURATE: current->hwDstSrcBlend |= SiS_S_SRC_ALPHA_SATURATE; break; + default: + fprintf(stderr, "Unknown src blend function 0x%x\n", sfactorRGB); + break; } if (current->hwDstSrcBlend != prev->hwDstSrcBlend) { -- 2.30.2