[Bf-blender-cvs] [90110d37329] master: Fix mistake in previous tangent space optimization

Sergey Sharybin noreply at git.blender.org
Fri Aug 25 21:30:35 CEST 2017


Commit: 90110d373291b2a9e3bfc2d20f58cb6829dc1515
Author: Sergey Sharybin
Date:   Fri Aug 25 21:29:59 2017 +0200
Branches: master
https://developer.blender.org/rB90110d373291b2a9e3bfc2d20f58cb6829dc1515

Fix mistake in previous tangent space optimization

===================================================================

M	intern/mikktspace/mikktspace.c

===================================================================

diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 2e8e58d37d4..b9de91e95c2 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -1679,16 +1679,17 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int
 	}
 	else if(iElems < 16) {
 		int i, j;
-		for (i = 0; i < iElems - 1; i++) {
-			for (j = 0; j < iElems - i - 1; j++) {
+		for (i = 0; i < iElems; i++) {
+			for (j = 0; j < iElems - 1; j++) {
 				int index = iLeft + j;
 				if (pSortBuffer[index].array[channel] > pSortBuffer[index + 1].array[channel]) {
 					sTmp = pSortBuffer[index];
-					pSortBuffer[index] = pSortBuffer[index];
+					pSortBuffer[index] = pSortBuffer[index + 1];
 					pSortBuffer[index + 1] = sTmp;
 				}
 			}
 		}
+		return;
 	}
 
 	// Random



More information about the Bf-blender-cvs mailing list