Commit b3e5e0d
ios: sync drawable size + emit Resize in drawableSizeWillChange
Per Apple's MTKView contract, `drawableSizeWillChange:` is invoked
before the next `drawInMTKView:` whenever the drawable's pixel
dimensions change (window resize, rotation under a non-locked
orientation set, split-view drag on iPad). The previous commit added
a no-op stub to satisfy the protocol; that prevents the
"unrecognized selector" crash but leaves `native_display`'s stored
dimensions stale until the next frame's
`UIScreen.mainScreen.bounds` poll catches up.
During iPad rotation animations the stored dimensions stay one frame
behind the resized drawable. Anything that depends on the
framebuffer dimensions for the current pass — `setScissorRect` is
the common case — gets computed against the old size and fails
Metal validation:
-[MTLDebugRenderCommandEncoder setScissorRect:]: failed assertion
`Set Scissor Rect Validation
(rect.y(688) + rect.height(2064))(2752) must be <=
render pass height(2064)'
Update `native_display`'s `screen_width`/`screen_height` from the
size argument immediately and send `Message::Resize` so the event
handler resizes before the next draw. `draw_in_rect`'s own
`UIScreen.bounds` poll still runs as a fallback (e.g. for full-screen
size changes that don't go through the delegate).1 parent bb99267 commit b3e5e0d
1 file changed
Lines changed: 24 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
391 | 403 | | |
392 | 404 | | |
393 | 405 | | |
| |||
0 commit comments