diff options
author | Brian Paul <[email protected]> | 2011-12-24 08:54:27 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-12-24 09:25:41 -0700 |
commit | c60ac7b17993d28af65b04f9bbbf3ee74c35358c (patch) | |
tree | 925680a4b9cb1b67e90143804c5c08425a9eadd7 /src/mesa/swrast/s_zoom.c | |
parent | bf0c0ccbc9424fc73cb17ffb9c9b5feda7d33474 (diff) |
swrast: rewrite glDrawPixels(GL_DEPTH) with zoom
This gets rid of another renderbuffer->PutRow() call and _DepthBuffer
usage. We always work with 32-bit uint Z values now.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_zoom.c')
-rw-r--r-- | src/mesa/swrast/s_zoom.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index f407fdcf4e6..73bff482b9a 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -25,6 +25,7 @@ #include "main/glheader.h" #include "main/macros.h" #include "main/imports.h" +#include "main/format_pack.h" #include "main/colormac.h" #include "s_context.h" @@ -390,17 +391,17 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY /** - * Zoom/write z values (16 or 32-bit). + * Zoom/write 32-bit Z values. * No per-fragment operations are applied. */ void _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, - const GLvoid *z) + const GLuint *zVals) { - struct gl_renderbuffer *rb = ctx->DrawBuffer->_DepthBuffer; - GLushort zoomedVals16[MAX_WIDTH]; - GLuint zoomedVals32[MAX_WIDTH]; + struct gl_renderbuffer *rb = + ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + GLuint zoomedVals[MAX_WIDTH]; GLint x0, x1, y0, y1, y; GLint i, zoomedWidth; @@ -414,28 +415,16 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, ASSERT(zoomedWidth <= MAX_WIDTH); /* zoom the span horizontally */ - if (rb->DataType == GL_UNSIGNED_SHORT) { - for (i = 0; i < zoomedWidth; i++) { - GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX; - ASSERT(j >= 0); - ASSERT(j < width); - zoomedVals16[i] = ((GLushort *) z)[j]; - } - z = zoomedVals16; - } - else { - ASSERT(rb->DataType == GL_UNSIGNED_INT); - for (i = 0; i < zoomedWidth; i++) { - GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX; - ASSERT(j >= 0); - ASSERT(j < width); - zoomedVals32[i] = ((GLuint *) z)[j]; - } - z = zoomedVals32; + for (i = 0; i < zoomedWidth; i++) { + GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX; + ASSERT(j >= 0); + ASSERT(j < width); + zoomedVals[i] = zVals[j]; } /* write the zoomed spans */ for (y = y0; y < y1; y++) { - rb->PutRow(ctx, rb, zoomedWidth, x0, y, z, NULL); + GLubyte *dst = _swrast_pixel_address(rb, x0, y); + _mesa_pack_uint_z_row(rb->Format, zoomedWidth, zoomedVals, dst); } } |