Mesa (master): nouveau: only swizzle square textures for copy

Patrice Mandin pmandin at kemper.freedesktop.org
Sun Jul 26 20:31:03 UTC 2009


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

Author: Patrice Mandin <patmandin at gmail.com>
Date:   Sun Jul 26 22:30:35 2009 +0200

nouveau: only swizzle square textures for copy

---

 src/gallium/drivers/nv04/nv04_surface_2d.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c
index ff4e511..aba40cf 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -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) {




More information about the mesa-commit mailing list