From d317cbc86b53047bcd9373e838945da75b80639f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sun, 5 Jul 2015 11:22:38 -0600 Subject: [PATCH] Fix offsets in OmpEvalStencils when start is non-zero. --- opensubdiv/osd/ompKernel.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/opensubdiv/osd/ompKernel.cpp b/opensubdiv/osd/ompKernel.cpp index 5220e985..05deed5c 100644 --- a/opensubdiv/osd/ompKernel.cpp +++ b/opensubdiv/osd/ompKernel.cpp @@ -80,11 +80,8 @@ OmpEvalStencils(float const * src, BufferDescriptor const &srcDesc, int const * indices, float const * weights, int start, int end) { - if (start > 0) { - sizes += start; - indices += offsets[start]; - weights += offsets[start]; - } + start = (start > 0 ? start : 0); + src += srcDesc.offset; dst += dstDesc.offset; @@ -96,7 +93,7 @@ OmpEvalStencils(float const * src, BufferDescriptor const &srcDesc, #pragma omp parallel for for (int i = 0; i < n; ++i) { - int index = i + (start > 0 ? start : 0); // Stencil index + int index = i + start; // Stencil index // Get thread-local pointers int const * threadIndices = indices + offsets[index]; @@ -129,13 +126,7 @@ OmpEvalStencils(float const * src, BufferDescriptor const &srcDesc, float const * duWeights, float const * dvWeights, int start, int end) { - if (start > 0) { - sizes += start; - indices += offsets[start]; - weights += offsets[start]; - duWeights += offsets[start]; - dvWeights += offsets[start]; - } + start = (start > 0 ? start : 0); src += srcDesc.offset; dst += dstDesc.offset; @@ -152,7 +143,7 @@ OmpEvalStencils(float const * src, BufferDescriptor const &srcDesc, #pragma omp parallel for for (int i = 0; i < n; ++i) { - int index = i + (start > 0 ? start : 0); // Stencil index + int index = i + start; // Stencil index // Get thread-local pointers int const * threadIndices = indices + offsets[index];