Perf: Studio renders the whole scene more than once per editor frame
Part of #158. Phase 2.
Problem
Studio can render the whole scene — shadows, prepass, SSAO, SSR, cull, main, transparent, post-process — more than once per editor frame.
1. Multiple viewports. Scene and Game are tabbed in one dock leaf by default (LayoutPresets.zig:68-71) and the Play transport focuses game (MenuBar.zig:384), so the default layout draws only one. But:
- any split / side-by-side layout draws both, each a full
renderScene+runPostProcess; SceneViewportexplicitly supports multiple instances, each with its own camera (Panels.zig—"scene"allows multiple, deliberately, so you can view from two angles).
Nothing skips a viewport that isn't the active tab in its leaf, even though LayoutStore.activeViewportTab already knows which one is.
2. The camera-preview inset. CameraPreview.draw calls GpuRenderer.renderCameraPreview — a full scene render — at a hardcoded 10 Hz whenever the selection is a single camera node. Bistro has 5 cameras. The file's own comment concedes the problem: "A full scene render (shadows, SSR, reflection probes, post-process) is resolution-independent in CPU cost, so re-rendering this 320x180 inset every frame would roughly double edit-mode's per-frame cost." Throttling reduces it; it doesn't remove it, and 100 ms is not adjustable.
Scope
- Skip
renderViewportfor Scene panels that aren't the active tab in their dock leaf. - Make the camera-preview refresh interval a setting (including "only on change"), rather than the hardcoded
REFRESH_NSatCameraPreview.zig:19. - Confirm against #159 (closed)'s counters how many
renderScenecalls a frame actually makes in each layout, before and after.
Acceptance
- A frame makes exactly one
renderScenecall per visible viewport - A camera node stays selectable during Play without a measurable frame cost at the default refresh setting
- Multi-instance Scene panels still work when both are genuinely visible