Vertex paint: coalesce vertex color uploads during stroke - #343
Conversation
Avoid committing vertex colors to the entity on every mouse-move. Instead schedule a single-shot flush and upload at most once per event loop tick, plus force a final flush on stroke end. Made-with: Cursor
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughVertex-paint GPU color commits transition from synchronous to deferred execution. Brush sample changes mark a pending flush flag and schedule commitment via a zero-delay timer, validating edit-mode state before executing. Edit-mode exit clears pending flags, and stroke completion with commit enabled forces immediate flush to capture final state before undo snapshot. Changes
Sequence DiagramsequenceDiagram
participant Brush as Brush Sample
participant Controller as EditModeController
participant Timer as QTimer
participant GPU as Mesh/GPU Commit
Brush->>Controller: applyVertexColorBrush()
activate Controller
Controller->>Controller: Check if flush pending
alt Flush not scheduled
Controller->>Timer: Schedule zero-delay callback
Controller->>Controller: Set m_vertexPaintFlushPending = true
Controller->>Controller: Set m_vertexPaintFlushScheduled = true
else Flush already scheduled
Controller->>Controller: Set m_vertexPaintFlushPending = true
end
deactivate Controller
Timer-->>Controller: Callback triggered
activate Controller
Controller->>Controller: Validate edit-mode active & pointers valid
alt Validation passed
Controller->>GPU: commitVertexColorsToEntity()
GPU->>GPU: meshDataChanged()
end
Controller->>Controller: Clear pending/scheduled flags
deactivate Controller
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|



Summary
Rationale
On dense meshes, uploading vertex colors every mouse-move can dominate frame time and make the brush feel sticky. This keeps the painting math unchanged while reducing buffer churn.
Test plan
Made with Cursor
Summary by CodeRabbit