-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
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.
pub fn with_vsync(mut self, vsync: bool) -> Self {
self.vsync = vsync;
return self;
}And within the platform layer, we already support present mode selection:
// crates/lambda-rs-platform/src/wgpu/surface.rs
pub enum PresentMode {
Fifo, // VSync on
Immediate, // VSync off, may tear
Mailbox, // Triple buffering
AutoVsync,
// ...
}But RenderContextBuilder::build() currently hardcodes PresentMode::Fifo for the surface.
Scope
- Add
with_vsync(bool) toRenderContextBuilderthat maps toFifowhen true, orImmediate/Mailbox` when not. - Add
with_present_mode(PresentMode)for explicit control - Expose higher level
PresentModeenum inlambda-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.rs
pub enum PresentMode {
/// 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,
}
impl RenderContextBuilder {
/// Enable or disable vertical sync (defaults to enabled).
pub fn with_vsync(mut self, enabled: bool) -> Self;
/// Explicitly select a presentation mode.
pub fn with_present_mode(mut self, mode: PresentMode) -> Self;
}Acceptance Criteria
-
RenderContextBuilder::with_vsync(bool)to enable vsync -
RenderContextBuilder::with_present_mode(PresentMode)for explicit selection -
PresentModeimplementation inlambda-rs - Adapter validation and fallback support
- Documentation and example Usage
Metadata
Metadata
Assignees
Labels
No labels