forked from 1b-agent/opencadstudio-upstream
perf(render): skip hatch pass while navigating (interaction LOD)
The batched hatch pass evaluates its fill procedurally per fragment — a point-in-polygon test over the whole boundary plus the pattern test, with a `discard` that disables early-Z. When the view sits inside a hatch its quad covers the screen, so panning / zooming re-runs that full-screen shader every frame (~40 ms/frame on a hatch-heavy plan) even though the rest of the scene is cheap — the wire pass and CPU prepare are negligible by comparison. Suppress the hatch pass while the view is actively panning / zooming / orbiting, detected from `camera_generation` plus a short settle timer (`Scene::navigating_lod`), and fold that state into the render signature so the moment the view settles it renders hatches once and the scene-render cache holds that full-quality frame. A brief `is_settling` subscription keeps requesting frames just past the settle point so the hatched frame renders even when no input event would otherwise fire. Mirrors AutoCAD's adaptive degradation. The paper sheet keeps its fills.
This commit is contained in:
1 parent
f99f1cd7a5
commit
a55e1ac4f8
4 files changed
+82
-5
No files matched your search
@@ -1462,6 +1462,16 @@ impl OpenCADStudio {
|
||||
} else {
|
||||
Subscription::none()
|
||||
};
|
||||
// Interaction LOD: while the view is (or just was) navigating, keep
|
||||
// requesting frames a little past the settle point. Panning itself is
|
||||
// driven by input events, but once the cursor stops no event would fire
|
||||
// the one full-quality frame that re-renders hatches — this tick does,
|
||||
// then the scene-render cache holds it and the subscription auto-stops.
|
||||
let nav_settle = if self.tabs[self.active_tab].scene.is_settling() {
|
||||
window::frames().map(Message::Tick)
|
||||
} else {
|
||||
Subscription::none()
|
||||
};
|
||||
// Blink the MText preview caret while the editor is open.
|
||||
let caret_blink = if self.mtext_editor.is_some() {
|
||||
iced::time::every(std::time::Duration::from_millis(530))
|
||||
@@ -1493,6 +1503,7 @@ impl OpenCADStudio {
|
||||
history_tick,
|
||||
grip_dwell,
|
||||
hover_dwell,
|
||||
nav_settle,
|
||||
caret_blink,
|
||||
web_fonts,
|
||||
autosave,
|
||||
|
||||
Reference in new issue
Block a user