nouveau: only swizzle square textures for copy
authorPatrice Mandin <patmandin@gmail.com>
Sun, 26 Jul 2009 20:30:35 +0000 (22:30 +0200)
committerPatrice Mandin <patmandin@gmail.com>
Sun, 26 Jul 2009 20:30:35 +0000 (22:30 +0200)
src/gallium/drivers/nv04/nv04_surface_2d.c

index ff4e51178dc8a6ab43713595c45ce7d532fdb071..aba40cfaff7565f53fca99f6973d36d05bcb0c19 100644 (file)
@@ -263,10 +263,17 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
                int potHeight = 1<<log2i(h);
                int remainWidth = w-potWidth;
                int remainHeight = h-potHeight;
-
-               /* top left is always POT */
-               nv04_surface_copy_swizzle(ctx, dst, dx, dy, src, sx, sy,
-                                         potWidth, potHeight);
+               int squareDim = (potWidth>potHeight ? potHeight : potWidth);
+               int x,y;
+
+               /* top left is always POT, but we can only swizzle squares */
+               for (y=0; y<potHeight; y+=squareDim) {
+                       for (x=0; x<potWidth; x+= squareDim) {
+                               nv04_surface_copy_swizzle(ctx, dst, dx+x, dy+y,
+                                                         src, sx+x, sy+y,
+                                                         squareDim, squareDim);
+                       }
+               }
 
                /* top right */
                if (remainWidth>0) {