From 90110d373291b2a9e3bfc2d20f58cb6829dc1515 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 25 Aug 2017 21:29:59 +0200 Subject: Fix mistake in previous tangent space optimization --- intern/mikktspace/mikktspace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- cgit v1.2.3