Commit 0392012
authored
fix(lambda-rs): Respect WindowBuilder vsync in render surface configuration (#175)
## Summary
Fixes vsync configuration being effectively ignored in some cases by
ensuring
the requested present mode is respected end-to-end and that “vsync off”
fallbacks prefer true non-vsync modes when available.
## Related Issues
- Resolves #101
## Changes
- Respect window vsync preference when building a `RenderContext` (when
no explicit present mode is set).
- Prefer `AutoNoVsync` over `Mailbox` when the caller requests non-vsync
presentation but the adapter does not support `Immediate`.
- Add unit tests covering present mode resolution and platform
present-mode fallback ordering.
- Clarify `WindowBuilder::with_vsync` docs (best-effort based on
platform capabilities).
## Type of Change
- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] Feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation (updates to docs, specs, tutorials, or comments)
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
- [ ] Performance (change that improves performance)
- [x] Test (adding or updating tests)
- [ ] Build/CI (changes to build process or CI configuration)
## Affected Crates
- [x] `lambda-rs`
- [x] `lambda-rs-platform`
- [ ] `lambda-rs-args`
- [ ] `lambda-rs-logging`
- [ ] Other:
## Checklist
- [ ] Code follows the repository style guidelines (`cargo +nightly fmt
--all`)
- [ ] Code passes clippy (`cargo clippy --workspace --all-targets -- -D
warnings`)
- [ ] Tests pass (`cargo test --workspace`)
- [x] New code includes appropriate documentation
- [ ] Public API changes are documented
- [ ] Breaking changes are noted in this PR description
## Testing
**Commands run:**
```bash
cargo test -p lambda-rs-platform --lib
cargo test -p lambda-rs --lib
```
**Manual verification steps (if applicable):**
1. (Optional) Run a demo with `WindowBuilder::with_vsync(false)` and
confirm frame pacing is no longer refresh-capped on platforms that
support non-vsync modes.
## Screenshots/Recordings
N/A
## Platform Testing
- [x] macOS
- [ ] Windows
- [ ] Linux
## Additional Notes3 files changed
Lines changed: 97 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
321 | 326 | | |
322 | | - | |
| 327 | + | |
323 | 328 | | |
| 329 | + | |
324 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
325 | 335 | | |
| 336 | + | |
| 337 | + | |
326 | 338 | | |
327 | 339 | | |
328 | 340 | | |
| |||
336 | 348 | | |
337 | 349 | | |
338 | 350 | | |
339 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
340 | 360 | | |
341 | 361 | | |
342 | 362 | | |
| |||
414 | 434 | | |
415 | 435 | | |
416 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
417 | 472 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 193 | + | |
| 194 | + | |
204 | 195 | | |
205 | 196 | | |
206 | 197 | | |
| |||
261 | 252 | | |
262 | 253 | | |
263 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
264 | 272 | | |
265 | 273 | | |
266 | 274 | | |
| |||
1104 | 1112 | | |
1105 | 1113 | | |
1106 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1107 | 1133 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
0 commit comments