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/state.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/state.c')
-rw-r--r-- | src/mesa/main/state.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 118ed1d284a..1d1ae47374e 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -445,6 +445,35 @@ update_color(struct gl_context *ctx) ctx->Color._LogicOpEnabled = _mesa_rgba_logicop_enabled(ctx); } +static void +update_clamp_fragment_color(struct gl_context *ctx) +{ + if(ctx->Color.ClampFragmentColor == GL_FIXED_ONLY_ARB) + ctx->Color._ClampFragmentColor = !ctx->DrawBuffer || !ctx->DrawBuffer->Visual.floatMode; + else + ctx->Color._ClampFragmentColor = ctx->Color.ClampFragmentColor; +} + +static void +update_clamp_vertex_color(struct gl_context *ctx) +{ + if(ctx->Light.ClampVertexColor == GL_FIXED_ONLY_ARB) + ctx->Light._ClampVertexColor = !ctx->DrawBuffer || !ctx->DrawBuffer->Visual.floatMode; + else + ctx->Light._ClampVertexColor = ctx->Light.ClampVertexColor; +} + +static void +update_clamp_read_color(struct gl_context *ctx) +{ + if(ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB) + ctx->Color._ClampReadColor = !ctx->ReadBuffer || !ctx->ReadBuffer->Visual.floatMode; + else + ctx->Color._ClampReadColor = ctx->Color.ClampReadColor; +} + + + /* * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET @@ -565,7 +594,7 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG | _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE | - _NEW_PROGRAM); + _NEW_PROGRAM | _NEW_FRAG_CLAMP); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | @@ -599,6 +628,9 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & _NEW_LIGHT) _mesa_update_lighting( ctx ); + if (new_state & (_NEW_LIGHT | _NEW_BUFFERS)) + update_clamp_vertex_color(ctx); + if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) _mesa_update_stencil( ctx ); @@ -617,6 +649,12 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & _NEW_COLOR) update_color( ctx ); + if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) + update_clamp_read_color(ctx); + + if(new_state & (_NEW_FRAG_CLAMP | _NEW_BUFFERS)) + update_clamp_fragment_color(ctx); + #if 0 if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR)) |