Falk David c539ea792c Fix: GPv3: Reduce draw tool performance regression
During the painting operation, the `GreasePencilDrawing` is updated in-place.
Previously, we simply tagged the whole drawing for a topology update.
This meant that the triangulation and curve normals were recomputed
for (pretty much) every new input sample.

Since the draw tool only creates one new stroke, we can copy the
triangulation of all the other strokes and only recompute the triangulation
of the newly drawn stroke(s).

First, a new `triangle_offsets_cache` is added that is lazily computed.
The computation for this should be pretty cheap.
Then, a new function `Drawing::tag_topology_changed(const IndexMask &curves_to_update)`
is added. This function takes an index mask of curves and only updates
their triangle cache. The cache for the other curves is copied.

In a test file with around 400k points, recomputing the triangle cache
(every input sample) took around 45ms. This meant that there was a noticable
drop in frame rate. With this patch, the time for each sample goes down to
less than 0.1ms. The frame rate feels much better.

But, drawing a longer and longer stroke still makes this time go up,
because the triangulation for the single stroke becomes more and
more expensive. This will have to be improved further.

Part of #124149.

Pull Request: https://projects.blender.org/blender/blender/pulls/129115
2024-10-17 15:28:44 +02:00
2024-10-16 17:13:55 +02:00
2024-10-16 15:01:52 -07:00
2023-12-08 13:28:13 +11:00
2024-10-02 12:34:01 +02:00

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

Blender screenshot

Project Pages

Development

License

Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.

Description
No description provided
Readme 841 MiB
Languages
C++ 78%
Python 14.9%
C 2.9%
GLSL 1.9%
CMake 1.2%
Other 0.9%