diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-25 16:19:07 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-25 16:19:07 +0000 |
commit | 3e980901b0882226d47cc4e733e7fb3757fa9c3b (patch) | |
tree | 39b193e1bf0bd935ff353dd1df91832f51c6039d | |
parent | 14fe63a12b8ad7637e4af3541231a6254db86d56 (diff) |
check if copying from FBO, adjust x, y accordingly
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_tex_copy.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tex_copy.c b/src/mesa/drivers/dri/i915/intel_tex_copy.c index a0b23c4f4c..aa3dd198e2 100644 --- a/src/mesa/drivers/dri/i915/intel_tex_copy.c +++ b/src/mesa/drivers/dri/i915/intel_tex_copy.c @@ -100,13 +100,11 @@ static GLboolean do_copy_texsubimage( struct intel_context *intel, intelFlush(ctx); LOCK_HARDWARE(intel); { - __DRIdrawablePrivate *dPriv = intel->driDrawable; GLuint image_offset = intel_miptree_image_offset(intelImage->mt, intelImage->face, intelImage->level); const GLint orig_x = x; const GLint orig_y = y; - GLuint window_y; const struct gl_framebuffer *fb = ctx->DrawBuffer; if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, @@ -116,12 +114,20 @@ static GLboolean do_copy_texsubimage( struct intel_context *intel, dstx += x - orig_x; dsty += y - orig_y; - x += dPriv->x; - - window_y = intel->intelScreen->height - (dPriv->y + dPriv->h); - - y = window_y + y; - + if (ctx->ReadBuffer->Name == 0) { + /* reading from a window, adjust x, y */ + __DRIdrawablePrivate *dPriv = intel->driDrawable; + GLuint window_y; + /* window_y = position of window on screen if y=0=bottom */ + window_y = intel->intelScreen->height - (dPriv->y + dPriv->h); + y = window_y + y; + x += dPriv->x; + } + else { + /* reading from a FBO */ + /* invert Y */ + y = ctx->ReadBuffer->Height - y - 1; + } /* A bit of fiddling to get the blitter to work with -ve @@ -249,6 +255,8 @@ void intelCopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texUnit, target, level); GLenum internalFormat = texImage->InternalFormat; + /* XXX need to check <border> as in above function? */ + /* Need to check texture is compatible with source format. */ |