summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/blend.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-04-23 14:27:40 +0200
committerChristian König <[email protected]>2011-04-23 14:27:40 +0200
commitfa31b1095eeea97695125ad5770239805bed37da (patch)
tree6c421666719a9a1afc419de33d06f4e66584a8a1 /src/mesa/main/blend.c
parent24d76d2966a5c666c9627034e6751621b17024c8 (diff)
parent15eaf8297ecb39337109b95480e61f37a6b20f0a (diff)
Merge remote branch 'origin/master' into pipe-video
Conflicts: configs/linux-dri src/gallium/drivers/r600/r600_pipe.c src/gallium/drivers/r600/r600_state.c src/gallium/include/pipe/p_format.h src/gallium/tests/graw/fragment-shader/frag-abs.sh src/gallium/tests/graw/fragment-shader/frag-add.sh src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh src/gallium/tests/graw/fragment-shader/frag-cb-2d.sh src/gallium/tests/graw/fragment-shader/frag-dp3.sh src/gallium/tests/graw/fragment-shader/frag-dp4.sh src/gallium/tests/graw/fragment-shader/frag-dst.sh src/gallium/tests/graw/fragment-shader/frag-ex2.sh src/gallium/tests/graw/fragment-shader/frag-face.sh src/gallium/tests/graw/fragment-shader/frag-flr.sh src/gallium/tests/graw/fragment-shader/frag-frc.sh src/gallium/tests/graw/fragment-shader/frag-kil.sh src/gallium/tests/graw/fragment-shader/frag-lg2.sh src/gallium/tests/graw/fragment-shader/frag-lit.sh src/gallium/tests/graw/fragment-shader/frag-lrp.sh src/gallium/tests/graw/fragment-shader/frag-mad-immx.sh src/gallium/tests/graw/fragment-shader/frag-mad.sh src/gallium/tests/graw/fragment-shader/frag-max.sh src/gallium/tests/graw/fragment-shader/frag-min.sh src/gallium/tests/graw/fragment-shader/frag-mov.sh src/gallium/tests/graw/fragment-shader/frag-mul.sh src/gallium/tests/graw/fragment-shader/frag-rcp.sh src/gallium/tests/graw/fragment-shader/frag-rsq.sh src/gallium/tests/graw/fragment-shader/frag-sge.sh src/gallium/tests/graw/fragment-shader/frag-slt.sh src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh src/gallium/tests/graw/fragment-shader/frag-sub.sh src/gallium/tests/graw/fragment-shader/frag-tempx.sh src/gallium/tests/graw/fragment-shader/frag-xpd.sh src/gallium/tests/graw/vertex-shader/vert-abs.sh src/gallium/tests/graw/vertex-shader/vert-add.sh src/gallium/tests/graw/vertex-shader/vert-arl.sh src/gallium/tests/graw/vertex-shader/vert-arr.sh src/gallium/tests/graw/vertex-shader/vert-cb-1d.sh src/gallium/tests/graw/vertex-shader/vert-cb-2d.sh src/gallium/tests/graw/vertex-shader/vert-dp3.sh src/gallium/tests/graw/vertex-shader/vert-dp4.sh src/gallium/tests/graw/vertex-shader/vert-dst.sh src/gallium/tests/graw/vertex-shader/vert-ex2.sh src/gallium/tests/graw/vertex-shader/vert-flr.sh src/gallium/tests/graw/vertex-shader/vert-frc.sh src/gallium/tests/graw/vertex-shader/vert-lg2.sh src/gallium/tests/graw/vertex-shader/vert-lit.sh src/gallium/tests/graw/vertex-shader/vert-lrp.sh src/gallium/tests/graw/vertex-shader/vert-mad.sh src/gallium/tests/graw/vertex-shader/vert-max.sh src/gallium/tests/graw/vertex-shader/vert-min.sh src/gallium/tests/graw/vertex-shader/vert-mov.sh src/gallium/tests/graw/vertex-shader/vert-mul.sh src/gallium/tests/graw/vertex-shader/vert-rcp.sh src/gallium/tests/graw/vertex-shader/vert-rsq.sh src/gallium/tests/graw/vertex-shader/vert-sge.sh src/gallium/tests/graw/vertex-shader/vert-slt.sh src/gallium/tests/graw/vertex-shader/vert-srcmod-abs.sh src/gallium/tests/graw/vertex-shader/vert-srcmod-absneg.sh src/gallium/tests/graw/vertex-shader/vert-srcmod-neg.sh src/gallium/tests/graw/vertex-shader/vert-srcmod-swz.sh src/gallium/tests/graw/vertex-shader/vert-sub.sh src/gallium/tests/graw/vertex-shader/vert-xpd.sh src/gallium/tools/trace/dump.py src/gallium/tools/trace/format.py src/gallium/tools/trace/model.py src/gallium/tools/trace/parse.py
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r--src/mesa/main/blend.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index c74a168036a..95c101c34ae 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -513,19 +513,24 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- tmp[0] = CLAMP( red, 0.0F, 1.0F );
- tmp[1] = CLAMP( green, 0.0F, 1.0F );
- tmp[2] = CLAMP( blue, 0.0F, 1.0F );
- tmp[3] = CLAMP( alpha, 0.0F, 1.0F );
+ tmp[0] = red;
+ tmp[1] = green;
+ tmp[2] = blue;
+ tmp[3] = alpha;
- if (TEST_EQ_4V(tmp, ctx->Color.BlendColor))
+ if (TEST_EQ_4V(tmp, ctx->Color.BlendColorUnclamped))
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
- COPY_4FV( ctx->Color.BlendColor, tmp );
+ COPY_4FV( ctx->Color.BlendColorUnclamped, tmp );
+
+ ctx->Color.BlendColor[0] = CLAMP(tmp[0], 0.0F, 1.0F);
+ ctx->Color.BlendColor[1] = CLAMP(tmp[1], 0.0F, 1.0F);
+ ctx->Color.BlendColor[2] = CLAMP(tmp[2], 0.0F, 1.0F);
+ ctx->Color.BlendColor[3] = CLAMP(tmp[3], 0.0F, 1.0F);
if (ctx->Driver.BlendColor)
- (*ctx->Driver.BlendColor)(ctx, tmp);
+ (*ctx->Driver.BlendColor)(ctx, ctx->Color.BlendColor);
}
@@ -558,17 +563,16 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref )
case GL_NOTEQUAL:
case GL_GEQUAL:
case GL_ALWAYS:
- ref = CLAMP(ref, 0.0F, 1.0F);
-
- if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref)
+ if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRefUnclamped == ref)
return; /* no change */
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.AlphaFunc = func;
- ctx->Color.AlphaRef = ref;
+ ctx->Color.AlphaRefUnclamped = ref;
+ ctx->Color.AlphaRef = CLAMP(ref, 0.0F, 1.0F);
if (ctx->Driver.AlphaFunc)
- ctx->Driver.AlphaFunc(ctx, func, ref);
+ ctx->Driver.AlphaFunc(ctx, func, ctx->Color.AlphaRef);
return;
default:
@@ -737,7 +741,7 @@ _mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green,
}
-extern void GLAPIENTRY
+void GLAPIENTRY
_mesa_ClampColorARB(GLenum target, GLenum clamp)
{
GET_CURRENT_CONTEXT(ctx);
@@ -751,12 +755,15 @@ _mesa_ClampColorARB(GLenum target, GLenum clamp)
switch (target) {
case GL_CLAMP_VERTEX_COLOR_ARB:
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.ClampVertexColor = clamp;
break;
case GL_CLAMP_FRAGMENT_COLOR_ARB:
+ FLUSH_VERTICES(ctx, _NEW_FRAG_CLAMP);
ctx->Color.ClampFragmentColor = clamp;
break;
case GL_CLAMP_READ_COLOR_ARB:
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClampReadColor = clamp;
break;
default:
@@ -789,6 +796,7 @@ void _mesa_init_color( struct gl_context * ctx )
memset(ctx->Color.ColorMask, 0xff, sizeof(ctx->Color.ColorMask));
ctx->Color.ClearIndex = 0;
ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 );
+ ASSIGN_4V( ctx->Color.ClearColorUnclamped, 0, 0, 0, 0 );
ctx->Color.AlphaEnabled = GL_FALSE;
ctx->Color.AlphaFunc = GL_ALWAYS;
ctx->Color.AlphaRef = 0;
@@ -802,6 +810,7 @@ void _mesa_init_color( struct gl_context * ctx )
ctx->Color.Blend[i].EquationA = GL_FUNC_ADD;
}
ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( ctx->Color.BlendColorUnclamped, 0.0, 0.0, 0.0, 0.0 );
ctx->Color.IndexLogicOpEnabled = GL_FALSE;
ctx->Color.ColorLogicOpEnabled = GL_FALSE;
ctx->Color._LogicOpEnabled = GL_FALSE;
@@ -816,7 +825,9 @@ void _mesa_init_color( struct gl_context * ctx )
}
ctx->Color.ClampFragmentColor = GL_FIXED_ONLY_ARB;
+ ctx->Color._ClampFragmentColor = GL_TRUE;
ctx->Color.ClampReadColor = GL_FIXED_ONLY_ARB;
+ ctx->Color._ClampReadColor = GL_TRUE;
}
/*@}*/