Mesh: Cache loose vertices #105567
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105567
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "HooglyBoogly/blender:mesh-loose-vert-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Similar to the cache of loose edges added in
1ea169d90e
,cache the number of loose vertices and which are loose in a bit map.
This can save significant time when drawing large meshes in the
viewport, because recalculations can be avoided when the data doesn't
change, and because many geometry nodes set the loose geometry caches
eagerly when the meshes contain no loose elements.
There are two types of loose vertices:
Mesh.loose_verts()
Mesh.verts_no_face()
Because both are used by Blender in various places, because the cost
is only a bit per vertex (or constant at best) and because of design
consistency, we cache both types of loose elements. The bit maps will
only be allocated when they're actually used, but they are already
accessed in a few important places:
Just the skipping viewport drawing calculation after certain geometry
nodes setups can have a large impact. Here is the time taken by
viewport loose geometry extraction before and after the change:
@blender-bot build
@blender-bot build
Mesh: Cache loose verticesto WIP: Mesh: Cache loose verticesWIP: Mesh: Cache loose verticesto Mesh: Cache loose vertices@blender-bot build
@ -1145,3 +1145,1 @@
static BitVector<> loose_verts_map_get(const Span<blender::int2> edges,
int verts_num,
int *r_loose_vert_num)
static BitVector<> loose_verts_map_get(const Mesh &mesh, int *r_loose_vert_num)
Does this intentionally return by value instead of const-references? Same below.
@ -307,6 +317,9 @@ typedef struct Mesh {
* cache dirty. If the mesh was changed first, the relevant dirty tags should be called first.
*/
void loose_edges_tag_none() const;
void loose_verts_edge_tag_none() const;
Why are these
const
? Aren't these function you should call after changing the topology when having non-const access to the mesh?BKE_mesh_tag_positions_changed
is non-const as well.They're const because setting them doesn't change the logical state of the mesh. Let's say you're doing a mostly unrelated calculation and discover that there are no loose vertices, these could be called to pass that information elsewhere without changing the mesh.
BKE_mesh_tag_positions_changed
is different, it means "I've changed the positions, the mesh is now different than it was".@ -308,2 +318,4 @@
*/
void loose_edges_tag_none() const;
void loose_verts_edge_tag_none() const;
void loose_verts_face_tag_none() const;
It feels a bit like these
tag
functions are redundant. Shouldn'ttag_no_loose_edges
andtag_no_loose_verts
methods be enough?Generally they're used in similar situations, but not always. For example, the realize instances node: