MTKView Drawable Issue

Hi, in iPadOS Beta 13.1 the behavior of MTKViewDelegate.mtkView( MTKView , drawableSizeWillChange: CGSize ) is different to iOS 12.4 and earlier.


The following example code is called by the MTKView each time the view's drawable changes. The code is used by the iOS and the macOS version of my game.


class Delegate: MTKViewDelegate {
   public func mtkView(_ view: MTKView, drawableSizeWillChange drawableSize: CGSize) {
        // Print drawable size.
        print.("\(drawableSize.width) x \(drawableSize.height)" )
   }
}


- macOS

When the user resizes the MTKView this code prints the view's pixel size.

500 x 300
510 x 308
516 x 316
518 x 320



- iOS 12.4
During launch on an iPad mini 2,4,5 (I tested several devices). The game supports landscape mode only and requires fullscreen.

1536 x 2048
2048 x 1536

The delegate is called twice. The first time the drawable size is the size of the iPad's screen in portrait mode. Then the app changes to landscape mode (this is forced by iOS because I set the landscape mode flag in the info.plist) and the delegate is called again with the same dimensions yet in landscape mode. This means the dimensions are just flipped because the iPad's physical screen size didn't change.

So fare this is the behaviour I expected according to the documentation.


- iOS 13.1 Beta
During launch on an iPad mini 5.

1536 x 2048
2731 x 1152

Notice the second time – in landscape mode – the drawable size is different. The drawable size doesn't match the screen size. The width is larger than the screen and the height is to small.

Now my question: Is this a bug or a feature?
Do I need to enable something in iOS & iPadOS 13 to force the MTKView to use the native screen size in landscape mode?


Maybe an Apple engineer could help.

Thanks!

Accepted Reply

Fixed in iOS 13.1 beta 2

Replies

We get the same issue since iOS13.1 on iPads only.


https://forums.developer.apple.com/thread/122064


Have you raised a Radar as well? It's the only way really to get some traction and them to look at the issue!

Yeah me too. Running the Apple Metal BasicTexturing sample on an iPad Air 3rd Gen I see the `drawableSizeWillChange` method being called with the correct view size of 1668x2224 and then shortly afterwards with a size of 2965x1251.


Glad it's not just me.


EDIT: Reported error via Feedback Assistant.


P.S. On a related note, any Metal developers here know why the same sample running on macOS 10.15 beta 7 shows the geometry to be broken (second image from GPU Frame Capture showing geometry)?


Me three. I'm on iPhone XS and get a drawable size of 5275 x 520

https://forums.developer.apple.com/thread/122206

I reported the error via Feedback Assistant. Unfortunately, the feedback assistant still returns "no similar errors reported". Even now, after trojanfoe has reported the issue as well. It seams the assistant is broken too. During the last decade Apple's software quality standards constantly decreased.

Fixed in iOS 13.1 beta 2