[Mesa-dev] [PATCH 08/13] mesa: implement depth/stencil renderbuffer wrapper accessors for Z32F_X24S8

Kenneth Graunke kenneth at whitecape.org
Thu Jun 30 20:43:38 PDT 2011


On 06/30/2011 05:29 PM, Marek Olšák wrote:
> ---
>  src/mesa/main/depthstencil.c |  322 +++++++++++++++++++++++++++++++++++++++---
>  src/mesa/main/depthstencil.h |    5 +
>  src/mesa/main/framebuffer.c  |   10 +-
>  3 files changed, 313 insertions(+), 24 deletions(-)
> 
> diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c
> index ab62c97..f979045 100644
> --- a/src/mesa/main/depthstencil.c
> +++ b/src/mesa/main/depthstencil.c
[snip]
> +static void
> +put_values_z32f(struct gl_context *ctx, struct gl_renderbuffer *z32frb, GLuint count,
> +                const GLint x[], const GLint y[],
> +                const void *values, const GLubyte *mask)
> +{
> +   struct gl_renderbuffer *dsrb = z32frb->Wrapped;
> +   const GLfloat *src = (const GLfloat *) values;
> +   ASSERT(z32frb->DataType == GL_FLOAT);
> +   ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
> +   ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
> +   if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
> +      /* direct access */
> +      GLuint i;
> +      for (i = 0; i < count; i++) {
> +         if (!mask || mask[i]) {
> +            GLfloat *dst = (GLfloat *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
> +            dst[1] = src[i];

Don't you mean dst[0] = src[i] here?  With dst[1], you'll be assigning
to the stencil value...

> +         }
> +      }
> +   }
> +   else {
> +      /* get, modify, put */
> +      GLfloat temp[MAX_WIDTH*2];
> +      GLuint i;
> +      dsrb->GetValues(ctx, dsrb, count, x, y, temp);
> +      for (i = 0; i < count; i++) {
> +         if (!mask || mask[i]) {
> +            temp[i*2] = src[i];

...when clearly this is assigning to the depth value.

> +         }
> +      }
> +      dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
> +   }
> +}
[snip]

With that fixed, this patch is:

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list