MethanePowered / MethaneKit

🎲 Modern 3D graphics made simple with C++17 cross-platform framework and rendering abstraction API on top of DirectX 12, Metal & Vulkan
Apache License 2.0
878 stars 52 forks source link

Methane applications built for iOS fail to run natively on Macs with Apple Silicon #101

Closed egorodet closed 2 years ago

egorodet commented 2 years ago

Describe the bug Methane applications built for iOS fail to run natively on MacOS with Apple Silicon with error:

[CAMetalLayer nextDrawable] returning nil because device is nil.

Steps To Reproduce Steps to reproduce the behavior:

  1. Build for iOS device: ./Build/Unix/Build.sh --apple-platform OS64 --apple-dev-team 43335E8AZR.
  2. Open generated Xcode workspace from ./Build/Output/Xcode/OS64/MT-Release/Build/METHANE_KIT.xcodeproj.
  3. Automatically generate schemas and select MethaneShadowCube application from the schemas drop-down in Xcode.
  4. Select deployment target My Mac (Designed for iPhone) to the right of schema.
  5. Press Run button in Xcode and see warning and error messages in Xcode log window:
    MethaneShadowCube[10910:2972780] [CAMetalLayer nextDrawable] returning nil because device is nil.
    -[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
    For color attachment 0, the renderPipelineState pixelFormat must be MTLPixelFormatInvalid, as no texture is set.
    the pipelineState's per sample imageBlock usage(4) is greater than the encoder's perSample imageBlock usage(0)'
    Program ended with exit code: 9

Expected behavior iOS application should run normally on MacOS, similarly as it runs on iOS device or simulator.

Desktop (please complete the following information):