[Mesa-dev] [PATCH 16/22] swrast: fast_draw_depth_stencil() for glDrawPixels(GL_DEPTH_STENCIL)

Eric Anholt eric at anholt.net
Wed Dec 21 12:30:59 PST 2011


On Sun, 18 Dec 2011 20:08:21 -0700, Brian Paul <brianp at vmware.com> wrote:
> Stop using deprecated renderbuffer PutRow() function.  Note that we
> aren't using Map/UnmapRenderbuffer() yet because this call is inside
> a swrast_render_start/finish() pair.
> ---
>  src/mesa/swrast/s_drawpix.c |   64 ++++++++++++++++++++++++++++++++-----------
>  1 files changed, 48 insertions(+), 16 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
> index 4a661a0..19b43f6 100644
> --- a/src/mesa/swrast/s_drawpix.c
> +++ b/src/mesa/swrast/s_drawpix.c
> @@ -551,6 +551,49 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
>  
>  
>  /**
> + * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_S8_Z24
> + * renderbuffer.  No masking, zooming, scaling, etc.
> + */
> +static void
> +fast_draw_depth_stencil(struct gl_context *ctx, GLint x, GLint y,
> +                        GLsizei width, GLsizei height,
> +                        const struct gl_pixelstore_attrib *unpack,
> +                        const GLvoid *pixels)
> +{

> +   for (i = 0; i < height; i++) {
> +      if (rb->Format == MESA_FORMAT_Z24_S8) {
> +         memcpy(dst, src, width * 4);
> +      }
> +      else {
> +         /* swap Z24_S8 -> S8_Z24 */
> +         GLuint j, *dst4 = (GLuint *) dst, *src4 = (GLuint *) src;
> +         for (j = 0; j < width; j++) {
> +            dst4[j] = (src4[j] << 24) | (src4[j] >> 8);
> +         }
> +      }

Reuse _mesa_pack_uint_24_8_depth_stencil_row() here?  Other than that,
looks good.  Patch 15 is also

Reviewed-by: Eric Anholt <eric at anholt.net>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111221/b8118b9f/attachment.pgp>


More information about the mesa-dev mailing list