summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_drawpix.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-03-22 22:02:07 +0000
committerBrian Paul <[email protected]>2006-03-22 22:02:07 +0000
commitf756924fa59b53f4951e2f817144bcb5e5765535 (patch)
tree923e495d3cf5537d9720469a34a805e63b1be2b6 /src/mesa/swrast/s_drawpix.c
parent4fafe6390bff5c746b3e46116d1fcada887bf3df (diff)
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.
Diffstat (limited to 'src/mesa/swrast/s_drawpix.c')
-rw-r--r--src/mesa/swrast/s_drawpix.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index af1848a079e..debfcde0450 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) {