[Mesa-dev] [PATCH 20/38] main: Refactor _mesa_get_clamp_read_color.

Fredrik Höglund fredrik at kde.org
Sun Apr 12 08:59:53 PDT 2015


Reviewed-by: Fredrik Höglund <fredrik at kde.org>

On Wednesday 04 March 2015, Laura Ekstrand wrote:
> This wasn't neccessary for ARB_direct_state_access, but felt like a good idea
> for the sake of completeness.
> ---
>  src/mesa/main/blend.c   | 5 +++--
>  src/mesa/main/blend.h   | 3 ++-
>  src/mesa/main/readpix.c | 4 ++--
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
> index 2342555..d869fa2 100644
> --- a/src/mesa/main/blend.c
> +++ b/src/mesa/main/blend.c
> @@ -821,9 +821,10 @@ _mesa_get_clamp_vertex_color(const struct gl_context *ctx,
>  }
>  
>  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);
>  }
>  
>  /**
> diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
> index 58e6673..8ab9e02 100644
> --- a/src/mesa/main/blend.h
> +++ b/src/mesa/main/blend.h
> @@ -110,7 +110,8 @@ _mesa_get_clamp_vertex_color(const struct gl_context *ctx,
>                               const struct gl_framebuffer *drawFb);
>  
>  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
>  _mesa_update_clamp_fragment_color(struct gl_context *ctx,
> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> index ed0104c..df46f83 100644
> --- a/src/mesa/main/readpix.c
> +++ b/src/mesa/main/readpix.c
> @@ -83,7 +83,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat,
>     if (uses_blit) {
>        /* For blit-based ReadPixels packing, the clamping is done automatically
>         * 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)) {
>           transferOps |= IMAGE_CLAMP_BIT;
>        }
> @@ -91,7 +91,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat,
>     else {
>        /* For CPU-based ReadPixels packing, the clamping must always be done
>         * 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)) {
>           transferOps |= IMAGE_CLAMP_BIT;
>        }
> 



More information about the mesa-dev mailing list