Age | Commit message (Collapse) | Author |
|
The deadlock was caused as the lock on the Mesh mutex used to compute
the subdivision wrapper was not released in some early exits of the
function.
|
|
This evaluator is used in order to evaluate subdivision at render time, allowing for
faster renders of meshes with a subdivision surface modifier placed at the last
position in the modifier list.
When evaluating the subsurf modifier, we detect whether we can delegate evaluation
to the draw code. If so, the subdivision is first evaluated on the GPU using our own
custom evaluator (only the coarse data needs to be initially sent to the GPU), then,
buffers for the final `MeshBufferCache` are filled on the GPU using a set of
compute shaders. However, some buffers are still filled on the CPU side, if doing so
on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose
logic is hardly GPU compatible).
This is done at the mesh buffer extraction level so that the result can be readily used
in the various OpenGL engines, without having to write custom geometry or tesselation
shaders.
We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in
order to control the data layout, and interpolation. For example, we store vertex colors
as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float
types.
In order to still access the modified geometry on the CPU side, for use in modifiers
or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`.
Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will
create such a wrapper if possible. If the final subdivision surface is not needed on
the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used.
Enabling or disabling GPU subdivision can be done through the user preferences (under
Viewport -> Subdivision).
See patch description for benchmarks.
Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport
Differential Revision: https://developer.blender.org/D12406
|
|
Missed this function in rB67525b88d2e
|
|
Differential Revision: https://developer.blender.org/D13666
|
|
Differential Revision: https://developer.blender.org/D12962
|
|
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
|
|
Loops come last in the struct's definition, use the same order when
initializing the common masks in customdata.c (they were switched
with the poly masks).
|
|
Most of these custom data layers weren't BMesh only, and the
one that actually looks to be BMesh only has `BM` in its name.
|
|
Differential Revision: https://developer.blender.org/D13657
|
|
The `BKE_animdata_driver_path_hack()` function has had almost no effect
since rB51b796ff1528, and basically boils down to:
```
return base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop);
```
Since `base_path` was `NULL` in the majority of cases, it's just been
replaced by a direct call to `RNA_path_from_ID_to_property()`. The
conditional now just appears in one remaining case.
This relates to T91387.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D13646
|
|
It's better to calculate the size of a spline before creating it, and this
should simplify refactoring to a data structure that stores all point
attribute contiguously (see T94193). The mesh to curve conversion is
simplified slightly now, it creates the curve output after gathering all
of the result vertex indices. This should be more efficient too, since
it only grows an index vector for each spline, not a whole spline.
|
|
I don't think this has been visible, since I only ran into it after
changing other code that affected this. However, some attributes
can keep a reference to the source component to use when tagging
caches dirty (like the position attribute tagging the normals dirty).
Here, the component was created inside a function, then the attributes
were used afterwards.
Also add some comments warning about this in the header file.
|
|
Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).
Differential Revision: https://developer.blender.org/D13653
|
|
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).
Differential Revision: https://developer.blender.org/D13645
|
|
This replaces the single-threaded calculation of mesh min and max
positions with a `parallel_reduce` loop. Since the bounding box
of a mesh is retrieved quite often (at the end of each evaluation,
currently 2(?!) times when leaving edit mode, etc.), this makes for a
quite noticeable speedup actually.
On my Ryzen 3700x and a 4.2 million vertex mesh, I observed
a 4.4x performance increase, from 14 ms to 4.4 ms.
I added some methods to `float3` so they would be inlined, but
they're also a nice addition, since they're used often anyway.
Differential Revision: https://developer.blender.org/D13572
|
|
Own mistake in rB2ef192a55b2c. Did not seem to have any visible effect
though...
|
|
|
|
collection.
Fix is similar to how CollectionObject with NULL object pointers are handled.
Using one of the 'free' pad bytes in Object_Runtime struct instead of a
gset (or other external way to detect object duplicates), as this is
several times faster.
NOTE: This makes remapping slightly slower again (adds 10 extra seconds
to file case in T94059).
General improvements of remapping time complexity, especially when
remapping a lot of IDs at once, is a separate topic currently
investigated in D13615.
|
|
This commit fixes the crash itself, however this can still lead to a
same collection 'owning' the same object several time.
Issue here was a bad assumption in layer resync code, that would lead to
removing valid objects from the viewlayer's `object_bases_hash` in
`BKE_layer_collection_sync`, when deleting no-more-used bases, in case
of bases duplicate.
|
|
When copying a full node tree, we can avoid an O(n^2) loop finding a
unique name for every node if we assume they already have unique names.
That is a reasonable assumption, since unique names are verified
elsewhere when adding a new node.
Copying a node tree with about 4000 nodes took 42 ms before,
now it takes 6 ms.
Differential Revision: https://developer.blender.org/D13644
|
|
These pointers point to the new nodes when duplicating,
and their even used to point to "original" nodes for
"localized" trees. They're just a bad design decision
that make code confusing and buggy.
Instead, node copy functions now optionally add to a map
of old to new socket pointers. The case where the compositor
abused these pointers as "original" pointers are handled
by looking up the string node names.
Differential Revision: https://developer.blender.org/D13518
|
|
This commit makes freeing a node tree about 25 to 30 times faster.
Freeing a node tree happens whenever it is edited. Freeing a node
tree with about 4000 nodes went from 30-50ms to about 2 ms.
This was so slow before because for every node that was freed
when freeing the node tree, `node_free_node` looped over all
other nodes to detach frames, and then looped over all links to
remove any links connected to the node. That was all pointless
work because everything else is about to be freed anyway.
Instead, move that "detaching" behavior to the dedicated function
for removing a single node, and to the "local" version of the free
function to be safe, since I know less about what that version expects.
Differential Revision: https://developer.blender.org/D13636
|
|
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
|
|
Log a message (via `CLOG`) when asset catalog definitions cannot be
loaded.
Reviewed by @jacqueslucke in D13633
|
|
Goals of this refactor:
* More unified approach to updating everything that needs to be updated
after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
more centralized update procedure.
The refactor consists of two main parts:
* Node tree tagging and update refactor.
* Generally, when changes are done to a node tree, it is tagged dirty
until a global update function is called that updates everything in
the correct order.
* The tagging is more fine-grained compared to before, to allow for more
precise depsgraph update tagging.
* Depsgraph changes.
* The shading specific depsgraph node for node trees as been removed.
* Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
tagged when the output of the node tree changed (e.g. the Group Output
or Material Output node).
* The copy-on-write relation from node trees to the data block they are
embedded in is now non-flushing. This avoids e.g. triggering a material
update after the shader node tree changed in unrelated ways. Instead
the material has a flushing relation to the new `NTREE_OUTPUT` node now.
* The depsgraph no longer reports data block changes through to cycles
through `Depsgraph.updates` when only the node tree changed in ways
that do not affect the output.
Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.
Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
`ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.
Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.
Differential Revision: https://developer.blender.org/D13246
|
|
Outliner would frame the armature object instead of the bone if the bone
was on a hidden armature layer.
Similar to issues reported in e.g. T58068 and T80464, this is due to the
fact that `BKE_pose_channel_active` always checks for the armature layer
(and returns NULL if a bone is not on a visible armature layer).
Now propose to make this layer check **optional** (and e.g. from the
Outliner be more permissive). This also introduces
`BKE_pose_channel_active_if_layer_visible` which just wraps
`BKE_pose_channel_active` with the check being ON.
Maniphest Tasks: T92930
Differential Revision: https://developer.blender.org/D13154
|
|
|
|
Do not also instantiate a collection in the view layer, if it is already
instantiated through an empty object.
|
|
This fix provides better conditions for asserts in `NURBSpline::knots`
method accounting for cyclic NURBS curves.
Differential Revision: https://developer.blender.org/D13620
|
|
This flag was checked, but not set anywhere.
|
|
Also remove a SCOPED_TIMER I added by mistake in a previous commit.
|
|
|
|
Similar to the previous commit, this allowed removing a function to set
a single pixel of a node preview.
|
|
|
|
Includes use of memcpy to avoid warnings about deprecated members.
|
|
The RNA setter now ensures that driver variables are uniquely named
(within the scope of the driver).
Versioning code has been added to ensure this uniqueness. The last
variable with the non-unique name retains the original name; this
ensures that the driver will still evaluate to the same value as before
this fix.
This also introduces a new blenlib function `BLI_listbase_from_link()`,
which can be used to find the entire list from any item within the list.
Manifest Task: T94116
Reviewed By: mont29, JacquesLucke
Maniphest Tasks: T94116
Differential Revision: https://developer.blender.org/D13594
|
|
|
|
|
|
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
returned `void *`. That leads to having the same type name three times
in the same line. This patch reduces the amount to two and removes the
`sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
of place compared to other allocation methods. Sometimes
`MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
in C++ code. It doesn't look great but it's definitely better. The downside
is that it makes the name of the allocation less useful. That's because
the same name is used for all allocations of a type, independend of
where it is allocated.
This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).
The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.
Differential Revision: https://developer.blender.org/D13502
|
|
|
|
I need this for a refactor I'm looking into for bounding boxes.
It may be helpful in the future when using `CurveEval` in more places.
Differential Revision: https://developer.blender.org/D13596
|
|
Fully get rid of `BKE_collection_object_find` in
`lib_override_group_tag_data_object_to_collection_init`, even if only
used a few times this function was still noticeable in profiling data.
Now instead loop over collections' objects to build required
object-to-collections mapping.
Adds an extra 5-10% speed-up compared to previous commit rB0624fad0f3ff.
Related to T94059.
|
|
`BKE_collection_object_find` has extremely bad performances (very high
time complexity). While ideally this should be fixed in that API, for
now cache its results once at the beginning of the resync/creation
process.
This makes loading of complex production files with a lot of
liboverrides to resync three to four times faster.
Thanks to @brecht for the profiling in T94059.
|
|
When selecting the current undo step there is no need to do anything.
Fix and minor refactor to de-duplicate refreshing after running
undo/redo & undo history.
|
|
In almost all cases there is no difference between `G.relbase_valid`
and checking `G.main->filepath` isn't an empty string.
In many places a non-empty string is already being used instead of
`G.relbase_valid`.
The only situation where this was needed was when saving from
`wm_file_write` where they temporarily became out of sync.
This has been replaced by adding a new member to `BlendFileWriteParams`
to account for saving an unsaved file for the first time.
Reviewed By: brecht
Ref D13564
|
|
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.
A few special operators for creating a reroute or a group input node
are also added to the search.
Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.
A small "+" is displayed next to the cursor to give a hint about this.
Further improvements are possible after this first iteration:
- Support custom node trees.
- Better drawing of items in the search menu.
- Potential tweaks to filtering of items, depending on user feedback.
Thanks to Juanfran Matheu for developing an initial patch.
Differential Revision: https://developer.blender.org/D8286
|
|
Previously we used a `CellValue` class to hold the data for a cell,
and called a function to fill it whenever necessary. This is an
unnecessary complication when we have virtual generic arrays
and most data is already easily accessible that way anyway.
This patch removes `CellValue` and uses `fn::GVArray` to provide
access to data instead.
In the future, if rows have different types within a single column,
we can use a `GVArray` of `blender::Any` to interface with the drawing.
Along with that, the use of virtual arrays made it easy to do a
few other cleanups:
- Use selection domain interpolations from rB5841f8656d95
for the mesh selection filter.
- Change the row filter to only calculate for necessary indices.
Differential Revision: https://developer.blender.org/D13478
|
|
Differential Revision: https://developer.blender.org/D13585
|
|
Originally pointcache wasn't supported when the file wasn't saved.
Remove commented code as this hasn't been the case for a long time.
|
|
Double the allocation size when the limit is reached instead of
increasing by a fixed number.
Also re-allocate to the exact size once complete instead of over
allocating. This gives a minor speedup in my tests ~19% faster
tessellation for ~1million faces.
|