KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.64k stars 402 forks source link

Failing to build for visionOS #2160

Closed mkrus closed 4 months ago

mkrus commented 4 months ago

Trying to build MoltenVK for vision OS but getting errors, with latest Xcode and SDKs.

This produces a few deprecated API warnings, and:

1/ a warning on MVKOSExtensions.h:70:1: warning: non-void function does not return a value. Seems like MVK_VISIONOS is not defined

2/ a compile error on MVKSwapchain.mm:193:35: error: property 'screenMVK' not found on object of type 'CAMetalLayer *' visionOS does support screens so that code should not be there.

Full log at https://pastebin.com/eP3jgM3Y

jarrodnorwell commented 4 months ago

Common/MVKCommonEnvironment.h#L73 iirc has been renamed to TARGET_OS_VISION, if you change it and rebuild does it fix the issue?

For the second issue, iirc visionOS apps don't use UIKit or AppKit so UIScreen and NSScreen don't exist, you'd need to somehow loop through the SwiftUI views (if possible) and get the first instance of a CAMetalLayer (if it exists)

Just noticed the last statement about screens, ignore my last bit.

billhollings commented 4 months ago

PR #2161 fixes this.