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
2020-08-10Tests: move remaining gtests into their own module foldersBrecht Van Lommel
And make them part of the blender_test runner. The one exception is blenlib performance tests, which we don't want to run by default. They remain in their own executable. Differential Revision: https://developer.blender.org/D8498
2020-07-31Merge branch 'blender-v2.90-release'Sergey Sharybin
2020-07-31BLI: Initial implementation of generic session UUID APISergey Sharybin
Covers basics like generation of new UUID. Also contains code needed to use the SessionUUID as a key in the Map.
2020-07-23BLI: move some tests into blenlib/testsJacques Lucke
Reviewers: sybren Differential Revision: https://developer.blender.org/D8315
2020-07-16BLI: move safe math functions to separate headerJacques Lucke
2020-07-08BLI: add disjoint set data structureJacques Lucke
This can be used to find separate islands in meshes efficiently (as is done in cycles already). Furthermore, this helps to implement some algorithms on node trees more efficiently.
2020-07-06BLI: improve exception safety of memory utilsJacques Lucke
Even if we do not use exception in many places in Blender, our core C++ library should become exception safe. Otherwise, we don't even have the option to work with exceptions if we decide to do so.
2020-06-29BLI: remove blender::Optional in favor of std::optionalJacques Lucke
`std::optional` can be used now, because we switched to C++17.
2020-06-18Tests: added simple unittests for matrix interpolationSybren A. Stüvel
The interpolation of 4x4 and 3x3 matrices will fail when the rotation component has a singularity, i.e. when there is one axis mirrored. Two mirrored axes are just a rotation of 180 degrees around the third, and three mirrored axes are such a rotation + a single axis mirror. To prepare for a fix, I first wanted to cover the basic functionality with a few unit tests. These tests check that `interpolate(A, B, alpha)` always returns `A` for `alpha=0`, always return `B` for `alpha=1`, and something in between for `alpha=0.5`.
2020-06-09BLI: rename ArrayRef to SpanJacques Lucke
This also renames `MutableArrayRef` to `MutableSpan`. The name "Span" works better, because `std::span` will provide similar functionality in C++20. Furthermore, a shorter, more concise name for a common data structure is nice.
2020-06-09BLI: generally improve C++ data structuresJacques Lucke
The main focus here was to improve the docs significantly. Furthermore, I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually) faster, simpler and more customizable. I also rewrote `Stack` to make it more efficient by avoiding unnecessary copies. Thanks to everyone who helped with constructive feedback. Approved by brecht and sybren. Differential Revision: https://developer.blender.org/D7931
2020-06-08Functions: Run-time type system and index maskJacques Lucke
This adds a new `CPPType` that encapsulates information about how to handle instances of a specific data type. This is necessary for the function evaluation system, which will be used to evaluate most of the particle node trees. Furthermore, this adds an `IndexMask` class which offers a surprisingly useful abstraction over an array containing unsigned integers. It makes two assumptions about the underlying integer array: * The integers are in ascending order. * There are no duplicates. `IndexMask` will be used to "select" certain particles that will be processed in a data-oriented way. Sometimes, operations don't have to be applied to all particles, but only some, those that are in the indexed by the `IndexMask`. The two limitations imposed by an `IndexMask` allow for better performance. Reviewers: brecht Differential Revision: https://developer.blender.org/D7957
2020-05-25Task: Graph Flow Task SchedulingJeroen Bakker
Add TBB::flow graph scheduling to BLI_task. Using flow graphs, a graph of nodes (tasks) and links can be defined. Work can flow though the graph. During this process the execution of the nodes will be scheduled among the available threads. We are planning to use this to improve the threading in the draw manager. The implemented API is still limited it only supports sequential flows. Joins and buffers are not supported. We could eventually support them as part of an CPP API. These features from uses compile time templates and are hard to make a clean C-API for this. Reviewed By: Sergey Sharybin, Brecht van Lommel Differential Revision: https://developer.blender.org/D7578
2020-04-25BLI: add LinearAllocatorJacques Lucke
This allocator is useful when it is necessary to allocate many small elements.
2020-03-04BLI_math: add clamp_v# and clamp_v#_v#v# utility functionsTiago Chaves
2020-02-10BLI: improve various C++ data structuresJacques Lucke
The changes come from the `functions` branch, where I'm using these structures a lot. This also includes a new `BLI::Optional<T>` type, which is similar to `std::Optional<T>` which can be used when Blender starts using C++17.
2020-01-23CMake: Refactor external dependencies handlingSergey Sharybin
This is a more correct fix to the issue Brecht was fixing in D6600. While the fix in that patch worked fine for linking it broke ASAN runtime under some circumstances. For example, `make full debug developer` would compile, but trying to start blender will cause assert failure in ASAN (related on check that ASAN is not running already). Top-level idea: leave it to CMake to keep track of dependency graph. The root of the issue comes to the fact that target like "blender" is configured to use a lot of static libraries coming from Blender sources and to use external static libraries. There is nothing which ensures order between blender's and external libraries. Only order of blender libraries is guaranteed. It was possible that due to a cycle or other circumstances some of blender libraries would have been passed to linker after libraries it uses, causing linker errors. For example, this order will likely fail: libbf_blenfont.a libfreetype6.a libbf_blenfont.a This change makes it so blender libraries are explicitly provided their dependencies to an external libraries, which allows CMake to ensure they are always linked against them. General rule here: if bf_foo depends on an external library it is to be provided to LIBS for bf_foo. For example, if bf_blenkernel depends on opensubdiv then LIBS in blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES. The change is made based on searching for used include folders such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries to LIBS ion that CMakeLists.txt. Transitive dependencies are not simplified by this approach, but I am not aware of any downside of this: CMake should be smart enough to simplify them on its side. And even if not, this shouldn't affect linking time. Benefit of not relying on transitive dependencies is that build system is more robust towards future changes. For example, if bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES and all such code is moved to bf_blenkernel this will not break linking. The not-so-trivial part is change to blender_add_lib (and its version in Cycles). The complexity is caused by libraries being provided as a single list argument which doesn't allow to use different release and debug libraries on Windows. The idea is: - Have every library prefixed as "optimized" or "debug" if separation is needed (non-prefixed libraries will be considered "generic"). - Loop through libraries passed to function and do simple parsing which will look for "optimized" and "debug" words and specify following library to corresponding category. This isn't something particularly great. Alternative would be to use target_link_libraries() directly, which sounds like more code but which is more explicit and allows to have more flexibility and control comparing to wrapper approach. Tested the following configurations on Linux, macOS and Windows: - make full debug developer - make full release developer - make lite debug developer - make lite release developer NOTE: Linux libraries needs to be compiled with D6641 applied, otherwise, depending on configuration, it's possible to run into duplicated zlib symbols error. Differential Revision: https://developer.blender.org/D6642
2019-09-14BLI: rename SetVector to VectorSetJacques Lucke
The structure is a set built on top of a vector and not the other way around.
2019-09-13BLI: new C++ hash table data structuresJacques Lucke
This commit adds some new hashing based data structures to blenlib. All of them use open addressing with probing currently. Furthermore, they support small object optimization, but it is not customizable yet. I'll add support for this when necessary. The following main data structures are included: **Set** A collection of values, where every value must exist at most once. This is similar to a Python `set`. **SetVector** A combination of a Set and a Vector. It supports fast search for elements and maintains insertion order when there are no deletes. All elements are stored in a continuous array. So they can be iterated over using a normal `ArrayRef`. **Map** A set of key-value-pairs, where every key must exist at most once. This is similar to a Python `dict`. **StringMap** A special map for the case when the keys are strings. This case is fairly common and allows for some optimizations. Most importantly, many unnecessary allocations can be avoided by storing strings in a single buffer. Furthermore, the interface of this class uses `StringRef` to avoid unnecessary conversions. This commit is a continuation of rB369d5e8ad2bb7.
2019-09-12BLI: new StringRef and StringRefNull data structuresJacques Lucke
These two data structures reference strings somewhere in memory. They do not own the referenced string. The string is considered const. A string referenced by StringRefNull can be expected to be null-terminated. That is not the case for StringRef. This commit is a continuation of rB369d5e8ad2bb7c2.
2019-09-12BLI: new C++ ArrayRef, Vector, Stack, ... data structuresJacques Lucke
Many generic C++ data structures have been developed in the functions branch. This commit merges a first chunk of them into master. The following new data structures are included: Array: Owns a memory buffer with a fixed size. It is different from std::array in that the size is not part of the type. ArrayRef: References an array owned by someone else. All elements in the referenced array are considered to be const. This should be the preferred parameter type for functions that take arrays as input. MutableArrayRef: References an array owned by someone else. The elements in the referenced array can be changed. IndexRange: Specifies a continuous range of integers with a start and end index. IntrusiveListBaseWrapper: A utility class that allows iterating over ListBase instances where the prev and next pointer are stored in the objects directly. Stack: A stack implemented on top of a vector. Vector: An array that can grow dynamically. Allocators: Three allocator types are included that can be used by the container types to support different use cases. The Stack and Vector support small object optimization. So when the amount of elements in them is below a certain threshold, no memory allocation is performed. Additionally, most methods have unit tests. I'm merging this without normal code review, after I checked the code roughly with Sergey, and after we talked about it with Brecht.
2019-08-10Add Constrained Delaunay Triangulation routine to Blenlib.Howard Trickey
See Design task T68277, and patch D5423. This commit includes edits by @ideasman42 to patch in branch temp-D5423-update, plus responses to his comments.
2019-06-05GTests: BLI_task: Add basic tests for BLI_task_parallel_listbase(), and some ↵Bastien Montagne
performances benchmarks. Nothing special to mention about regression test itself, it basically mimics the one for `BLI_task_parallel_mempool()`... Basic performances benchmarks do not tell us much, besides the fact that for very light processing of listbase, even with 100k items, single-thread remains an order of magnitude faster than threaded code. Synchronization is just way too expensive in that case with current code. This should be partially solvable with much bigger (and configurable) chunk sizes though (current ones are just ridiculous for such cases ;) )...
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
2019-02-05Cleanup: remove contributors for CMake filesCampbell Barton
Following removal from C source code. See: 8c68ed6df16d8893
2018-12-13BLI: New Edgehash and EdgeSet implementationJacques Lucke
The new data structure uses open addressing instead of chaining to resolve collisions in the hash table. This new structure was never slower than the old implementation in my tests. Code that first inserts all edges and then iterates through all edges (e.g. to remove duplicates) benefits the most, because the `EdgeHashIterator` becomes a simple for loop over a continuous array. Reviewer: campbellbarton Differential Revision: D4050
2018-11-28Merge branch 'master' into blender2.8Bastien Montagne
Conflicts: source/blenderplayer/CMakeLists.txt tests/gtests/blenlib/CMakeLists.txt
2018-11-28Fix building gtests and bplayer after recent NumaAPI addition.Bastien Montagne
Seriously... like, seriously...
2018-11-06Proper fix for new 'SimpleHeap' gtests...Bastien Montagne
This reverts reverting commit rB55324b8a2e6799300, and do proper 'cleanup' (sigh) in gtest as well. Sorry for the noise, did not understood what had happened here immediately. :/
2018-09-19Cleanup: rename BLI_simple_expr -> BLI_expr_pylike_evalCampbell Barton
Simple isn't a good prefix for library names since lots of unrelated modules could be called 'simple'. Include 'py' in module name since this is a subset of Python, one of the main motivations for this is to be Python like/compatible.
2018-09-18Support evaluating simple driver expressions without Python interpreter.Alexander Gavrilov
Recently @sergey found that hard-coding evaluation of certain very common driver expressions without calling the Python interpreter produces a 30-40% performance improvement. Since hard-coding is obviously not suitable for production, I implemented a proper parser and interpreter for simple arithmetic expressions in C. The evaluator supports +, -, *, /, (), ==, !=, <, <=, >, >=, and, or, not, ternary if; driver variables, frame, pi, True, False, and a subset of standard math functions that seem most useful. Booleans are represented as numbers, since within the supported operation set it seems to be impossible to distinguish True/False from 1.0/0.0. Boolean operations properly implement lazy evaluation with jumps, and comparisons support chaining like 'a < b < c...'. Expressions are parsed into a very simple stack machine program that can then be safely evaluated in multiple threads. Reviewers: sergey, campbellbarton Differential Revision: https://developer.blender.org/D3698
2018-04-16Merge branch 'master' into blender2.8Sergey Sharybin
2018-04-16Added lock-free single linked list implementationSergey Sharybin
Only supports lock-free insertion for now, can not delete element or traverse the list at the same time.
2018-02-18Merge branch 'master' into blender2.8Campbell Barton
2018-02-18Cleanup: add 2d suffix to BLI filesCampbell Barton
Some of these API's can have 3D versions, explicitly name them 2D.
2017-11-23Merge branch 'master' into blender2.8Bastien Montagne
2017-11-23Add a new parallel looper for MemPool items to BLI_task.Bastien Montagne
It merely uses the new thread-safe iterators system of mempool, quite straight forward. Note that to avoid possible confusion with two void pointers as parameters of the callback, a dummy opaque struct pointer is used instead for the second parameter (pointer generated by iteration over mempool), callback functions must explicitely convert it to expected real type. Also added a basic gtest for this new feature.
2017-10-29Merge branch 'master' into blender2.8Sybren A. Stüvel
2017-10-28GTest: initial BLI_heap testCampbell Barton
2017-08-27Merge branch 'master' into blender2.8Campbell Barton
2017-08-27Cleanup: use stubs for eigen gtestCampbell Barton
2017-07-29BLI_memiter: Small API for many small allocationsCampbell Barton
- Each allocation can be a different size (but should be smaller than the chunk size). - Result can be looped over in order of allocation. - Allocations are aligned to pointer size to avoid unaligned reads.
2017-06-11GTest: initial kdopbvh testCampbell Barton
Currently only find-nearest, ray-casting needs to be added.
2016-12-31Add BLI_string_utf8 specific test.Bastien Montagne
This test should ensure we correctly detect all invalid utf-8 sequences in a given string. DISCLAIMER: Do not run this with current code - you'll either laugh or cry, nearly *all* checks fail! Based on utf-8 decoder stress-test (https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt) by Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2016-05-30BLI_array_store testsCampbell Barton
Ensure the data is valid once expanded, and that de-duplication is working as expected.
2016-02-06Fix gtests on Windows/MSVCSergey Sharybin
There were some missing stubs and some tests were specifically written for Linux. Also, apparently MSVC has a limit of 64K for the insource strings..
2016-01-19GTests: array_utilsCampbell Barton
2015-12-10Eigen: move C API into intern/eigen.Brecht Van Lommel
2015-10-09BLI_math: add mat3_polar_decompose, interp_m3_m3m3 and interp_m4_m4m4.Bastien Montagne
mat3_polar_decompose gives the right polar decomposition of given matrix, as a pair (U, P) of matrices. interp_m3_m3m3 uses that polar decomposition to perform a correct matrix interpolation, even with non-uniformly scaled ones (where blend_m3_m3m3 would fail). interp_m4_m4m4 just adds translation interpolation to the _m3 variant.
2015-07-10BLI_math 'compare' cleanup & enhancements.Bastien Montagne
This commit: * Adds a 'compare_ff' function for absolute 'almost equal' comparison of floats. * Makes 'compare_vxvx' functions use that new 'compare_ff' one. * Adds a 'compare_ff_relative' function for secured ulp-based relative comparison of floats. * Adds matching 'compare_vxvx_relative' functions. * Adds some basic tests for compare_ff_relative. See https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ Note that we could replace our python/mathutils' EXPP_FloatsAreEqual() by BLI's compare_ff_relative (using a very small absolute max_diff), but these do not have exact same behavior... Left a comment there for now, we can do it later if/when we are sure it won't break anything!