Skip to content

[Impeller] Metal validation error when creating textures when run in Designed For iPad mode #139147

@navaronbracke

Description

@navaronbracke

Is there an existing issue for this?

Steps to reproduce

  1. Set up a new Flutter project
  2. On the native side, get a hold of the texture registry and register a texture using the registry, and implement public func copyPixelBuffer() -> Unmanaged<CVPixelBuffer>?
  3. Provide a new frame for the texture
  4. Run the app on an M1 Mac, as "Mac (Designed for iPad)"
  5. When this is run natively on MacOS, the error does not reproduce

Expected results

No Metal validation error is logged.

Actual results

The following validation error is logged to the console:

-[MTLDebugDevice newTextureWithDescriptor:iosurface:plane:]:2641: failed assertion `Texture Descriptor Validation
IOSurface textures must use MTLStorageModeShared

Code sample

Code sample

I do not have a minimal code sample, out of the box, as it requires some set up.
However, the plugin where I saw this issue was using the public FlutterTextureRegistry and FlutterTexture API.
(setting up a texture, providing frames & disposing the texture)

The example at https://github.com/juliansteenbakker/mobile_scanner/tree/master/example
could be used to reproduce the issue, as it contains the needed bits for the texture.

I can look into creating a minimal sample, which only uses the texture API's.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
See above

Flutter Doctor output

Doctor output

Doctor details of one of the reports:

[✓] Flutter (Channel stable, 3.13.8, on macOS 14.1.1 23B81 darwin-arm64, locale en-IT)
    • Flutter version 3.13.8 on channel stable at /Users/gekko/fvm/versions/3.13.8
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c4930c4ac (6 weeks ago), 2023-10-18 10:57:55 -0500
    • Engine revision 767d8c75e8
    • Dart version 3.1.4
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4)
    • Android SDK at /Users/gekko/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0-rc4
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (3 available)
    • Matteo’s iPhone (mobile) • 00008101-0019288C1E30001E • ios            • iOS 17.1.1 21B91
    • macOS (desktop)          • macos                     • darwin-arm64   • macOS 14.1.1 23B81 darwin-arm64
    • Chrome (web)             • chrome                    • web-javascript • Google Chrome 119.0.6045.159

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions