From 12f3e5a38417e7156f7e0fed2366cfd463195f1f Mon Sep 17 00:00:00 2001 From: Takahito Tejima Date: Thu, 11 Jun 2015 13:41:20 -0700 Subject: [PATCH] Fix a bug in LimitStencilTableFactory If the input cv stencil is given and it includes the local point stencils for endcaps, LimitStencilTableFactory::Create failed because of incorrect sanity checking. --- opensubdiv/far/stencilTableFactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opensubdiv/far/stencilTableFactory.cpp b/opensubdiv/far/stencilTableFactory.cpp index afd98ca1..d332209d 100644 --- a/opensubdiv/far/stencilTableFactory.cpp +++ b/opensubdiv/far/stencilTableFactory.cpp @@ -353,7 +353,10 @@ LimitStencilTableFactory::Create(TopologyRefiner const & refiner, cvstencils = StencilTableFactory::Create(refiner, options); } else { // Sanity checks - if (cvstencils->GetNumStencils() != (uniform ? + // + // Note that the input cvStencils could be larger than the number of + // refiner's vertices, due to the existence of the end cap stencils. + if (cvstencils->GetNumStencils() < (uniform ? refiner.GetLevel(maxlevel).GetNumVertices() : refiner.GetNumVerticesTotal())) { return 0;