summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/blend.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-03-28 01:50:21 +0100
committerMarek Olšák <[email protected]>2013-04-06 23:57:04 +0200
commit21d407c1b8bf3be1eff87121d528d03c240ce207 (patch)
tree5909f109a8e529e2e2663b42a10e56a5aca848d1 /src/mesa/main/blend.c
parentc4629ad3f9440ec7ad3d9f4881d0aba41a93f2f5 (diff)
mesa: refactor clamping controls, get rid of _ClampReadColor
v2: cosmetic changes from Brian's email Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r--src/mesa/main/blend.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 309f1d538f9..88bf3654c10 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -782,7 +782,37 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
}
}
+static GLboolean
+get_clamp_color(const struct gl_framebuffer *fb, GLenum clamp)
+{
+ if (clamp == GL_TRUE || clamp == GL_FALSE)
+ return clamp;
+
+ ASSERT(clamp == GL_FIXED_ONLY);
+ if (!fb)
+ return GL_TRUE;
+
+ return fb->_AllColorBuffersFixedPoint;
+}
+
+GLboolean
+_mesa_get_clamp_fragment_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->DrawBuffer,
+ ctx->Color.ClampFragmentColor);
+}
+GLboolean
+_mesa_get_clamp_vertex_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->DrawBuffer, ctx->Light.ClampVertexColor);
+}
+
+GLboolean
+_mesa_get_clamp_read_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->ReadBuffer, ctx->Color.ClampReadColor);
+}
/**********************************************************************/
@@ -835,7 +865,6 @@ 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;
if (ctx->API == API_OPENGLES2) {
/* GLES 3 behaves as though GL_FRAMEBUFFER_SRGB is always enabled. */