diff options
author | Eric Anholt <[email protected]> | 2011-04-15 14:39:47 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-04-20 10:35:42 -0700 |
commit | 99fa449bb9cf93a8dd2b840804c5bc44e51483dc (patch) | |
tree | 6621e8c540ee00d302f4f1921c982aeb1d8cb023 /src/mesa/drivers/common/meta.c | |
parent | b2491972591788fea0e55805cea3e9be8760969b (diff) |
meta: Add support for ARB_color_buffer_float to _mesa_meta_Clear().
Tested with piglit arb_color_buffer_float-clear.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 27681a29139..6c35fa10d8a 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -93,6 +93,7 @@ #define META_VERTEX 0x2000 #define META_VIEWPORT 0x4000 #define META_CLAMP_FRAGMENT_COLOR 0x8000 +#define META_CLAMP_VERTEX_COLOR 0x10000 /*@}*/ @@ -184,6 +185,9 @@ struct save_state /** META_CLAMP_FRAGMENT_COLOR */ GLenum ClampFragmentColor; + /** META_CLAMP_VERTEX_COLOR */ + GLenum ClampVertexColor; + /** Miscellaneous (always disabled) */ GLboolean Lighting; }; @@ -584,6 +588,15 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE); } + if (state & META_CLAMP_VERTEX_COLOR) { + save->ClampVertexColor = ctx->Light.ClampVertexColor; + + /* Generally in here we never want vertex color clamping -- + * result clamping is only dependent on fragment clamping. + */ + _mesa_ClampColorARB(GL_CLAMP_VERTEX_COLOR, GL_FALSE); + } + /* misc */ { save->Lighting = ctx->Light.Enabled; @@ -852,6 +865,10 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, save->ClampFragmentColor); } + if (state & META_CLAMP_VERTEX_COLOR) { + _mesa_ClampColorARB(GL_CLAMP_VERTEX_COLOR, save->ClampVertexColor); + } + /* misc */ if (save->Lighting) { _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); @@ -1460,6 +1477,9 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) /* GL_COLOR_BUFFER_BIT */ if (buffers & BUFFER_BITS_COLOR) { /* leave colormask, glDrawBuffer state as-is */ + + /* Clears never have the color clamped. */ + _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE); } else { ASSERT(metaSave & META_COLOR_MASK); @@ -1513,10 +1533,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) /* vertex colors */ for (i = 0; i < 4; i++) { - verts[i].r = ctx->Color.ClearColor[0]; - verts[i].g = ctx->Color.ClearColor[1]; - verts[i].b = ctx->Color.ClearColor[2]; - verts[i].a = ctx->Color.ClearColor[3]; + verts[i].r = ctx->Color.ClearColorUnclamped[0]; + verts[i].g = ctx->Color.ClearColorUnclamped[1]; + verts[i].b = ctx->Color.ClearColorUnclamped[2]; + verts[i].a = ctx->Color.ClearColorUnclamped[3]; } /* upload new vertex data */ |