summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_readpixels.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-04-15 15:53:34 +0200
committerThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-04-15 17:16:58 +0200
commit9b75627fab5bf2ea90f27ddd31b60c54895f6de6 (patch)
treeb748494fcd35bde9b8684742dc0b7ba0958acfcb /src/mesa/state_tracker/st_cb_readpixels.c
parentf94053eb7d3f129e5086f6dc431a13f83c93a189 (diff)
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>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_readpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c10
1 files changed, 9 insertions, 1 deletions
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) {