r300: fix glCopyTexSubImage
authorMaciej Cencora <m.cencora@gmail.com>
Sun, 13 Dec 2009 15:12:11 +0000 (16:12 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Sun, 13 Dec 2009 16:20:11 +0000 (17:20 +0100)
Need to properly setup colorbuffer when dst pitch != dst width.

src/mesa/drivers/dri/r300/r300_blit.c
src/mesa/drivers/dri/r300/r300_blit.h
src/mesa/drivers/dri/r300/r300_texcopy.c

index 10e1b3c9124885d0b84e8f23a42decd9a9398e93..ff678bac4548b02e2f03a6a3a3f12d1d597a8cc7 100644 (file)
@@ -428,6 +428,7 @@ static void emit_cb_setup(struct r300_context *r300,
                           struct radeon_bo *bo,
                           intptr_t offset,
                           gl_format mesa_format,
+                          unsigned pitch,
                           unsigned width,
                           unsigned height)
 {
@@ -448,7 +449,7 @@ static void emit_cb_setup(struct r300_context *r300,
 
     r300_emit_cb_setup(r300, bo, offset, mesa_format,
                        _mesa_get_format_bytes(mesa_format),
-                       _mesa_format_row_stride(mesa_format, width));
+                       _mesa_format_row_stride(mesa_format, pitch));
 
     BEGIN_BATCH_NO_AUTOSTATE(5);
     OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2);
@@ -468,18 +469,14 @@ GLboolean r300_blit(struct r300_context *r300,
                     struct radeon_bo *dst_bo,
                     intptr_t dst_offset,
                     gl_format dst_mesaformat,
+                    unsigned dst_pitch,
                     unsigned dst_width,
                     unsigned dst_height)
 {
-    //assert(src_width == dst_width);
-    //assert(src_height == dst_height);
-
     if (src_bo == dst_bo) {
         return GL_FALSE;
     }
 
-    //return GL_FALSE;
-
     if (0) {
         fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n",
                 src_width, src_height, src_pitch,
@@ -511,14 +508,13 @@ GLboolean r300_blit(struct r300_context *r300,
     emit_pvs_setup(r300, r300->blit.vp_code.body.d, 2);
     emit_vap_setup(r300, dst_width, dst_height);
 
-    emit_cb_setup(r300, dst_bo, dst_offset, dst_mesaformat, dst_width, dst_height);
+    emit_cb_setup(r300, dst_bo, dst_offset, dst_mesaformat, dst_pitch, dst_width, dst_height);
 
     emit_draw_packet(r300, dst_width, dst_height);
 
     r300EmitCacheFlush(r300);
 
     radeonFlush(r300->radeon.glCtx);
-    //r300ResetHwState(r300);
 
     return GL_TRUE;
 }
\ No newline at end of file
index 29c5aa95149cb2bae41bf6ad741ca9f9e324b3ea..28ffd4ea42118d63984c1bcce3b0d72c6e6bcef0 100644 (file)
@@ -40,6 +40,7 @@ GLboolean r300_blit(struct r300_context *r300,
                     struct radeon_bo *dst_bo,
                     intptr_t dst_offset,
                     gl_format dst_mesaformat,
+                    unsigned dst_pitch,
                     unsigned dst_width,
                     unsigned dst_height);
 
index 5e3a724d4e637698e794e7a78f09a8fbe36ab1d2..7702a1d67dfa057391f98ae2f585590df8447ec7 100644 (file)
@@ -63,7 +63,6 @@ do_copy_texsubimage(GLcontext *ctx,
     assert(timg->mt->bo);
     assert(timg->base.Width >= dstx + width);
     assert(timg->base.Height >= dsty + height);
-    //assert(tobj->mt == timg->mt);
 
     intptr_t src_offset = rrb->draw_offset + x * rrb->cpp + y * rrb->pitch;
     intptr_t dst_offset = radeon_miptree_image_offset(timg->mt, _mesa_tex_target_to_face(target), level);
@@ -87,7 +86,7 @@ do_copy_texsubimage(GLcontext *ctx,
     /* blit from src buffer to texture */
     return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch,
                      rrb->base.Width, rrb->base.Height, timg->mt->bo ? timg->mt->bo : timg->bo, dst_offset,
-                     timg->base.TexFormat, width, height);
+                     timg->base.TexFormat, timg->base.Width, width, height);
 }
 
 static void