Merge from trunk (get RENDER_START, clip code movement)

This commit is contained in:
Brian Paul 2006-03-22 22:03:31 +00:00
parent 40cc5d36fd
commit 416f09d3e6
2 changed files with 29 additions and 13 deletions

View file

@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -31,6 +31,7 @@
#include "macros.h"
#include "imports.h"
#include "pixel.h"
#include "state.h"
#include "s_context.h"
#include "s_drawpix.h"
@ -67,9 +68,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
if (ctx->Texture._EnabledCoordUnits)
_swrast_span_default_texcoords(ctx, &span);
if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
if ((swrast->_RasterMask & ~CLIP_BIT) == 0
&& ctx->Texture._EnabledCoordUnits == 0
&& unpack->Alignment == 1
&& unpack->Alignment == 1 /* XXX may not really need this */
&& !unpack->SwapBytes
&& !unpack->LsbFirst) {
@ -694,7 +695,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
if (ctx->Texture._EnabledCoordUnits)
_swrast_span_default_texcoords(ctx, &span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
if (swrast->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
&& x + width <= (GLint) ctx->DrawBuffer->Width
&& y + height <= (GLint) ctx->DrawBuffer->Height
&& ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1) {
@ -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) {

View file

@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -33,6 +33,7 @@
#include "macros.h"
#include "imports.h"
#include "pixel.h"
#include "state.h"
#include "s_context.h"
#include "s_depth.h"
@ -509,6 +510,15 @@ _swrast_ReadPixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_pixelstore_attrib clippedPacking = *packing;
/* Need to do RENDER_START before clipping or anything else since this
* is where a driver may grab the hw lock and get an updated window
* size.
*/
RENDER_START(swrast, ctx);
if (ctx->NewState)
_mesa_update_state(ctx);
if (swrast->NewState)
_swrast_validate_derived( ctx );
@ -525,7 +535,7 @@ _swrast_ReadPixels( GLcontext *ctx,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glReadPixels(invalid PBO access)");
return;
goto end;
}
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
GL_WRITE_ONLY_ARB,
@ -533,13 +543,11 @@ _swrast_ReadPixels( GLcontext *ctx,
if (!buf) {
/* buffer is already mapped - that's an error */
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
return;
goto end;
}
pixels = ADD_POINTERS(buf, pixels);
}
RENDER_START(swrast, ctx);
switch (format) {
case GL_COLOR_INDEX:
read_index_pixels(ctx, x, y, width, height, type, pixels,
@ -576,6 +584,8 @@ _swrast_ReadPixels( GLcontext *ctx,
/* don't return yet, clean-up */
}
end:
RENDER_FINISH(swrast, ctx);
if (clippedPacking.BufferObj->Name) {