diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-04 13:38:54 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-04 13:38:54 +0300 |
commit | 4dfc846fe3d8056b8d58e042846100ef6eff83c6 (patch) | |
tree | 199b42021e0086ea8455959739d861c4cfda555a /intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc | |
parent | 3c04ef63f896fbe4c63f6b1a090546370a41c8ad (diff) |
OpenSubdiv: Disable varying elements interpolation
We currently don't use those. Skipping creation of stencils for
them gives about 7% speedup of evaluation creation.
Diffstat (limited to 'intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc')
-rw-r--r-- | intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc index 36795812f17..f740a0e0d77 100644 --- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc +++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc @@ -702,7 +702,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( return NULL; } // TODO(sergey): Base this on actual topology. - // const bool has_varying_data = false; + const bool has_varying_data = false; const int num_face_varying_channels = refiner->GetNumFVarChannels(); const bool has_face_varying_data = (num_face_varying_channels != 0); const int level = topology_refiner->getSubdivisionLevel(topology_refiner); @@ -733,13 +733,15 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( // TODO(sergey): Seems currently varying stencils are always required in // OpenSubdiv itself. const StencilTable* varying_stencils = NULL; - StencilTableFactory::Options varying_stencil_options; - varying_stencil_options.generateOffsets = true; - varying_stencil_options.generateIntermediateLevels = is_adaptive; - varying_stencil_options.interpolationMode = - StencilTableFactory::INTERPOLATE_VARYING; - varying_stencils = - StencilTableFactory::Create(*refiner, varying_stencil_options); + if (has_varying_data) { + StencilTableFactory::Options varying_stencil_options; + varying_stencil_options.generateOffsets = true; + varying_stencil_options.generateIntermediateLevels = is_adaptive; + varying_stencil_options.interpolationMode = + StencilTableFactory::INTERPOLATE_VARYING; + varying_stencils = + StencilTableFactory::Create(*refiner, varying_stencil_options); + } // Face warying stencil. vector<const StencilTable*> all_face_varying_stencils; #ifdef OPENSUBDIV_HAS_FVAR_EVALUATION @@ -769,6 +771,7 @@ vector<const StencilTable*> all_face_varying_stencils; const PatchTable* patch_table = PatchTableFactory::Create( *refiner, patch_options); // Append local points stencils. + // Point stencils. const StencilTable* local_point_stencil_table = patch_table->GetLocalPointStencilTable(); if (local_point_stencil_table != NULL) { @@ -778,14 +781,17 @@ vector<const StencilTable*> all_face_varying_stencils; delete vertex_stencils; vertex_stencils = table; } - const StencilTable* local_point_varying_stencil_table = - patch_table->GetLocalPointVaryingStencilTable(); - if (local_point_varying_stencil_table != NULL) { - const StencilTable* table = - StencilTableFactory::AppendLocalPointStencilTable( - *refiner, varying_stencils, local_point_varying_stencil_table); - delete varying_stencils; - varying_stencils = table; + // Varying stencils. + if (has_varying_data) { + const StencilTable* local_point_varying_stencil_table = + patch_table->GetLocalPointVaryingStencilTable(); + if (local_point_varying_stencil_table != NULL) { + const StencilTable* table = + StencilTableFactory::AppendLocalPointStencilTable( + *refiner, varying_stencils, local_point_varying_stencil_table); + delete varying_stencils; + varying_stencils = table; + } } #ifdef OPENSUBDIV_HAS_FVAR_EVALUATION for (int face_varying_channel = 0; |