gallium: get rid of unnecessary surface mapping
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 18 Apr 2008 17:33:42 +0000 (11:33 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 18 Apr 2008 17:46:00 +0000 (11:46 -0600)
src/mesa/state_tracker/st_cb_drawpixels.c

index 67f468c68927a3e4036ac13a9c92f51ad488f31a..5fb27857a7bbd896006e6c363db5c1caab499937 100644 (file)
@@ -882,7 +882,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer);
    struct pipe_surface *psRead = rbRead->surface;
    struct pipe_surface *psDraw = rbDraw->surface;
-   ubyte *readMap, *drawMap;
+   ubyte *drawMap;
    ubyte *buffer;
    int i;
 
@@ -892,14 +892,13 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       return;
    }
 
-   /* map the stencil buffers */
-   readMap = pipe_surface_map(psRead);
-   drawMap = pipe_surface_map(psDraw);
-
    /* this will do stencil pixel transfer ops */
    st_read_stencil_pixels(ctx, srcx, srcy, width, height, GL_UNSIGNED_BYTE,
                           &ctx->DefaultPacking, buffer);
 
+   /* map the stencil buffer */
+   drawMap = pipe_surface_map(psDraw);
+
    /* draw */
    /* XXX PixelZoom not handled yet */
    for (i = 0; i < height; i++) {
@@ -937,8 +936,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 
    free(buffer);
 
-   /* unmap the stencil buffers */
-   pipe_surface_unmap(psRead);
+   /* unmap the stencil buffer */
    pipe_surface_unmap(psDraw);
 }