From 9b75627fab5bf2ea90f27ddd31b60c54895f6de6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 15 Apr 2009 15:53:34 +0200 Subject: 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 --- src/mesa/state_tracker/st_cb_readpixels.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mesa/state_tracker/st_cb_readpixels.c') diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 9ce5f3fe84..519ad6660f 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -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) { -- cgit v1.2.3