Overview
Plumb the existing with_vsync flag from WindowBuilder through to RenderContextBuilder (Or one of it's settings) and expose explicit PresentMode selection for users.
Current State
WindowBuilder has a with_vsync method, but it is currently a no-op:
// crates/lambda-rs/src/render/window.rs/// Request vertical sync behavior for the swapchain.////// Note: present mode is ultimately selected when configuring the rendering/// surface in `RenderContextBuilder`. This flag is reserved to influence/// that choice and is currently a no‑op.pubfnwith_vsync(mutself,vsync:bool) -> Self{self.vsync = vsync;returnself;}And within the platform layer, we already support present mode selection:
// crates/lambda-rs-platform/src/wgpu/surface.rspubenumPresentMode{Fifo,// VSync onImmediate,// VSync off, may tearMailbox,// Triple bufferingAutoVsync,// ...}But RenderContextBuilder::build() currently hardcodes PresentMode::Fifo for the surface.
Scope
- Add
with_vsync(bool) to RenderContextBuilderthat maps toFifowhen true, or Immediate/Mailbox` when not. - Add
with_present_mode(PresentMode) for explicit control - Expose higher level
PresentMode enum in lambda-rs - Validate requested mode against adapter capabilities; fall back to something that is supported if the requested mode is not available.
Proposed API
// crates/lambda-rs/src/render/mod.rspubenumPresentMode{/// VSync enabled, capped to display refresh rate (FIFO).Vsync,/// VSync disabled, immediate presentation (may tear).Immediate,/// Triple buffering, low latency without tearing if supported.Mailbox,}implRenderContextBuilder{/// Enable or disable vertical sync (defaults to enabled).pubfnwith_vsync(mutself,enabled:bool) -> Self;/// Explicitly select a presentation mode.pubfnwith_present_mode(mutself,mode:PresentMode) -> Self;}Acceptance Criteria
Overview
Plumb the existing
with_vsyncflag fromWindowBuilderthrough toRenderContextBuilder(Or one of it's settings) and expose explicitPresentModeselection for users.Current State
WindowBuilderhas awith_vsyncmethod, but it is currently a no-op:And within the platform layer, we already support present mode selection:
But
RenderContextBuilder::build()currently hardcodesPresentMode::Fifofor the surface.Scope
with_vsync(bool) toRenderContextBuilderthat maps toFifowhen true, orImmediate/Mailbox` when not.with_present_mode(PresentMode)for explicit controlPresentModeenum inlambda-rsProposed API
Acceptance Criteria
RenderContextBuilder::with_vsync(bool)to enable vsyncRenderContextBuilder::with_present_mode(PresentMode)for explicit selectionPresentModeimplementation inlambda-rs