Age | Commit message (Collapse) | Author |
|
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
|
|
|
|
Covers basics like generation of new UUID.
Also contains code needed to use the SessionUUID as a key in the Map.
|
|
|
|
This removes extern-C blocks around other includes and adds
such blocks for some headers that need them.
|
|
Reviewers: sybren
Differential Revision: https://developer.blender.org/D8315
|
|
Implementation of lerp without a function requires repeating one of
the arguments, which is not ideal. To avoid that, add a new function
to the driver namespace. In addition, provide a function for clamping
between 0 and 1 to support easy clamped lerp, and a smoothstep function
from GLSL that is somewhat related.
The function implementations are added to a new bl_math module.
As an aside, add the round function and two-argument log to the
pylike expression subset.
Differential Revision: https://developer.blender.org/D8205
|
|
|
|
This updates the usage of integer types in code I wrote according to our new style guides.
Major changes:
* Use signed instead of unsigned integers in many places.
* C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`).
* Hash values for C++ containers are 64 bit wide now (instead of 32 bit).
I do hope that I broke no builds, but it is quite likely that some compiler reports
slightly different errors. Please let me know when there are any errors. If the fix
is small, feel free to commit it yourself.
I compiled successfully on linux with gcc and on windows.
|
|
|
|
Those are defined exactly as their corresponding functions in Cycles.
|
|
The same function is also used by cycles.
|
|
|
|
span.size() returns an uint, causing a signed/unsigned comparison
using 3u sidesteps the issue
|
|
This was introduced in rB403384998a6bb5f428e15ced5.
|
|
This allows us to avoid many calls to `as_span()` methods. I will
remove those in the next commit. Furthermore, constructors
of Vector and Array can convert from one type to another now.
I tested these changes on Linux with gcc and on Windows.
|
|
|
|
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.
|
|
|
|
These GHash functions were removed in 12817083ec61,
so the tests should be removed too.
|
|
|
|
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.
|
|
Previously, there was an error when operator-> was returning an
invalid type. See error C2839.
|
|
This reverts commit 5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d.
This was introducing build errors in windows. Need a bit more time to check it.
|
|
|
|
The issue is duplicated code. There are two functions that zero-fill
the frame number. They worked the same for positive frames numbers, but
behaved differently for negative ones.
On frame `-100`, `BLI_path_frame` outputs `-0100` and
`fluid_cache_get_framenr_formatted_$ID$` outputted `-100`.
I changed the behavior of the latter, because we depend on the behavior
of the former for much longer already.
Reviewers: sebbas
Differential Revision: https://developer.blender.org/D8107
|
|
This is the same issue as in rBbcf49d13e53454.
|
|
|
|
This should rarely be necessary, but I have a use case coming up soon.
|
|
`std::optional` can be used now, because we switched to C++17.
|
|
Are reported by MSVC 2019 after C++17 switch.
One might suggest lets just silence the warning, I will say why to have
specific signed/unsigned types in API just to then (usafely) ignore the
sign conversion.
|
|
random_shuffle was removed (at least the used version).
|
|
The matrix interpolation function `interp_m3_m3m3()` decomposes the
matrices into rotation and scale matrices, converts the rotation
matrices to quaternions, SLERPs the quaternions, and converts the result
back to a matrix. Since quaternions cannot represent axis flips, this
results in interpolation problems like described in T77154.
Our interpolation function is based on "Matrix Animation and Polar
Decomposition", by Ken Shoemake & Tom Duff. The paper states that it
produces invalid results when there is an axis flip in the rotation
matrix (or negative determinant, or negative scale, those all indicate
the same thing). Their solution is to multiply the rotation matrix with
`-I`, where `I` is the identity matrix. This is the same as element-wise
multiplication with `-1.0f`. My proposed solution is to not only do that
with the rotation matrix `R`, but also with the scale matrix `S`. This
ensures that the decomposition of `A = R * S` remains valid, while also
making it possible to conver the rotation component to a quaternion.
There is still an issue when interpolating between matrices with
different determinant. As the determinant represents the change in
volume when that matrix is applied to an object, interpolating between a
negative and a positive matrix will have to go through a zero
determinant. In this case the volume collapses to zero. I don't see this
as a big issue, though, as without this patch Blender would also produce
invalid results anyway.
Reviewed By: brecht, sergey
Differential Revision: https://developer.blender.org/D8048
|
|
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`.
|
|
|
|
Smells like GCC bug [1], which is backed up by the fact that locally
GCC-10 and CLang-10 works fine.
Since the change is trivial (and, arguably, correct since there is
no real difference between tests code and actual code) seems fine to
fix.
Fix suggested by Jacques Lucke, thanks!
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
|
|
|
|
This makes it easier to write range-for loops over all items
in the map without using auto.
|
|
There is a nice use case for this in depsgraph code.
Also I added some previously missing calls to std::move.
|
|
|
|
This was missing in an earlier commit.
|
|
I found this pattern in depsgraph code more than once.
|
|
Previously, this function would expect a callback function as parameter.
This behavior is now in Map.lookup_or_add_cb. The new version just
takes the key and value directly.
|
|
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.
|
|
We plan to use the "blender" namespace in other modules as well.
|
|
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
|
|
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
|
|
|
|
Change the seed from 0 to 1, so BLI_ghash_performance_test doesn't
assert with duplicate keys.
|
|
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
|