From f756924fa59b53f4951e2f817144bcb5e5765535 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Mar 2006 22:02:07 +0000 Subject: Need to check for new state and do readpixels/drawpixels clipping after we call RENDER_START since that may involve validating the drawable and updating its dimensions. --- src/mesa/swrast/s_drawpix.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/mesa/swrast/s_drawpix.c') diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index af1848a079..debfcde045 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -31,6 +31,7 @@ #include "macros.h" #include "imports.h" #include "pixel.h" +#include "state.h" #include "s_context.h" #include "s_drawpix.h" @@ -967,6 +968,11 @@ _swrast_DrawPixels( GLcontext *ctx, { SWcontext *swrast = SWRAST_CONTEXT(ctx); + RENDER_START(swrast,ctx); + + if (ctx->NewState) + _mesa_update_state(ctx); + if (swrast->NewState) _swrast_validate_derived( ctx ); @@ -977,7 +983,7 @@ _swrast_DrawPixels( GLcontext *ctx, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); - return; + goto end; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, @@ -985,13 +991,11 @@ _swrast_DrawPixels( GLcontext *ctx, if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - return; + goto end; } pixels = ADD_POINTERS(buf, pixels); } - RENDER_START(swrast,ctx); - switch (format) { case GL_STENCIL_INDEX: draw_stencil_pixels( ctx, x, y, width, height, type, unpack, pixels ); @@ -1027,6 +1031,8 @@ _swrast_DrawPixels( GLcontext *ctx, /* don't return yet, clean-up */ } +end: + RENDER_FINISH(swrast,ctx); if (unpack->BufferObj->Name) { -- cgit v1.2.3