sokol icon indicating copy to clipboard operation
sokol copied to clipboard

iOS/macOS: finally get rid of MTKView

Open floooh opened this issue 3 years ago • 1 comments

MTKView is just too brittle, with all sorts of workaround for regressions, which then at some point are no longer needed, but cause different issues. Bite the bullet and replace MTKView with CAMetalLayer (not quite trivial because this means sokol_app.h needs to manage its own depth-stencil-buffer and MSAA render target, and probably needs to implement all sorts of shit to make resizing and device rotation work.

PS: also see: https://developer.apple.com/documentation/metal/onscreen_presentation/creating_a_custom_metal_view?language=objc

floooh avatar Oct 15 '22 15:10 floooh

When using CAMetalLayer, I never bother listening to size changes. Instead, when starting each render, I just check currentDrawable.texture.width and currentDrawable.texture.height, which will contain the correct current pixel size.

DagAgren avatar Oct 20 '22 09:10 DagAgren