Commit b3b9c3e
committed
fix(gui): resolve D3D11 image preview jitter during horizontal resize
- Remove Flush() before ResizeBuffers — eliminates CPU stall that
widens the window where DWM composites stale front buffer
- Use event-provided pixel dimensions directly instead of querying
SDL_GetWindowSizeInPixels() which may return stale values
- Skip vsync (Present(0,0)) on resize frames so new content reaches
DWM before next composition cycle
- Add same-size early return to avoid redundant ResizeBuffers calls
- Only handle SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED (physical pixels),
drop SDL_EVENT_WINDOW_RESIZED (logical size, wrong on HiDPI)
Root cause: DXGI_SCALING_NONE + ResizeBuffers destroys all back buffers,
leaving a timing gap where DWM composites the stale front buffer at
the old size, top-left aligned in the new window — visible as a
per-frame position oscillation. OpenGL unaffected (glViewport never
invalidates framebuffer content).1 parent 4f61441 commit b3b9c3e
3 files changed
Lines changed: 21 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | 414 | | |
| 415 | + | |
412 | 416 | | |
413 | | - | |
414 | | - | |
| 417 | + | |
| 418 | + | |
415 | 419 | | |
416 | | - | |
| 420 | + | |
417 | 421 | | |
418 | | - | |
419 | 422 | | |
420 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
421 | 426 | | |
422 | 427 | | |
423 | 428 | | |
| |||
434 | 439 | | |
435 | 440 | | |
436 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
437 | 446 | | |
438 | 447 | | |
439 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | | - | |
| 387 | + | |
389 | 388 | | |
390 | 389 | | |
391 | | - | |
392 | | - | |
393 | | - | |
| 390 | + | |
| 391 | + | |
394 | 392 | | |
395 | 393 | | |
396 | 394 | | |
| |||
444 | 442 | | |
445 | 443 | | |
446 | 444 | | |
447 | | - | |
448 | 445 | | |
449 | | - | |
| 446 | + | |
450 | 447 | | |
451 | 448 | | |
452 | 449 | | |
| |||
0 commit comments