gallium: Make sure we flush before some texture / buffer operations.

Also implement context member functions to optimize away those
flushes whenever possible.

Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
This commit is contained in:
Thomas Hellstrom
2009-04-15 15:53:34 +02:00
parent f94053eb7d
commit 9b75627fab
22 changed files with 466 additions and 12 deletions

View File

@@ -42,13 +42,14 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
#include "st_context.h"
#include "st_cb_bitmap.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
/**
* Special case for reading stencil buffer.
@@ -73,6 +74,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* Create a read transfer from the renderbuffer's texture */
st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
PIPE_TRANSFER_READ);
pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
PIPE_TRANSFER_READ, x, y, width, height);
@@ -240,6 +245,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
y = strb->texture->height[0] - y - height;
}
st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
PIPE_TRANSFER_READ);
trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
PIPE_TRANSFER_READ, x, y, width, height);
if (!trans) {