#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_texture.h"
-#include "st_inlines.h"
/**
* Special case for reading stencil buffer.
GLvoid *pixels)
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
- struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer);
struct pipe_transfer *pt;
ubyte *stmap;
GLint j;
+ if (strb->Base.Wrapped) {
+ strb = st_renderbuffer(strb->Base.Wrapped);
+ }
+
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
y = ctx->DrawBuffer->Height - y - height;
}
/* Create a read transfer from the renderbuffer's texture */
- pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
- 0, 0, 0,
- PIPE_TRANSFER_READ, x, y,
- width, height);
+ pt = pipe_get_transfer(pipe, strb->texture,
+ 0, 0, 0, /* face, level, zslice */
+ PIPE_TRANSFER_READ,
+ x, y, width, height);
/* map the stencil buffer */
stmap = pipe_transfer_map(pipe, pt);
/*printf("st_fast_readpixels combo %d\n", (GLint) combo);*/
{
- struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_transfer *trans;
const GLubyte *map;
GLubyte *dst;
y = strb->texture->height0 - y - height;
}
- trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
- 0, 0, 0,
- PIPE_TRANSFER_READ, x, y,
- width, height);
+ trans = pipe_get_transfer(pipe, strb->texture,
+ 0, 0, 0, /* face, level, zslice */
+ PIPE_TRANSFER_READ,
+ x, y, width, height);
if (!trans) {
return GL_FALSE;
}
const struct gl_pixelstore_attrib *pack,
GLvoid *dest)
{
- struct pipe_context *pipe = ctx->st->pipe;
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
GLfloat temp[MAX_WIDTH][4];
const GLbitfield transferOps = ctx->_ImageTransferState;
GLsizei i, j;
/* XXX convolution not done yet */
assert((transferOps & IMAGE_CONVOLUTION_BIT) == 0);
- st_validate_state(ctx->st);
+ st_validate_state(st);
/* Do all needed clipping here, so that we can forget about it later */
if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
return;
}
+ st_flush_bitmap_cache(st);
+
dest = _mesa_map_pbo_dest(ctx, &clippedPacking, dest);
if (!dest)
return;
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
if (format == GL_STENCIL_INDEX ||
format == GL_DEPTH_STENCIL) {
st_read_stencil_pixels(ctx, x, y, width, height,
}
else if (format == GL_DEPTH_COMPONENT) {
strb = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
+ if (strb->Base.Wrapped) {
+ strb = st_renderbuffer(strb->Base.Wrapped);
+ }
}
else {
/* Read color buffer */
}
/* Create a read transfer from the renderbuffer's texture */
- trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
- 0, 0, 0,
- PIPE_TRANSFER_READ, x, y,
- width, height);
+ trans = pipe_get_transfer(pipe, strb->texture,
+ 0, 0, 0, /* face, level, zslice */
+ PIPE_TRANSFER_READ,
+ x, y, width, height);
/* determine bottom-to-top vs. top-to-bottom order */
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {