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:
authorJacques Lucke <jacques@blender.org>2021-10-03 17:30:14 +0300
committerJacques Lucke <jacques@blender.org>2021-10-03 17:30:14 +0300
commit17e2d54a3d06c699bc736b5aebcb56e37fb203d4 (patch)
tree0d1569201f5b8768e19eb150249f84ec38169edf /source/blender/blenkernel/BKE_attribute_access.hh
parenta812fe8ceb75fd2befe44a151f1e214f357c24c2 (diff)
Cleanup: use extern templates for typed output attribute
This is very similar to rBa812fe8ceb75fd2b. This time the number of symbols decreases further from 1335 to 928. Compile time of the distribute node decreases from ~2.4s to ~2.3s.
Diffstat (limited to 'source/blender/blenkernel/BKE_attribute_access.hh')
-rw-r--r--source/blender/blenkernel/BKE_attribute_access.hh25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh
index ef43e21b739..baa918d9949 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -248,7 +248,7 @@ template<typename T> class OutputAttribute_Typed {
VMutableArray<T> *varray_ = nullptr;
public:
- OutputAttribute_Typed() = default;
+ OutputAttribute_Typed();
OutputAttribute_Typed(OutputAttribute attribute) : attribute_(std::move(attribute))
{
if (attribute_) {
@@ -257,8 +257,8 @@ template<typename T> class OutputAttribute_Typed {
}
}
- OutputAttribute_Typed(OutputAttribute_Typed &&other) = default;
- ~OutputAttribute_Typed() = default;
+ OutputAttribute_Typed(OutputAttribute_Typed &&other);
+ ~OutputAttribute_Typed();
OutputAttribute_Typed &operator=(OutputAttribute_Typed &&other)
{
@@ -316,6 +316,13 @@ template<typename T> class OutputAttribute_Typed {
}
};
+/* These are not defined in the class directly, because when defining them there, the external
+ * template instantiation does not work, resulting in longer compile times. */
+template<typename T> inline OutputAttribute_Typed<T>::OutputAttribute_Typed() = default;
+template<typename T>
+inline OutputAttribute_Typed<T>::OutputAttribute_Typed(OutputAttribute_Typed &&other) = default;
+template<typename T> inline OutputAttribute_Typed<T>::~OutputAttribute_Typed() = default;
+
/**
* A basic container around DNA CustomData so that its users
* don't have to implement special copy and move constructors.
@@ -501,3 +508,15 @@ template<typename T> inline MutableSpan<T> OutputAttribute::as_span()
}
} // namespace blender::bke
+
+/* --------------------------------------------------------------------
+ * Extern template instantiations that are defined in `intern/extern_implementations.cc`.
+ */
+
+namespace blender::bke {
+extern template class OutputAttribute_Typed<float>;
+extern template class OutputAttribute_Typed<int>;
+extern template class OutputAttribute_Typed<float3>;
+extern template class OutputAttribute_Typed<bool>;
+extern template class OutputAttribute_Typed<ColorGeometry4f>;
+} // namespace blender::bke