Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Ostrowski <postrowski>2020-09-30 16:47:08 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-30 17:39:02 +0300
commit53f20b940a1e520e131b8bb31cf0529ed4d30f9e (patch)
tree80ac24fc8b9e08a925a6cacd726c82b665a9eb79 /intern/opensubdiv
parentecdfb465cc9d992632feec13229fd31666f6b4e8 (diff)
Subdivision Surfaces: add option disable using the limit surface
This makes subdivision surfaces compatible with the old subdivision surface modifier and other applications that do not use the limit surface. This option is available on the Subdivision Surface modifier. Differential Revision: https://developer.blender.org/D8413
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r--intern/opensubdiv/internal/evaluator/evaluator_impl.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
index 341e8dbc233..b3fc021e1ee 100644
--- a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
+++ b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
@@ -232,6 +232,8 @@ class FaceVaryingVolatileEval {
src_face_varying_desc_.stride;
const EVALUATOR *eval_instance = OpenSubdiv::Osd::GetEvaluator<EVALUATOR>(
evaluator_cache_, src_face_varying_desc_, dst_face_varying_desc, device_context_);
+ // in and out points to same buffer so output is put directly after coarse vertices, needed in
+ // adaptive mode
EVALUATOR::EvalStencils(src_face_varying_data_,
src_face_varying_desc_,
src_face_varying_data_,
@@ -249,8 +251,21 @@ class FaceVaryingVolatileEval {
ConstPatchCoordWrapperBuffer patch_coord_buffer(patch_coord, num_patch_coords);
const EVALUATOR *eval_instance = OpenSubdiv::Osd::GetEvaluator<EVALUATOR>(
evaluator_cache_, src_face_varying_desc_, face_varying_desc, device_context_);
+
+ // src_face_varying_data_ always contains coarse vertices at the beginning.
+ // In adaptive mode they are followed by number of blocks for intermediate
+ // subdivision levels, and this is what OSD expects in this mode.
+ // In non-adaptive mode (generateIntermediateLevels == false),
+ // they are followed by max subdivision level, but they break interpolation as OSD
+ // expects only one subd level in this buffer.
+ // So in non-adaptive mode we put offset into buffer descriptor to skip over coarse vertices.
+ BufferDescriptor src_desc = src_face_varying_desc_;
+ if (!patch_table_->GetPatchArrayBuffer()[0].GetDescriptor().IsAdaptive()) {
+ src_desc.offset += num_coarse_face_varying_vertices_ * src_face_varying_desc_.stride;
+ }
+
EVALUATOR::EvalPatchesFaceVarying(src_face_varying_data_,
- src_face_varying_desc_,
+ src_desc,
&face_varying_data,
face_varying_desc,
patch_coord_buffer.GetNumVertices(),