sokol
sokol copied to clipboard
Research: macOS MTKView wobbly resizing...
Resizing with MTKView results in a 'wobbly' window content because the backing store doesn't exactly the current window size, and MTKView scaling the content.
See: https://thume.ca/2019/06/19/glitchless-metal-window-resizing/
What appears to work great for high-dpi apps is to set the MTKView's layerContentsPlacement policy to topleft, and enable autoResizeDrawable:
_sapp.macos.view.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
_sapp.macos.view.autoResizeDrawable = true;
...and then not manually setting the view's drawable size (however whether that's done or not doesn't seem to make a difference).
This gives a wonderfully stable window content when resizing. Unfortunately it breaks under some circumstances:
- non-highdpi apps only render into the top-left quarter
- moving a highdpi window from a Retina screen to a non-Retina screen has the same effect (only rendering into the top-left quarter)
...this needs more investigation, also consider dropping MTKView completely.