[Mesa-dev] [PATCH 05/10] mesa: Add renderbuffer accessors for A, I, L, FLOAT32.

Brian brianp at vmware.com
Tue Apr 19 07:10:20 PDT 2011


On 04/18/2011 02:37 PM, Eric Anholt wrote:
> Of these, intel will be using I and L initially, and A once we rewrite
> fragment shaders and the CC for rendering to it as R.
> ---
>   src/mesa/main/renderbuffer.c |  218 ++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 218 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
> index 7826e44..2fa9e27 100644
> --- a/src/mesa/main/renderbuffer.c
> +++ b/src/mesa/main/renderbuffer.c
> @@ -1114,6 +1114,194 @@ get_values_rg1616(struct gl_context *ctx, struct gl_renderbuffer *rb,
>   }
>
>   /**********************************************************************
> + * Functions for MESA_FORMAT_INTENSITY_FLOAT32.
> + */
> +static void
> +get_row_i_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
> +		  GLuint count, GLint x, GLint y, void *values)
> +{
> +   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
> +   GLfloat *dst = values;
> +   GLuint i;
> +
> +   for (i = 0; i<  count; i++) {
> +      dst[i * 4 + RCOMP] = src[i];
> +      dst[i * 4 + GCOMP] = dst[i * 4 + RCOMP];
> +      dst[i * 4 + BCOMP] = dst[i * 4 + RCOMP];
> +      dst[i * 4 + ACOMP] = dst[i * 4 + RCOMP];

Just a small nit, but I'd write this as follows:

for (i = 0; i<  count; i++) {
    dst[i * 4 + RCOMP] =
    dst[i * 4 + GCOMP] =
    dst[i * 4 + BCOMP] =
    dst[i * 4 + ACOMP] = src[i];
}

It's less typing and seeing dst[] on the RHS is a little distracting 
at first glance.

Otherwise, for the series:
Reviewed-by: Brian Paul <brianp at vmware.com>

-Brian


More information about the mesa-dev mailing list