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
AgeCommit message (Collapse)Author
2022-02-10Rebase on mastertemp-license-header-spdxCampbell Barton
2021-12-09Cleanup: move public doc-strings into headers for 'functions'Campbell Barton
Ref T92709
2021-11-26Geometry Nodes: deduplicate virtual array implementationsJacques Lucke
For some underlying data (e.g. spans) we had two virtual array implementations. One for the mutable and one for the immutable case. Now that most code does not deal with the virtual array implementations directly anymore (since rBrBd4c868da9f97a), we can get away with sharing one implementation for both cases. This means that we have to do a `const_cast` in a few places, but this is an implementation detail that does not leak into "user code" (only when explicitly casting a `VArrayImpl` to a `VMutableArrayImpl`, which should happen nowhere).
2021-11-26Fix: error in previous commitJacques Lucke
Forgot to actually slice the span in rB6b5e1cfacab4c4605ec2d7bfef360389afe849be.
2021-11-26Geometry Nodes: better devirtualization for sliced virtual arraysJacques Lucke
Under some circumstances that can lead to more than a 2x performance increase, because math nodes can better optimize for the case when the slice is a single value or span.
2021-11-26Geometry Nodes: avoid allocation when construct varray for single valueJacques Lucke
Previously, `GVArray::ForSingle` would always allocate a copy of the passed in value. Now it only does so when the value is too large or not trivial.
2021-11-25BLI: remove special cases for is_span and is_single methodsJacques Lucke
Those were not implemented consistently and don't really help in practice.
2021-11-16Geometry Nodes: refactor virtual array systemJacques Lucke
Goals of this refactor: * Simplify creating virtual arrays. * Simplify passing virtual arrays around. * Simplify converting between typed and generic virtual arrays. * Reduce memory allocations. As a quick reminder, a virtual arrays is a data structure that behaves like an array (i.e. it can be accessed using an index). However, it may not actually be stored as array internally. The two most important implementations of virtual arrays are those that correspond to an actual plain array and those that have the same value for every index. However, many more implementations exist for various reasons (interfacing with legacy attributes, unified iterator over all points in multiple splines, ...). With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and `GVMutableArray`) can be used like "normal values". They typically live on the stack. Before, they were usually inside a `std::unique_ptr`. This makes passing them around much easier. Creation of new virtual arrays is also much simpler now due to some constructors. Memory allocations are reduced by making use of small object optimization inside the core types. Previously, `VArray` was a class with virtual methods that had to be overridden to change the behavior of a the virtual array. Now,`VArray` has a fixed size and has no virtual methods. Instead it contains a `VArrayImpl` that is similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly, unless a new virtual array implementation is added. To support the small object optimization for many `VArrayImpl` classes, a new `blender::Any` type is added. It is similar to `std::any` with two additional features. It has an adjustable inline buffer size and alignment. The inline buffer size of `std::any` can't be relied on and is usually too small for our use case here. Furthermore, `blender::Any` can store additional user-defined type information without increasing the stack size. Differential Revision: https://developer.blender.org/D12986
2021-10-05Cleanup: use doxygen sectionsCampbell Barton
2021-09-15Geometry Nodes: multi threaded field evaluationJacques Lucke
This adds a new `ParallelMultiFunction` which wraps another multi-function and evaluates it with multiple threads. The speeds up field evaluation quite a bit (the effect is most noticeable when the number of evaluations and the field is large). There are still other single-threaded performance bottlenecks in field evaluation that will need to be solved separately. Most notably here is the process of copying the computed data into the position attribute in the Set Position node. Differential Revision: https://developer.blender.org/D12457
2021-06-28Functions: improve CPPTypeJacques Lucke
* Reduce code duplication. * Give methods more standardized names (e.g. `move_to_initialized` -> `move_assign`). * Support wrapping arbitrary C++ types, even those that e.g. are not copyable.
2021-05-14Functions: Expose set_all method for generic virtual arraysHans Goudey
This is very similar to rB5613c61275fe6 and rB0061150e4c90d, basically just exposing a `VMutableArray` method to its generic counterpart. This is quite important for curve point attributes to avoid a lookup for every point when there are multiple splines.
2021-05-10Functions: support materialize virtual array to initialized spanJacques Lucke
2021-04-29Function: add method to create shallow copy of virtual arrayJacques Lucke
Creating a shallow copy is sometimes useful to get a unique ptr for a virtual array when one only has a reference. It shouldn't be used usually, but sometimes its the fastest way to do correct ownership handling.
2021-04-29Functions: make copying virtual arrays to span more efficientJacques Lucke
Sometimes functions expect a span instead of a virtual array. If the virtual array is a span internally already, great. But if it is not (e.g. the position attribute on a mesh), the elements have to be copied over to a span. This patch makes the copying process more efficient by giving the compiler more opportunity for optimization.
2021-04-17Functions: extend virtual array functionalityJacques Lucke
This adds support for mutable virtual arrays and provides many utilities for creating virtual arrays for various kinds of data. This commit is preparation for D10994.
2021-03-21Functions: refactor virtual array data structuresJacques Lucke
When a function is executed for many elements (e.g. per point) it is often the case that some parameters are different for every element and other parameters are the same (there are some more less common cases). To simplify writing such functions one can use a "virtual array". This is a data structure that has a value for every index, but might not be stored as an actual array internally. Instead, it might be just a single value or is computed on the fly. There are various tradeoffs involved when using this data structure which are mentioned in `BLI_virtual_array.hh`. It is called "virtual", because it uses inheritance and virtual methods. Furthermore, there is a new virtual vector array data structure, which is an array of vectors. Both these types have corresponding generic variants, which can be used when the data type is not known at compile time. This is typically the case when building a somewhat generic execution system. The function system used these virtual data structures before, but now they are more versatile. I've done this refactor in preparation for the attribute processor and other features of geometry nodes. I moved the typed virtual arrays to blenlib, so that they can be used independent of the function system. One open question for me is whether all the generic data structures (and `CPPType`) should be moved to blenlib as well. They are well isolated and don't really contain any business logic. That can be done later if necessary.