[Bf-blender-cvs] [e1423391621] blender2.8: Fix compilation with older OpenSubdiv libraries

Sergey Sharybin noreply at git.blender.org
Mon Jul 16 12:57:02 CEST 2018


Commit: e1423391621dcc72e55144541cb26b540698edba
Author: Sergey Sharybin
Date:   Mon Jul 16 12:55:39 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe1423391621dcc72e55144541cb26b540698edba

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.

===================================================================

M	intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc

===================================================================

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 <opensubdiv/osd/cpuVertexBuffer.h>
 #include <opensubdiv/osd/mesh.h>
 #include <opensubdiv/osd/types.h>
+#include <opensubdiv/version.h>
 
 #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 =



More information about the Bf-blender-cvs mailing list