-/* $Id: blend.c,v 1.14 2000/04/11 21:38:08 brianp Exp $ */
+/* $Id: blend.c,v 1.15 2000/05/30 02:28:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
gl_lookup_enum_by_nr(dfactor));
switch (sfactor) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" );
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_DST_COLOR:
}
switch (dfactor) {
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" );
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
gl_lookup_enum_by_nr(dfactorA));
switch (sfactorRGB) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)");
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_DST_COLOR:
ctx->Color.BlendSrcRGB = sfactorRGB;
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)" );
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)");
return;
}
switch (dfactorRGB) {
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)");
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
ctx->Color.BlendDstRGB = dfactorRGB;
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)" );
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)");
return;
}
switch (sfactorA) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)");
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_DST_COLOR:
ctx->Color.BlendSrcA = sfactorA;
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)" );
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)");
return;
}
switch (dfactorA) {
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ if (!ctx->Extensions.HaveBlendSquare) {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)");
+ return;
+ }
+ /* fall-through */
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
fprintf(stderr, "glBlendEquation %s\n",
gl_lookup_enum_by_nr(mode));
-
switch (mode) {
case GL_MIN_EXT:
case GL_MAX_EXT:
case GL_ONE_MINUS_CONSTANT_ALPHA:
sR = sG = sB = 1.0F - ctx->Color.BlendColor[3];
break;
+ case GL_SRC_COLOR: /* GL_NV_blend_square */
+ sR = (GLfloat) Rs * rscale;
+ sG = (GLfloat) Gs * gscale;
+ sB = (GLfloat) Bs * bscale;
+ break;
+ case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */
+ sR = 1.0F - (GLfloat) Rs * rscale;
+ sG = 1.0F - (GLfloat) Gs * gscale;
+ sB = 1.0F - (GLfloat) Bs * bscale;
+ break;
default:
/* this should never happen */
gl_problem(ctx, "Bad blend source RGB factor in do_blend");
case GL_ONE_MINUS_CONSTANT_ALPHA:
sA = 1.0F - ctx->Color.BlendColor[3];
break;
+ case GL_SRC_COLOR: /* GL_NV_blend_square */
+ sA = (GLfloat) As * ascale;
+ break;
+ case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */
+ sA = 1.0F - (GLfloat) As * ascale;
+ break;
default:
/* this should never happen */
sA = 0.0F;
case GL_ONE_MINUS_CONSTANT_ALPHA:
dR = dG = dB = 1.0F - ctx->Color.BlendColor[3] * ascale;
break;
+ case GL_DST_COLOR: /* GL_NV_blend_square */
+ dR = (GLfloat) Rd * rscale;
+ dG = (GLfloat) Gd * gscale;
+ dB = (GLfloat) Bd * bscale;
+ break;
+ case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */
+ dR = 1.0F - (GLfloat) Rd * rscale;
+ dG = 1.0F - (GLfloat) Gd * gscale;
+ dB = 1.0F - (GLfloat) Bd * bscale;
+ break;
default:
/* this should never happen */
dR = dG = dB = 0.0F;
case GL_ONE_MINUS_CONSTANT_ALPHA:
dA = 1.0F - ctx->Color.BlendColor[3] * ascale;
break;
+ case GL_DST_COLOR: /* GL_NV_blend_square */
+ dA = (GLfloat) Ad * ascale;
+ break;
+ case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */
+ dA = 1.0F - (GLfloat) Ad * ascale;
+ break;
default:
/* this should never happen */
dA = 0.0F;
-/* $Id: extensions.c,v 1.29 2000/05/24 14:04:06 brianp Exp $ */
+/* $Id: extensions.c,v 1.30 2000/05/30 02:28:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ DEFAULT_ON, "GL_INGR_blend_func_separate" },
{ ALWAYS_ENABLED, "GL_MESA_window_pos" },
{ ALWAYS_ENABLED, "GL_MESA_resize_buffers" },
+ { DEFAULT_OFF, "GL_NV_blend_square" },
{ ALWAYS_ENABLED, "GL_NV_texgen_reflection" },
{ DEFAULT_ON, "GL_PGI_misc_hints" },
{ DEFAULT_ON, "GL_SGI_color_matrix" },
ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression");
ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc");
ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1");
+ ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square");
}