Mesa (master): gallium: Various coordinate fixups for texture transfers.

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Feb 18 15:51:10 UTC 2009


Module: Mesa
Branch: master
Commit: 7c8836e9ef49d938aa55a1c385b95c6371c301f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c8836e9ef49d938aa55a1c385b95c6371c301f1

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri Feb 13 17:34:29 2009 +0100

gallium: Various coordinate fixups for texture transfers.

Fixes glReadPixels, gl(Copy)TexSubImage, glCopyPixels.

---

 src/mesa/state_tracker/st_cb_drawpixels.c |    4 ++--
 src/mesa/state_tracker/st_cb_readpixels.c |    8 ++++----
 src/mesa/state_tracker/st_cb_texture.c    |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index b56dd36..9a84f04 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -780,7 +780,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
          }
          else {
             if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-               spanY = ctx->DrawBuffer->Height - spanY - 1;
+               spanY = height - spanY - 1;
             }
 
             switch (pt->format) {
@@ -925,7 +925,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       y = i;
 
       if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-         y = ctx->DrawBuffer->Height - y - 1;
+         y = height - y - 1;
       }
 
       dst = drawMap + y * ptDraw->stride;
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index e763827..5a4a7f0 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -213,7 +213,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
       GLint row, col, dy, dstStride;
 
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         y = strb->texture->height[0] - y - 1;
+         y = strb->texture->height[0] - y - height;
       }
 
       trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
@@ -229,7 +229,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
       }
 
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         y = height - y - 1;
+         y = height - 1;
          dy = -1;
       }
       else {
@@ -365,7 +365,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    }
 
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      y = strb->Base.Height - 1 - y;
+      y = strb->Base.Height - y - height;
    }
 
    /* Create a read transfer from the renderbuffer's texture */
@@ -374,7 +374,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
 
    /* determine bottom-to-top vs. top-to-bottom order */
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      y = trans->height - 1 - y;
+      y = height - 1;
       yStep = -1;
    }
    else {
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index ec981e8..3b77184 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -817,7 +817,7 @@ st_TexSubimage(GLcontext * ctx,
       if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
 					   texImage->TexFormat,
 					   texImage->Data,
-					   xoffset, yoffset, 0,
+					   0, 0, 0,
 					   dstRowStride,
 					   texImage->ImageOffsets,
 					   width, height, 1,
@@ -934,7 +934,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
    assert(width <= MAX_WIDTH);
 
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      srcY = strb->Base.Height - 1 - srcY;
+      srcY = strb->Base.Height - srcY - height;
    }
 
    src_trans = pipe->screen->get_tex_transfer( pipe->screen,
@@ -954,7 +954,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
 
       /* determine bottom-to-top vs. top-to-bottom order for src buffer */
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         srcY = height - 1 - srcY;
+         srcY = height - 1;
          yStep = -1;
       }
       else {




More information about the mesa-commit mailing list