From e1423391621dcc72e55144541cb26b540698edba Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 16 Jul 2018 12:55:39 +0200 Subject: [PATCH] Fix compilation with older OpenSubdiv libraries Only fixes compilation error, the functionality will be limited. Currently we don't care that much, since all the work is done in the branch anyway. Later on when we'll know which fixes we need to apply on top of latest OpenSubdiv library we will call a library upgrade. --- .../internal/opensubdiv_evaluator_internal.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc index 595df3eaa75..d593518405f 100644 --- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc +++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" @@ -52,6 +53,13 @@ using OpenSubdiv::Far::StencilTable; using OpenSubdiv::Far::StencilTableFactory; using OpenSubdiv::Far::TopologyRefiner; +// TODO(sergey): Remove after official requirement bump for OSD version. +#if OPENSUBDIV_VERSION_NUMBER >= 30200 +# define OPENSUBDIV_HAS_FVAR_EVALUATION +#else +# undef OPENSUBDIV_HAS_FVAR_EVALUATION +#endif + namespace opensubdiv_capi { namespace { @@ -652,6 +660,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( StencilTableFactory::Create(*refiner, varying_stencil_options); // Face warying stencil. const StencilTable* face_varying_stencils = NULL; +#ifdef OPENSUBDIV_HAS_FVAR_EVALUATION if (has_face_varying_data) { StencilTableFactory::Options face_varying_stencil_options; face_varying_stencil_options.generateOffsets = true; @@ -664,6 +673,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( face_varying_stencils = StencilTableFactory::Create(*refiner, face_varying_stencil_options); } +#endif // Generate bi-cubic patch table for the limit surface. // TODO(sergey): Ideally we would want to expose end-cap settings via // C-API to make it more generic. Currently it matches old Blender's @@ -694,6 +704,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( delete varying_stencils; varying_stencils = table; } +#ifdef OPENSUBDIV_HAS_FVAR_EVALUATION const StencilTable* local_point_face_varying_stencil_table = patch_table->GetLocalPointFaceVaryingStencilTable(); if (local_point_face_varying_stencil_table != NULL) { @@ -705,6 +716,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal( delete face_varying_stencils; face_varying_stencils = table; } +#endif // Create OpenSubdiv's CPU side evaluator. // TODO(sergey): Make it possible to use different evaluators. opensubdiv_capi::CpuEvalOutput* eval_output =