summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_readpixels.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-03-21 13:44:27 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-03-21 13:44:27 -0600
commitf1626f0bfd2b14ad8ca2afaad2ea8afb539e6491 (patch)
treeacd3ff1fff95a61945dd18e50587c65aa44f441d /src/mesa/state_tracker/st_cb_readpixels.c
parentff938bf059a41a9bdf4c2c93cebe4a3b8a89c201 (diff)
gallium: implement PBO operations for glDraw/ReadPixels and glBitmap
At this time there are no optimizations for directly blitting between buffer objects and surfaces (always go through mappings). glean pbo test passes now
Diffstat (limited to 'src/mesa/state_tracker/st_cb_readpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index c89c74229e..b22e846a15 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -34,6 +34,7 @@
#include "main/imports.h"
+#include "main/bufferobj.h"
#include "main/context.h"
#include "main/image.h"
@@ -126,7 +127,6 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
-
/**
* Do glReadPixels by getting rows from the framebuffer surface with
* get_tile(). Convert to requested format/type with Mesa image routines.
@@ -155,18 +155,15 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ dest = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height,
+ format, type,
+ &clippedPacking, dest);
+ if (!dest)
+ return;
+
/* make sure rendering has completed */
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
- if (pack->BufferObj && pack->BufferObj->Name) {
- /* reading into a PBO */
-
- }
- else {
- /* reading into user memory/buffer */
-
- }
-
if (format == GL_STENCIL_INDEX) {
st_read_stencil_pixels(ctx, x, y, width, height, type, pack, dest);
return;
@@ -285,6 +282,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
}
+
+ _mesa_unmap_readpix_pbo(ctx, &clippedPacking);
}