#include "image.h"
#include "mtypes.h"
#include "pack.h"
-#include "pbo.h"
#include "state.h"
/* Do all needed clipping here, so that we can forget about it later */
if (_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
- pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels);
-
if (pixels) {
switch (format) {
case GL_STENCIL_INDEX:
read_rgba_pixels(ctx, x, y, width, height, format, type, pixels,
&clippedPacking);
}
-
- _mesa_unmap_pbo_dest(ctx, &clippedPacking);
}
}
}
void GLAPIENTRY
-_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei bufSize,
- GLvoid *pixels )
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (width == 0 || height == 0)
return; /* nothing to do */
- if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
- format, type, bufSize, pixels)) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(out of bounds PBO access)");
- } else {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadnPixelsARB(out of bounds access:"
- " bufSize (%d) is too small)", bufSize);
- }
- return;
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj) &&
- _mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
- /* buffer is mapped - that's an error */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
- return;
- }
-
ctx->Driver.ReadPixels(ctx, x, y, width, height,
format, type, &ctx->Pack, pixels);
}
-
-void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels )
-{
- _mesa_ReadnPixelsARB(x, y, width, height, format, type, INT_MAX, pixels);
-}