summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_drawpixels.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_drawpixels.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_drawpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index b4cd93cd54..c0f8e5ffdd 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -32,6 +32,7 @@
#include "main/imports.h"
#include "main/image.h"
+#include "main/bufferobj.h"
#include "main/macros.h"
#include "main/texformat.h"
#include "shader/program.h"
@@ -334,16 +335,17 @@ make_texture(struct st_context *st,
assert(pipeFormat);
cpp = st_sizeof_format(pipeFormat);
+ pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height,
+ format, type,
+ unpack, pixels);
+ if (!pixels)
+ return NULL;
+
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height,
1, 0);
- if (!pt)
+ if (!pt) {
+ _mesa_unmap_drapix_pbo(ctx, unpack);
return NULL;
-
- if (unpack->BufferObj && unpack->BufferObj->Name) {
- /*
- pt->region = buffer_object_region(unpack->BufferObj);
- */
- printf("st_DrawPixels (sourcing from PBO not implemented yet)\n");
}
{
@@ -388,6 +390,8 @@ make_texture(struct st_context *st,
ctx->_ImageTransferState = imageTransferStateSave;
}
+ _mesa_unmap_drapix_pbo(ctx, unpack);
+
return pt;
}
@@ -836,9 +840,9 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
bufferFormat = ps->format;
- if (any_fragment_ops(st) ||
+ if (1/*any_fragment_ops(st) ||
any_pixel_transfer_ops(st) ||
- !compatible_formats(format, type, ps->format)) {
+ !compatible_formats(format, type, ps->format)*/) {
/* textured quad */
struct pipe_texture *pt
= make_texture(ctx->st, width, height, format, type, unpack, pixels);