diff options
author | Marek Olšák <[email protected]> | 2011-02-15 23:30:23 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-03-29 12:04:55 +0200 |
commit | e5c6a92a12b5cd7db205d72039f58d302b0be9d5 (patch) | |
tree | 4131a362c087d9d8b45999e0bb3868b7ff2942f8 /src/mesa/main/blend.c | |
parent | 3bdd12ecb57e9cdc2b21cd665fab14698c1c07df (diff) |
mesa: implement clamping controls (ARB_color_buffer_float)
Squashed commit of the following:
Author: Marek Olšák <[email protected]>
mesa: fix getteximage so that it doesn't clamp values
mesa: update the compute_version function
mesa: add display list support for ARB_color_buffer_float
mesa: fix glGet query with GL_ALPHA_TEST_REF and ARB_color_buffer_float
commit b2f6ddf907935b2594d2831ddab38cf57a1729ce
Author: Luca Barbieri <[email protected]>
Date: Tue Aug 31 16:50:57 2010 +0200
mesa: document known possible deviations from ARB_color_buffer_float
commit 5458935be800c1b19d1c9d1569dc4fa30a97e8b8
Author: Luca Barbieri <[email protected]>
Date: Tue Aug 24 21:54:56 2010 +0200
mesa: expose GL_ARB_color_buffer_float
commit aef5c3c6be6edd076e955e37c80905bc447f8a82
Author: Luca Barbieri <[email protected]>
Date: Thu Aug 26 18:12:34 2010 +0200
mesa, mesa/st: handle read color clamping properly
(I'll squash the st/mesa part to a separate commit. -Marek)
We set IMAGE_CLAMP_BIT in the caller based on _ClampReadColor, where
the operation mandates it.
TODO: did I get the set of operations mandating it right?
commit 3a9cb5e59b676b6148c50907ce6eef5441677e36
Author: Luca Barbieri <[email protected]>
Date: Thu Aug 26 18:09:41 2010 +0200
mesa: respect color clamping in texenv programs (v2)
Changes in v2:
- Fix attributes other than vertex color sometimes getting clamped
commit de26f9e47e886e176aab6e5a2c3d4481efb64362
Author: Luca Barbieri <[email protected]>
Date: Thu Aug 26 18:05:53 2010 +0200
mesa: restore color clamps on glPopAttrib
commit a55ac3c300c189616627c05d924c40a8b55bfafa
Author: Luca Barbieri <[email protected]>
Date: Thu Aug 26 18:04:26 2010 +0200
mesa: clamp color queries if and only if fragment clamping is enabled
commit 9940a3e31c2fb76cc3d28b15ea78dde369825107
Author: Luca Barbieri <[email protected]>
Date: Wed Aug 25 00:00:16 2010 +0200
mesa: introduce derived _ClampXxxColor state resolving FIXED_ONLY
To do this, we make ClampColor call FLUSH_VERTICES with the appropriate
_NEW flag.
We introduce _NEW_FRAG_CLAMP since fragment clamping has wide-ranging
effects, despite being in the Color attrib group.
This may be easily changed by s/_NEW_FRAG_CLAMP/_NEW_COLOR/g
commit 6244c446e3beed5473b4e811d10787e4019f59d6
Author: Luca Barbieri <[email protected]>
Date: Thu Aug 26 17:58:24 2010 +0200
mesa: add unclamped color parameters
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r-- | src/mesa/main/blend.c | 37 |
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; } /*@}*/ |