main: Refactor _mesa_get_clamp_read_color.

This wasn't neccessary for ARB_direct_state_access, but felt like a good idea
for the sake of completeness.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
This commit is contained in:
Laura Ekstrand 2015-03-03 15:05:16 -08:00 committed by Fredrik Höglund
parent 2cabfd9636
commit 39be0c5f6c
3 changed files with 7 additions and 5 deletions

View file

@ -821,9 +821,10 @@ _mesa_get_clamp_vertex_color(const struct gl_context *ctx,
} }
GLboolean GLboolean
_mesa_get_clamp_read_color(const struct gl_context *ctx) _mesa_get_clamp_read_color(const struct gl_context *ctx,
const struct gl_framebuffer *readFb)
{ {
return get_clamp_color(ctx->ReadBuffer, ctx->Color.ClampReadColor); return get_clamp_color(readFb, ctx->Color.ClampReadColor);
} }
/** /**

View file

@ -110,7 +110,8 @@ _mesa_get_clamp_vertex_color(const struct gl_context *ctx,
const struct gl_framebuffer *drawFb); const struct gl_framebuffer *drawFb);
extern GLboolean extern GLboolean
_mesa_get_clamp_read_color(const struct gl_context *ctx); _mesa_get_clamp_read_color(const struct gl_context *ctx,
const struct gl_framebuffer *readFb);
extern void extern void
_mesa_update_clamp_fragment_color(struct gl_context *ctx, _mesa_update_clamp_fragment_color(struct gl_context *ctx,

View file

@ -83,7 +83,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat,
if (uses_blit) { if (uses_blit) {
/* For blit-based ReadPixels packing, the clamping is done automatically /* For blit-based ReadPixels packing, the clamping is done automatically
* unless the type is float. */ * unless the type is float. */
if (_mesa_get_clamp_read_color(ctx) && if (_mesa_get_clamp_read_color(ctx, ctx->ReadBuffer) &&
(type == GL_FLOAT || type == GL_HALF_FLOAT)) { (type == GL_FLOAT || type == GL_HALF_FLOAT)) {
transferOps |= IMAGE_CLAMP_BIT; transferOps |= IMAGE_CLAMP_BIT;
} }
@ -91,7 +91,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat,
else { else {
/* For CPU-based ReadPixels packing, the clamping must always be done /* For CPU-based ReadPixels packing, the clamping must always be done
* for non-float types, */ * for non-float types, */
if (_mesa_get_clamp_read_color(ctx) || if (_mesa_get_clamp_read_color(ctx, ctx->ReadBuffer) ||
(type != GL_FLOAT && type != GL_HALF_FLOAT)) { (type != GL_FLOAT && type != GL_HALF_FLOAT)) {
transferOps |= IMAGE_CLAMP_BIT; transferOps |= IMAGE_CLAMP_BIT;
} }