Use the right pitch when rendering to a texture
authorOwen Taylor <otaylor@snell.localdomain>
Wed, 14 Oct 2009 20:20:07 +0000 (16:20 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Thu, 15 Oct 2009 15:33:08 +0000 (11:33 -0400)
We need to get the pitch from the texture level we are rendering to,
rather than just using the base texel width.

src/mesa/drivers/dri/radeon/radeon_fbo.c

index d83b166742c781014cc842b756c9f13f6b103d83..2012cbcf83815bd058f5fca1c874975177e6e44f 100644 (file)
@@ -445,7 +445,6 @@ restart:
                goto restart;
        }
        
-       rrb->pitch = texImage->Width * rrb->cpp;
        rrb->base.InternalFormat = rrb->base._ActualFormat;
        rrb->base.Width = texImage->Width;
        rrb->base.Height = texImage->Height;
@@ -555,8 +554,10 @@ radeon_render_texture(GLcontext * ctx,
       imageOffset += offsets[att->Zoffset];
    }
 
-   /* store that offset in the region */
+   /* store that offset in the region, along with the correct pitch for
+    * the image we are rendering to */
    rrb->draw_offset = imageOffset;
+   rrb->pitch = radeon_image->mt->levels[att->TextureLevel].rowstride;
 
    /* update drawing region, etc */
    radeon_draw_buffer(ctx, fb);