[perf] Mesh::Refit re-uploads the full vertex buffer every frame (Mesh.cpp) #119

Closed
opened 2026-06-17 21:18:53 +02:00 by jorijnvdgraaf · 0 comments

Found by an adversarially-verified performance audit (confirmed real after a skeptic pass).

Location: implementations/Crafter.Graphics-Mesh.cpp:407-409
Severity: medium · Effort: moderate · Category: memory

Problem

Deforming-mesh Mesh::Refit UploadDeviceLocals the entire vertex array each frame (full host write + flush + barrier; full re-stage + copy on the staged path), even when only a few vertices moved.

Fix

Add a dirty-range upload (offset+count) so a refit copies/stages/barriers only the changed sub-range. Requires a caller-facing contract change since Refit currently takes a span of all vertices.

Found by an adversarially-verified performance audit (confirmed real after a skeptic pass). **Location:** `implementations/Crafter.Graphics-Mesh.cpp:407-409` **Severity:** medium · **Effort:** moderate · **Category:** memory ### Problem Deforming-mesh `Mesh::Refit` `UploadDeviceLocal`s the entire vertex array each frame (full host write + flush + barrier; full re-stage + copy on the staged path), even when only a few vertices moved. ### Fix Add a dirty-range upload (offset+count) so a refit copies/stages/barriers only the changed sub-range. Requires a caller-facing contract change since `Refit` currently takes a span of all vertices.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Catcrafts/Crafter.Graphics#119
No description provided.