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-11-08BLI: new basic CacheMutexJacques Lucke
This patch introduces a new `CacheMutex` which makes it easy to implement lazily computed caches in e.g. `Curves`. For more details see `BLI_cache_mutex.hh`. Differential Revision: https://developer.blender.org/D16419
2022-10-03Cleanup: sort cmake file listsCampbell Barton
2022-10-03CMake: add missing headersCampbell Barton
2022-09-21Cleanup: remove vector adaptor data structureJacques Lucke
This was used in early node based particle system development but is not used anymore. The code also didn't match the standards of other data structures in blenlib.
2022-09-20Geometry Nodes: improve evaluator with lazy threadingJacques Lucke
In large node setup the threading overhead was sometimes very significant. That's especially true when most nodes do very little work. This commit improves the scheduling by not using multi-threading in many cases unless it's likely that it will be worth it. For more details see the comments in `BLI_lazy_threading.hh`. Differential Revision: https://developer.blender.org/D15976
2022-09-18Build: fix gtest build flags affecting actual libraryBrecht Van Lommel
Switch to target_ functions to avoid this.
2022-09-13Geometry Nodes: Port the trim curve node to the new data-blockMattias Fredriksson
The trim functionality is implemented in the geometry module, and generalized a bit to be potentially useful for bisecting in the future. The implementation is based on a helper type called `IndexRangeCyclic` which allows iteration over all control points between two points on a curve. Catmull Rom curves are now supported-- trimmed without resampling first. However, maintaining the exact shape is not possible. NURBS splines are still converted to polylines using the evaluated curve concept. Performance is equivalent or faster then a 3.1 build with regards to node timings. Compared to 3.3 and 3.2, it's easy to observe test cases where the node is at least 3 or 4 times faster. Differential Revision: https://developer.blender.org/D14481
2022-09-13CMake: exclude BLI_args when building as a Python moduleCampbell Barton
2022-09-13Geometry Nodes: new evaluation systemJacques Lucke
This refactors the geometry nodes evaluation system. No changes for the user are expected. At a high level the goals are: * Support using geometry nodes outside of the geometry nodes modifier. * Support using the evaluator infrastructure for other purposes like field evaluation. * Support more nodes, especially when many of them are disabled behind switch nodes. * Support doing preprocessing on node groups. For more details see T98492. There are fairly detailed comments in the code, but here is a high level overview for how it works now: * There is a new "lazy-function" system. It is similar in spirit to the multi-function system but with different goals. Instead of optimizing throughput for highly parallelizable work, this system is designed to compute only the data that is actually necessary. What data is necessary can be determined dynamically during evaluation. Many lazy-functions can be composed in a graph to form a new lazy-function, which can again be used in a graph etc. * Each geometry node group is converted into a lazy-function graph prior to evaluation. To evaluate geometry nodes, one then just has to evaluate that graph. Node groups are no longer inlined into their parents. Next steps for the evaluation system is to reduce the use of threads in some situations to avoid overhead. Many small node groups don't benefit from multi-threading at all. This is much easier to do now because not everything has to be inlined in one huge node tree anymore. Differential Revision: https://developer.blender.org/D15914
2022-09-07BLI: new C++ BitVector data structureJacques Lucke
This adds a new `blender::BitVector` data structure that was requested a couple of times. It also replaces usages of `BLI_bitmap` in C++ code. See the comment in `BLI_bit_vector.hh` for more details about the advantages and disadvantages of using a bit-vector and how the new data structure compares to `std::vector<bool>` and `BLI_bitmap`. Differential Revision: https://developer.blender.org/D14006
2022-09-06BLI: Add new `blender::Pool` containerClément Foucault
A `blender::Pool` can construct and destruct elements without reordering. Freed items memory will be reused by next allocations. Elements are allocated in chunks to reduce memory fragmentation and avoid reallocation. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D15894
2022-08-18CMake: support building with musl libclistout
Instead of using macros like GLIBC we can use the CMake build systems internal functions to check if some header or functions are present on the running system's libc. Add ./build_files/cmake/have_features.cmake to add checks for platform features which can be used to set defines for source files that require them. Reviewed By: campbellbarton Ref D15696
2022-07-15BLI_bitmap: ability to declare by-value, and function to find lowest unset bitAras Pranckevicius
In preparation for a larger change (D14162), some BLI_bitmap functionality that could be submitted separately: - Ability to declare a fixed size bitmap by-value, without extra memory allocation: BLI_BITMAP_DECLARE - Function to find the index of lowest unset bit: BLI_bitmap_find_first_unset - Test coverage of the above. Reviewed By: Campbell Barton, Bastien Montagne Differential Revision: https://developer.blender.org/D15454
2022-06-21Fix T99033: KDTree deduplication can erase valuesChris Blackbourn
Differential Revision: https://developer.blender.org/D15220
2022-05-06BLI: Add float3x3Omar Emara
This patch adds a float3x3 class that represents a 3x3 matrix. The class can be used to represent a 2D affine transformation stored in a 3x3 matrix in column major order. The class provides various constructors and processing methods, which utilizes the existing mat3 utilities in BLI. Corresponding tests were also added. This is needed by the upcoming viewport compositor to represent domain transformations. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14687
2022-05-05Cleanup: sort cmake file listsCampbell Barton
2022-04-26Geometry Nodes: refactor array devirtualizationJacques Lucke
Goals: * Better high level control over where devirtualization occurs. There is always a trade-off between performance and compile-time/binary-size. * Simplify using array devirtualization. * Better performance for cases where devirtualization wasn't used before. Many geometry nodes accept fields as inputs. Internally, that means that the execution functions have to accept so called "virtual arrays" as inputs. Those can be e.g. actual arrays, just single values, or lazily computed arrays. Due to these different possible virtual arrays implementations, access to individual elements is slower than it would be if everything was just a normal array (access does through a virtual function call). For more complex execution functions, this overhead does not matter, but for small functions (like a simple addition) it very much does. The virtual function call also prevents the compiler from doing some optimizations (e.g. loop unrolling and inserting simd instructions). The solution is to "devirtualize" the virtual arrays for small functions where the overhead is measurable. Essentially, the function is generated many times with different array types as input. Then there is a run-time dispatch that calls the best implementation. We have been doing devirtualization in e.g. math nodes for a long time already. This patch just generalizes the concept and makes it easier to control. It also makes it easier to investigate the different trade-offs when it comes to devirtualization. Nodes that we've optimized using devirtualization before didn't get a speedup. However, a couple of nodes are using devirtualization now, that didn't before. Those got a 2-4x speedup in common cases. * Map Range * Random Value * Switch * Combine XYZ Differential Revision: https://developer.blender.org/D14628
2022-04-21Commit D14179: Revamp Vertex Paint With C++Joseph Eagar
- Verrtex paint mode has been refactored into C++ templates. It now works with both byte and float colors and point & corner attribute domains. - There is a new API for mixing colors (also based on C++ templates). Unlike the existing APIs byte and float colors are interpolated identically. Interpolation does happen in a squared rgb space, this may be changed in the future. - Vertex paint now uses the sculpt undo system. Reviewed By: Brecht Van Lommel. Differential Revision: https://developer.blender.org/D14179 Ref D14179
2022-04-15Fix: Apply tilt in curves data-block normals calculationHans Goudey
The ported normal calculation from ceed37fc5cbb466a0 neglected to use the tilt attribute to rotate the normals around the tangents. This commit adds that behavior back, adding a new math header file to avoid duplicating the rotation function for normalized axes. Differential Revision: https://developer.blender.org/D14655
2022-03-30Curves: Add length cache, length paramerterize utilityHans Goudey
This commit adds calculation of lengths along the curve for each evaluated point. This is used for sampling, resampling, the "curve parameter" node, and potentially more places in the future. This commit also includes a utility for calculation of uniform samples in blenlib. It can find evenlyspaced samples along a sequence of points and use linear interpolation to move data from those points to the samples. Making the utility more general aligns better with the more functional approach of the new curves code and makes the behavior available elsewhere. A "color math" header is added to allow very basic interpolation between two colors in the `blender::math` namespace. Differential Revision: https://developer.blender.org/D14382
2022-03-25Cleanup: sort cmake file listsCampbell Barton
2022-03-22Fix build when using WITH_TBB=OFF after recent changesBrecht Van Lommel
And wrap tbb::parallel_sort in blender namespace similar to other TBB functionality.
2022-03-19BLI: move generic data structures to blenlibJacques Lucke
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-18BLI: move CPPType to blenlibJacques Lucke
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367. Differential Revision: https://developer.blender.org/D14367
2022-02-23Curves: initial brush implementations for curves sculpt modeJacques Lucke
The main goal here is to add the boilerplate code to make it possible to add the actual sculpt tools more easily. Both brush implementations added by this patch are meant to be prototypes which will be removed or refined in the coming weeks. Ref T95773. Differential Revision: https://developer.blender.org/D14180
2022-02-23CMake: include missing filesCampbell Barton
Also use SRC_ prefix for source variables so cmake_consistency_check.py detects these files as being known to CMake.
2022-02-16BLI: Generalize short algorithm for finding boundsHans Goudey
Finding the greatest and/or smallest element in an array is a common need. This commit refactors the point cloud bounds code added in 6d7dbdbb44f379682 to a more general header in blenlib. This will allow reusing the algorithm for curves without duplicating it. Differential Revision: https://developer.blender.org/D14053
2022-02-16BLI: Implement templated math functions for basic typesHans Goudey
This is meant to complement the `blender::math` functions recently added by D13791. It's sometimes desired to template an operation to work on vector types, but also basic types like `float` and `int`. This patch adds that ability with a new `BLI_math_base.hh` header. The existing vector math header is changed to use the `vec_base` type more explicitly, to allow the compiler's generic function overload resolution to determine which implementation of each math function to use. This is a relatively large change, but it also makes the file significantly easier to understand by reducing the use of macros. Differential Revision: https://developer.blender.org/D14113
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-01-28Cleanup: indentation for CMake filesCampbell Barton
Also minor white-space & case changes.
2022-01-24Cleanup: sort cmake file listsCampbell Barton
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:float2) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the blender::math namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: float3::reflect()). Upsides: - Still support .x, .y, .z, .w for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call len_squared_v3v3 in math::length_squared() and call it a day. - Type cast does not work with the template version of the math:: vector functions. Meaning you need to manually cast float * and (float *)[3] to float3 for the function calls. i.e: math::distance_squared(float3(nearest.co), positions[i]); - Some parts might loose in readability: float3::dot(v1.normalized(), v2.normalized()) becoming math::dot(math::normalize(v1), math::normalize(v2)) But I propose, when appropriate, to use using namespace blender::math; on function local or file scope to increase readability. dot(normalize(v1), normalize(v2)) Consideration: - Include back .length() method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches delaunay_2d.cc and the intersection code. I would like to know @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-07Remove dead numaapi code in blenlibSergey Sharybin
It it rather an old experiment now which didn't pay off. The initial idea was to have main and jobs threads on fast nodes of TR2 processors. This didn't really work reliably because in Blender we need to be able to create nested threads without their affinity set. This is not how some of OS are creating nested threads, and we don't always have access to child threads to reset their affinity. So overall complexity of the initial idea implementation became too much compared to the performance gain.
2022-01-06Cleanup: sort cmake file listsCampbell Barton
2021-12-21Fix T93960: Asset Catalogs I/O fails with unicode file paths on WindowsSybren A. Stüvel
On Windows, encode file paths as UTF-16 before trying to open the file for reading/writing. This introduces a new class `blender::fstream`, which wraps `std::fstream` and provides this UTF-16 encoding. This class should also be used in other areas, like the Alembic importer/exporter. Manifest Task: T93960 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13633
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-28Fix install paths for blender thumbnailer when not building a portable installSebastian Parborg
When doing a non portable build of blender, the executable blender-thumbnailer would be installed in two locations: /usr/bin/ /usr/ While cleaning up, also make the blender thumbnailer dll optional on windows to bring the logic in line with what it is on linux and mac. Reviewed By: Campbell Barton, Ray molenkamp Differential Revision: http://developer.blender.org/D13014
2021-10-26BlenLib: Add JSON Serialization/Deserialization Abstraction Layer.Jeroen Bakker
Adds an abstraction layer to switch between serialization formats. Currently only supports JSON. The abstraction layer supports `String`, `Int`, `Array`, `Null`, `Boolean`, `Float` and `Object`. This feature is only CPP complaint. To write from a stream, the structure can be built by creating a value (any subclass of `blender::io::serialize::Value` can do, and pass it to the `serialize` method of a `blender::io::serialize::Formatter`. The formatter is abstract and there is one implementation for JSON (`JsonFormatter`). To read from a stream use the `deserialize` method of the formatter. {D12693} uses this abstraction layer to read/write asset indexes. Reviewed By: Severin, sybren Maniphest Tasks: T91430 Differential Revision: https://developer.blender.org/D12544
2021-10-06Cleanup: move BLI_vfontdata.h to BKE_vfontdata.hCampbell Barton
This didn't belong on blenlib since it uses DNA data types and included a bad-level call to BKE_curve.h. It also meant linking in blenlib would depend on the freetype library, noticeable for thumbnail extraction (see D6408).
2021-10-03Cleanup: move resource scope method definitions out of classJacques Lucke
2021-09-17Blenlib: introduce a UUID typeSybren A. Stüvel
Add `BLI_uuid` and `DNA_uuid_types.h` with a UUID implementation following RFC4122 (https://datatracker.ietf.org/doc/html/rfc4122.html). The following features are implemented: - A struct of 128 bits that can be used in DNA definitions. - Generation of version 4 UUIDs, that is, purely random ones. - UUID equality function. - String to UUID and UUID to string conversion functions that are compatible with RFC4122. - C++ stream operator that outputs the UUID as string. This UUID will be used by the asset system, to uniquely identify asset catalogs. Reviewed By: Severin, jacqueslucke Differential Revision: https://developer.blender.org/D12475
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-09-10BLI: Add Cycles compatible Perlin noiseOmar Emara
This patch adds new Perlin noise functions to BLI. The noises are compatible with the shading texture noises in EEVEE, SVM, and OSL. The existing Jenkins hash functions couldn't be used because they are not compatible with the shading implementations and an attempt at adjusting the implementation will break compatibility in various areas of Blender. So the simplest approach is to reimplement the relevant hashing functions inside the noise module itself. Additionally, this patch also adds a minimal float4 structure to use in the interface of the noise functions. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D12443
2021-08-26Cleanup: soft CMake file listsCampbell Barton
2021-08-21Add support for Zstandard compression for .blend filesLukas Stockner
Compressing blendfiles can help save a lot of disk space, but the slowdown while loading and saving is a major annoyance. Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there are now several more modern algorithms that outperform it in every way. In this patch, I decided for Zstandard aka Zstd for several reasons: - It is widely supported, both in other programs and libraries as well as in general-purpose compression utilities on Unix - It is extremely flexible - spanning several orders of magnitude of compression speeds depending on the level setting. - It is pretty much on the Pareto frontier for all of its configurations (meaning that no other algorithm is both faster and more efficient). One downside of course is that older versions of Blender will not be able to read these files, but one can always just re-save them without compression or decompress the file manually with an external tool. The implementation here saves additional metadata into the compressed file in order to allow for efficient seeking when loading. This is standard-compliant and will be ignored by other tools that support Zstd. If the metadata is not present (e.g. because you manually compressed a .blend file with another tool), Blender will fall back to sequential reading. Saving is multithreaded to improve performance. Loading is currently not multithreaded since it's not easy to predict the access patterns of the loading code when seeking is supported. In the future, we might want to look into making this more predictable or disabling seeking for the main .blend file, which would then allow for multiple background threads that decompress data ahead of time. The compression level was chosen to get sizes comparable to previous versions at much higher speeds. In the future, this could be exposed as an option. Reviewed By: campbellbarton, brecht, mont29 Differential Revision: https://developer.blender.org/D5799
2021-08-21Refactor low-level blendfile reading into separate filesLukas Stockner
Instead of handling mmap, compression etc. all directly in readfile.c, refactor the code to use a generic FileReader. This makes it easier to add new compression methods or similar, and allows to reuse the logic in other places (e.g. thumbnail reading). Reviewed By: campbellbarton, brecht, mont29 Differential Revision: https://developer.blender.org/D5799