summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-26 18:39:14 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-26 18:39:14 -0600
commitc6717a86420d7141013165f7acd50b3c3f751756 (patch)
tree3197fe2c153638388af14706ca4da5a8a59c9141 /src/mesa/state_tracker/st_cb_texture.c
parent78008dbcaaf74cac3b66dae103f631de94df6137 (diff)
fallback_copy_texsubimage() basically works now (at least w/ Xlib driver).
Have to map regions before calling get_tile()/put_tile(). Need to invert srcY of glCopyTexSubImage() depending on renderbuffers up/down orientation. Still need to invert image in fallback_copy_texsubimage() when needed.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 052035f988..e3a747fa74 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1070,6 +1070,8 @@ texture_face(GLenum target)
/**
* Do a CopyTexSubImage operation by mapping the source region and
* dest region and copying/converting pixels.
+ *
+ * Note: srcY=0=TOP of renderbuffer
*/
static void
fallback_copy_texsubimage(GLcontext *ctx,
@@ -1093,13 +1095,20 @@ fallback_copy_texsubimage(GLcontext *ctx,
dest_surf = pipe->get_tex_surface(pipe, mt,
face, level, destZ);
+ (void) pipe->region_map(pipe, dest_surf->region);
+ (void) pipe->region_map(pipe, src_surf->region);
+
data = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
src_surf->get_tile(src_surf, srcX, srcY, width, height, data);
- /* process pixels */
+ /* Do GL pixel transfer ops here */
+ /* Also, invert image if strb orientation is Y_0_TOP */
dest_surf->put_tile(dest_surf, destX, destY, width, height, data);
+ (void) pipe->region_unmap(pipe, dest_surf->region);
+ (void) pipe->region_unmap(pipe, src_surf->region);
+
free(data);
}
@@ -1109,6 +1118,9 @@ fallback_copy_texsubimage(GLcontext *ctx,
/**
* Do a CopyTex[Sub]Image using an optimized hardware (blit) path.
* Note that the region to copy has already been clip tested.
+ *
+ * Note: srcY=0=Bottom of renderbuffer
+ *
* \return GL_TRUE if success, GL_FALSE if failure (use a fallback)
*/
static void
@@ -1151,6 +1163,10 @@ do_copy_texsubimage(GLcontext *ctx,
assert(strb->surface);
assert(stImage->mt);
+ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+ srcY = strb->Base.Height - srcY - height;
+ }
+
src_format = strb->surface->format;
dest_format = stImage->mt->format;