diff options
author | Brian Paul <[email protected]> | 2011-12-24 08:54:26 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-12-24 08:59:54 -0700 |
commit | e66858fb67477db22139fe38d4f23530b7a142a7 (patch) | |
tree | 378e5e885f0e2644d32dadbae4b06e0052180e14 /src | |
parent | d9d0d4198f9c76774649b8cad3f10352fd7b5ea5 (diff) |
swrast: move swrast_render_start/finish() call in drawpixels code
We don't want to call these functions where we'll be using
Map/UnmapRenderbuffer(). So push them further down in the drawpixels
cases so that we can switch over to Map/UnmapRenderbuffer() step by step.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index e9136d512ff..38310f95514 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -111,6 +111,7 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, /* * Ready to draw! */ + swrast_render_start(ctx); if (format == GL_RGBA && type == rbType) { const GLubyte *src @@ -139,7 +140,7 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, } span.array->ChanType = CHAN_TYPE; } - return GL_TRUE; + goto end; } if (format == GL_RGB && type == rbType) { @@ -170,12 +171,14 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, } span.array->ChanType = CHAN_TYPE; } - return GL_TRUE; + goto end; } /* Remaining cases haven't been tested with alignment != 1 */ - if (userUnpack->Alignment != 1) + if (userUnpack->Alignment != 1) { + swrast_render_finish(ctx); return GL_FALSE; + } if (format == GL_LUMINANCE && type == CHAN_TYPE && rbType == CHAN_TYPE) { const GLchan *src = (const GLchan *) pixels @@ -217,7 +220,7 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, destY++; } } - return GL_TRUE; + goto end; } if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE && rbType == CHAN_TYPE) { @@ -263,7 +266,7 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, destY++; } } - return GL_TRUE; + goto end; } if (format == GL_COLOR_INDEX && type == GL_UNSIGNED_BYTE) { @@ -299,12 +302,17 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, destY++; } } - return GL_TRUE; + goto end; } } /* can't handle this pixel format and/or data type */ return GL_FALSE; + +end: + /* success, unmap render buffers */ + swrast_render_finish(ctx); + return GL_TRUE; } @@ -480,6 +488,8 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, return; } + swrast_render_start(ctx); + INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; @@ -547,6 +557,8 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, if (convImage) { free(convImage); } + + swrast_render_finish(ctx); } @@ -739,8 +751,6 @@ _swrast_DrawPixels( struct gl_context *ctx, */ _mesa_set_vp_override(ctx, GL_TRUE); - swrast_render_start(ctx); - if (ctx->NewState) _mesa_update_state(ctx); @@ -749,7 +759,6 @@ _swrast_DrawPixels( struct gl_context *ctx, pixels = _mesa_map_pbo_source(ctx, unpack, pixels); if (!pixels) { - swrast_render_finish(ctx); _mesa_set_vp_override(ctx, save_vp_override); return; } @@ -759,20 +768,25 @@ _swrast_DrawPixels( struct gl_context *ctx, */ switch (format) { case GL_STENCIL_INDEX: + swrast_render_start(ctx); draw_stencil_pixels( ctx, x, y, width, height, type, unpack, pixels ); + swrast_render_finish(ctx); break; case GL_DEPTH_COMPONENT: + swrast_render_start(ctx); draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels ); + swrast_render_finish(ctx); break; case GL_DEPTH_STENCIL_EXT: + swrast_render_start(ctx); draw_depth_stencil_pixels(ctx, x, y, width, height, type, unpack, pixels); + swrast_render_finish(ctx); break; default: /* all other formats should be color formats */ draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels); } - swrast_render_finish(ctx); _mesa_set_vp_override(ctx, save_vp_override); _mesa_unmap_pbo_source(ctx, unpack); |