[Mesa-dev] [PATCH 04/17] swrast: MapRenderbuffer in separate depth/stencil readpixels fastpath

Brian Paul brianp at vmware.com
Tue Nov 1 17:54:22 PDT 2011


On 11/01/2011 05:17 PM, Eric Anholt wrote:
> This introduces two new span helper functions we'll want to use in
> several palces as we move to MapRenderbuffer, which pull out integer

"places"


> depth and stencil values from a renderbuffer mapping based on the
> renderbuffer format.
>
> v2: Use format_unpack helper for stencil read.
> ---
>   src/mesa/swrast/s_depth.h   |    1 -
>   src/mesa/swrast/s_readpix.c |   76 ++++++++++++++++++++++++++++++++-----------
>   2 files changed, 57 insertions(+), 20 deletions(-)
>
> diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h
> index 44820ac..8d5cdfa 100644
> --- a/src/mesa/swrast/s_depth.h
> +++ b/src/mesa/swrast/s_depth.h
> @@ -53,7 +53,6 @@ extern void
>   _swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb,
>                                 GLint n, GLint x, GLint y, GLuint depth[] );
>
> -
>   extern void
>   _swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb );
>
> diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
> index f6c3674..8559ab7 100644
> --- a/src/mesa/swrast/s_readpix.c
> +++ b/src/mesa/swrast/s_readpix.c
> @@ -373,7 +373,7 @@ static GLboolean
>   fast_read_depth_stencil_pixels(struct gl_context *ctx,
>   			       GLint x, GLint y,
>   			       GLsizei width, GLsizei height,
> -			       GLenum type, GLvoid *dst, int dstStride)
> +			       GLvoid *dst, int dstStride)
>   {
>      struct gl_framebuffer *fb = ctx->ReadBuffer;
>      struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
> @@ -384,9 +384,6 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx,
>      if (rb != stencilRb)
>         return GL_FALSE;
>
> -   if (type != GL_UNSIGNED_INT_24_8)
> -      return GL_FALSE;
> -
>      if (rb->Format != MESA_FORMAT_Z24_S8&&
>          rb->Format != MESA_FORMAT_S8_Z24)
>         return GL_FALSE;
> @@ -408,6 +405,53 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx,
>
>
>   /**
> + * For separate depth/stencil buffers being read as 24/8 depth/stencil, memcpy
> + * the data (possibly swapping 8/24 vs 24/8 as we go).

I don't know if you need to mention the swapping here since the code 
doesn't look like it's doing explicit swapping.  The _mesa_unpack_* 
functions return values in canonical formats and ranges.

No big deal.

-Brian



More information about the mesa-dev mailing list