summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/blend.c
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-03-03 14:03:33 -0800
committerFredrik Höglund <[email protected]>2015-05-14 15:48:14 +0200
commit2cabfd9636a55f6adee04f4199ba83a39598d51c (patch)
tree8eed408c25fad33d3dbc0cde52d1bce82ca1603a /src/mesa/main/blend.c
parentc1fe8d841c4746a6371dde569c6c88c6c2bad4e6 (diff)
main: Refactor _mesa_[update|get]_clamp_fragment_color.
Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r--src/mesa/main/blend.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index ee76b475943..2342555a95d 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -778,7 +778,7 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
}
FLUSH_VERTICES(ctx, _NEW_FRAG_CLAMP);
ctx->Color.ClampFragmentColor = clamp;
- _mesa_update_clamp_fragment_color(ctx);
+ _mesa_update_clamp_fragment_color(ctx, ctx->DrawBuffer);
break;
case GL_CLAMP_READ_COLOR_ARB:
ctx->Color.ClampReadColor = clamp;
@@ -807,10 +807,10 @@ get_clamp_color(const struct gl_framebuffer *fb, GLenum clamp)
}
GLboolean
-_mesa_get_clamp_fragment_color(const struct gl_context *ctx)
+_mesa_get_clamp_fragment_color(const struct gl_context *ctx,
+ const struct gl_framebuffer *drawFb)
{
- return get_clamp_color(ctx->DrawBuffer,
- ctx->Color.ClampFragmentColor);
+ return get_clamp_color(drawFb, ctx->Color.ClampFragmentColor);
}
GLboolean
@@ -830,19 +830,20 @@ _mesa_get_clamp_read_color(const struct gl_context *ctx)
* Update the ctx->Color._ClampFragmentColor field
*/
void
-_mesa_update_clamp_fragment_color(struct gl_context *ctx)
+_mesa_update_clamp_fragment_color(struct gl_context *ctx,
+ const struct gl_framebuffer *drawFb)
{
- struct gl_framebuffer *fb = ctx->DrawBuffer;
-
/* Don't clamp if:
* - there is no colorbuffer
* - all colorbuffers are unsigned normalized, so clamping has no effect
* - there is an integer colorbuffer
*/
- if (!fb || !fb->_HasSNormOrFloatColorBuffer || fb->_IntegerColor)
+ if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
+ drawFb->_IntegerColor)
ctx->Color._ClampFragmentColor = GL_FALSE;
else
- ctx->Color._ClampFragmentColor = _mesa_get_clamp_fragment_color(ctx);
+ ctx->Color._ClampFragmentColor =
+ _mesa_get_clamp_fragment_color(ctx, drawFb);
}
/**