aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-05-30 02:28:03 +0000
committerBrian Paul <[email protected]>2000-05-30 02:28:03 +0000
commitad68f17a06cc07520e1462a7261a9d1c51a136a9 (patch)
treef0933aa0a6e09afe8567b42bd54414a700d65581 /src/mesa
parentaea03c424d4223aee334a66a5702d37e1e1a08cc (diff)
initial work for GL_NV_blend_square extension
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/blend.c83
-rw-r--r--src/mesa/main/extensions.c4
2 files changed, 81 insertions, 6 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 7bbffcb8dfa..ddfe6447dee 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -1,4 +1,4 @@
-/* $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
@@ -53,6 +53,13 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
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:
@@ -74,6 +81,13 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
}
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:
@@ -118,6 +132,13 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
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:
@@ -134,11 +155,18 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
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:
@@ -154,11 +182,18 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
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:
@@ -175,11 +210,18 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
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:
@@ -221,7 +263,6 @@ _mesa_BlendEquation( GLenum mode )
fprintf(stderr, "glBlendEquation %s\n",
gl_lookup_enum_by_nr(mode));
-
switch (mode) {
case GL_MIN_EXT:
case GL_MAX_EXT:
@@ -510,6 +551,16 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
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");
@@ -557,6 +608,12 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
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;
@@ -609,6 +666,16 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
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;
@@ -653,6 +720,12 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
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;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 92615396dad..327b0ade345 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $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
@@ -82,6 +82,7 @@ static struct { int enabled; const char *name; } default_extensions[] = {
{ 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" },
@@ -107,6 +108,7 @@ update_extension_flags( GLcontext *ctx )
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");
}