Commit Graph

54 Commits

Author SHA1 Message Date
Jacques Lucke
fe49e4139c Simulation: cleanup deduplicating attribute input nodes 2020-07-18 10:51:38 +02:00
Jacques Lucke
2679236047 Cleanup: avoid static initialization order issues when accessing CPPTypes
Instead of depending on static initialization order of globals use
static variables within functions. Those are initialized on first use.
This is every so slighly less efficient, but avoids a full class of problems.
2020-07-17 14:15:06 +02:00
Jacques Lucke
2ddb3dc617 Nodes: support default function for partially implemented nodes 2020-07-16 13:38:23 +02:00
Campbell Barton
123e29c274 Cleanup: missing CMake headers from source lists 2020-07-16 13:17:31 +10:00
Jacques Lucke
0718c6fae0 Cleanup: fix clang tidy warning
The code was actually correct, but clang tidy complaint about
using the Vector after it was moved from.
2020-07-13 10:40:05 +02:00
Jacques Lucke
838b1742fb Functions: minor improvements 2020-07-12 12:38:03 +02:00
Jacques Lucke
404486e66c Functions: minor api improvements 2020-07-12 10:01:37 +02:00
Jacques Lucke
c7eada103c Nodes: support implicit conversions and incorrectly linked sockets 2020-07-11 18:02:06 +02:00
Jacques Lucke
06401157a6 Fix: incorrect attribute type in network 2020-07-11 17:59:43 +02:00
Jacques Lucke
c806db6313 Functions: add utility to find dependencies of input sockets 2020-07-10 14:23:13 +02:00
Jacques Lucke
295b3aefb0 Functions: make constant folding work on unfinished networks 2020-07-10 14:23:13 +02:00
Jacques Lucke
8fd65a2252 Functions: use new is-equal and hash function of CPPType 2020-07-10 12:57:28 +02:00
Jacques Lucke
3edd2832b2 Functions: make generic types hashable 2020-07-10 12:57:28 +02:00
Jacques Lucke
8f6c0f2242 Functions: make generic types equality comparable 2020-07-10 12:57:28 +02:00
Jacques Lucke
52636c3059 Cleanup: various cleanups in for CPPType 2020-07-10 12:57:28 +02:00
Jacques Lucke
77a646279d Cleanup: structure CPPType according to code style guide 2020-07-10 12:04:49 +02:00
Campbell Barton
3dd460aa7f Cleanup: spelling 2020-07-10 11:49:46 +10:00
Jacques Lucke
31bc76ea4e Cleanup: remove unnecessary calls to as_span
This uses the new implicit conversions and constructors
that have been committed in the previous commit.

I tested these changes on Linux with gcc and on Windows.
2020-07-08 22:30:23 +02:00
Jacques Lucke
f7d5d4ee3b Cleanup: use c++17 helper variable templates 2020-07-08 20:39:20 +02:00
Jacques Lucke
f4a39cafa1 Functions: add AttributesRef class
This is the same as MutableAttributesRef, but the data in it cannot be changed.
2020-07-08 17:05:52 +02:00
Jacques Lucke
439c238bb4 Cleanup: use different internal socket name 2020-07-08 17:05:52 +02:00
Jacques Lucke
05365d1376 Functions: support hashing MFDataType and CPPType 2020-07-08 17:05:52 +02:00
Jacques Lucke
d1f4546a59 Functions: implement common subnetwork elimination optimization
This was the last of the three network optimizations I developed in
the functions branch. Common subnetwork elimination and constant
folding together can get rid of most unnecessary nodes.
2020-07-08 15:10:30 +02:00
Jacques Lucke
e3e42c00cb Functions: Support getting MFSocket based on its id 2020-07-08 15:10:30 +02:00
Jacques Lucke
2b9d62b73a Functions: Support accessing socket index of MFSocket 2020-07-08 15:10:30 +02:00
Jacques Lucke
34d175f372 Functions: initial hash/equals implementation for constant multi-functions 2020-07-08 15:10:30 +02:00
Jacques Lucke
840941215d Functions: allow multi-functions to override a hash and equals function 2020-07-08 15:10:30 +02:00
Jacques Lucke
45004d82e0 Functions: add dead node removal and constant folding optimization
Those optimizations work on the multi-function network level.
Not only will they make the network evaluation faster, but they also
simplify the network a lot. That makes it easier to understand the
exported dot graph.
2020-07-08 11:18:43 +02:00
Jacques Lucke
50d7c00d9c Cleanup: fix comment 2020-07-08 10:16:56 +02:00
Jacques Lucke
902ee4d13c Functions: cleanup loop that traverses the MFNetwork 2020-07-07 19:46:10 +02:00
Jacques Lucke
22158162ef Functions: add generic functions that output constants 2020-07-07 19:34:35 +02:00
Jacques Lucke
67042aa6a1 Functions: extend multi-function network api 2020-07-07 18:45:34 +02:00
Jacques Lucke
a8627ea66d Functions: Add debug print and destruct callback to CPPType 2020-07-07 18:39:24 +02:00
Jacques Lucke
395b294b61 Cleanup: use nested namespaces 2020-07-03 14:25:20 +02:00
Jacques Lucke
5fbf70b0d0 Cleanup: use trailing underscore for non-public data members 2020-07-03 14:20:42 +02:00
Jacques Lucke
c2ebf3edb4 Functions: provide dummy multi function
Sometimes it is convenient to be able to return a reference to some
dummy function.
2020-06-30 18:18:48 +02:00
Jacques Lucke
67da2bd23a Functions: add methods to multi-function network classes
Those are necessary to query and modify the network.
2020-06-30 18:18:48 +02:00
Jacques Lucke
d67b7f3b52 Functions: use raw allocator for function signature
This allows multi-functions to have static storage duration.
2020-06-30 18:18:48 +02:00
Jacques Lucke
613f62d15c Functions: add two more customizable multi-functions 2020-06-30 18:18:48 +02:00
Jacques Lucke
18bff53c99 BLI: remove blender::Optional in favor of std::optional
`std::optional` can be used now, because we switched to C++17.
2020-06-29 14:30:06 +02:00
Jacques Lucke
784911a4a0 Cleanup: rename namespace DotExport to dot 2020-06-29 11:53:17 +02:00
Jacques Lucke
ff82049642 Functions: add MutableAttributesRef data structure
This will be used to reference the content of a CustomData structure
in C++ code, that does not need to know who owns the data but only
works with it.
2020-06-27 20:58:35 +02:00
Jacques Lucke
2350159101 Cleanup: make it easier to check if a CPPType is a specific compile time type 2020-06-27 13:28:46 +02:00
Campbell Barton
fd5c185beb Cleanup: spelling 2020-06-25 23:14:36 +10:00
Jacques Lucke
072a224a28 Cleanup: remove some dead code 2020-06-23 12:23:46 +02:00
Jacques Lucke
3a3708cefb Functions: Multi Function Network
A multi-function network is a graph data structure, where nodes are
multi-functions (or dummies) and links represent data flow.
New multi-functions can be derived from such a network. For that
one just has to specify two sets of sockets in the network that
represent the inputs and outputs of the new function.

It is possible to do optimizations like constant folding on this
data structure, but that is not implemented in this patch yet.

In a next step, user generated node trees are converted into a
MFNetwork, so that they can be evaluated efficiently for many particles.

This patch also includes some tests that cover the majority of the code.
However, this seems to be the kind of code that is best tested by some
.blend files. Building graph structures in code is possible, but is
not easy to understand afterwards.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8049
2020-06-23 10:16:14 +02:00
Jacques Lucke
c94a1f5349 Functions: add utilities that allow creating some multi-functions with less typing 2020-06-22 15:50:31 +02:00
Jacques Lucke
6223385043 Functions: Various improvements to the spans and generic data structures
Most of this code is covered by unit tests.
2020-06-22 15:50:31 +02:00
Jacques Lucke
4365de3870 Functions: Multi Function
This adds the `MultiFunction` type and some smallish utility types that it uses.
A `MultiFunction` encapsulates a function that is optimized for throughput by
always processing many elements at once.

This is an important part of the new particle system, because it allows us to
execute user generated node trees for many particles efficiently.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8030
2020-06-16 16:35:57 +02:00
Campbell Barton
dea2c3f256 Cleanup: spelling 2020-06-13 12:50:07 +10:00