Added working demo target for VisionOS in Cube Demo

This commit is contained in:
Raphael Dobers
2025-09-15 11:58:50 +02:00
parent 712fbb808d
commit 81e05dd2a8
13 changed files with 493 additions and 30 deletions

View File

@@ -110,11 +110,13 @@ extern "C" {
#ifndef MVK_XCODE_26
# define MVK_XCODE_26 ((__MAC_OS_X_VERSION_MAX_ALLOWED >= 260000) || \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 260000) || \
(__VISION_OS_VERSION_MAX_ALLOWED >= 260000) || \
(__TV_OS_VERSION_MAX_ALLOWED >= 260000))
#endif
#ifndef MVK_XCODE_16
# define MVK_XCODE_16 ((__MAC_OS_X_VERSION_MAX_ALLOWED >= 150000) || \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 180000) || \
(__VISION_OS_VERSION_MAX_ALLOWED >= 20000) || \
(__TV_OS_VERSION_MAX_ALLOWED >= 180000))
#endif
#ifndef MVK_XCODE_15

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 70;
objects = {
/* Begin PBXBuildFile section */
@@ -32,6 +32,8 @@
A9F4D8802B88F7B1004AD576 /* MoltenVK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A9F4D88A2B8A9C11004AD576 /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */; };
A9F4D88B2B8A9C11004AD576 /* MoltenVK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F1F8A3432E742A0900E1280A /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */; };
F1F8A3442E742A0900E1280A /* MoltenVK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -68,15 +70,23 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
F1F8A3452E742A0900E1280A /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
F1F8A3442E742A0900E1280A /* MoltenVK.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
A904B5301C9A08C90008C013 /* cube.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cube.c; sourceTree = "<group>"; };
A904B5311C9A08C90008C013 /* cube.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = cube.frag; sourceTree = "<group>"; };
A904B5331C9A08C90008C013 /* cube.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = cube.vert; sourceTree = "<group>"; };
A909989F2B4EE8C3002CEF67 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = ../../MoltenVK/dylib/macOS/libMoltenVK.dylib; sourceTree = "<group>"; };
A90998A22B4EFB51002CEF67 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = ../../MoltenVK/dylib/iOS/libMoltenVK.dylib; sourceTree = "<group>"; };
A90998A52B4EFBAA002CEF67 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = ../../MoltenVK/dylib/tvOS/libMoltenVK.dylib; sourceTree = "<group>"; };
A93DBF4B24A2A4D500079F64 /* Cube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cube.app; sourceTree = BUILT_PRODUCTS_DIR; };
A94D4CB424A2A95E009C9139 /* InfoTV.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = InfoTV.plist; sourceTree = "<group>"; };
A94D4CB624A2C9A3009C9139 /* MainTV.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainTV.storyboard; sourceTree = "<group>"; };
@@ -104,9 +114,23 @@
A9B67B8B1C3AAEA200373FFD /* macOS.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = macOS.xcassets; sourceTree = "<group>"; };
A9B734FE2576E04000455E2A /* Cube.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Cube.entitlements; sourceTree = "<group>"; };
A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK.xcframework; path = ../../Package/Latest/MoltenVK/dynamic/MoltenVK.xcframework; sourceTree = "<group>"; };
A9F4D8862B8A9BD8004AD576 /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK.xcframework; path = ../../Package/Latest/MoltenVK/dynamic/MoltenVK.xcframework; sourceTree = "<group>"; };
F1F8A32C2E74199300E1280A /* Cube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cube.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
F15E3A112E7463C000711757 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
);
target = F1F8A32B2E74199300E1280A /* Cube-VisionOS */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
F1F8A32D2E74199300E1280A /* VisionOS */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (F15E3A112E7463C000711757 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = VisionOS; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
A9F4D8792B8590F2004AD576 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
@@ -132,6 +156,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F1F8A3292E74199300E1280A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F1F8A3432E742A0900E1280A /* MoltenVK.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -141,6 +173,7 @@
A9B53B271C3AC0BE00ABC6F6 /* Cube.app */,
A9B53B431C3AC15200ABC6F6 /* Cube.app */,
A93DBF4B24A2A4D500079F64 /* Cube.app */,
F1F8A32C2E74199300E1280A /* Cube.app */,
);
name = Products;
sourceTree = "<group>";
@@ -152,6 +185,7 @@
A904B52C1C9A08C80008C013 /* cube */,
A9B67B6A1C3AAE9800373FFD /* iOS */,
A9B67B811C3AAEA200373FFD /* macOS */,
F1F8A32D2E74199300E1280A /* VisionOS */,
19C28FACFE9D520D11CA2CBB /* Products */,
A9C2ABA82185085B00DDBC03 /* Frameworks */,
);
@@ -225,10 +259,6 @@
isa = PBXGroup;
children = (
A9F4D8702B858DDE004AD576 /* MoltenVK.xcframework */,
A9F4D8862B8A9BD8004AD576 /* MoltenVK.xcframework */,
A90998A52B4EFBAA002CEF67 /* libMoltenVK.dylib */,
A909989F2B4EE8C3002CEF67 /* libMoltenVK.dylib */,
A90998A22B4EFB51002CEF67 /* libMoltenVK.dylib */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -290,6 +320,29 @@
productReference = A9B53B431C3AC15200ABC6F6 /* Cube.app */;
productType = "com.apple.product-type.application";
};
F1F8A32B2E74199300E1280A /* Cube-VisionOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = F1F8A33C2E74199400E1280A /* Build configuration list for PBXNativeTarget "Cube-VisionOS" */;
buildPhases = (
F1F8A3282E74199300E1280A /* Sources */,
F1F8A3292E74199300E1280A /* Frameworks */,
F1F8A32A2E74199300E1280A /* Resources */,
F1F8A3452E742A0900E1280A /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
F1F8A32D2E74199300E1280A /* VisionOS */,
);
name = "Cube-VisionOS";
packageProductDependencies = (
);
productName = VisionOs;
productReference = F1F8A32C2E74199300E1280A /* Cube.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -324,6 +377,7 @@
A9B53B291C3AC15200ABC6F6 /* Cube-iOS */,
A93DBF3A24A2A4D500079F64 /* Cube-tvOS */,
A9B53B0F1C3AC0BE00ABC6F6 /* Cube-macOS */,
F1F8A32B2E74199300E1280A /* Cube-VisionOS */,
);
};
/* End PBXProject section */
@@ -360,6 +414,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F1F8A32A2E74199300E1280A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -393,6 +454,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F1F8A3282E74199300E1280A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
@@ -621,6 +689,172 @@
};
name = Release;
};
F1F8A3392E74199400E1280A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
MVK_SAMP_CUBE,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/VisionOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.moltenvk.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = Cube;
SDKROOT = xros;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = "xros xrsimulator";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "VisionOS/Cube-VisionOS-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = Debug;
};
F1F8A33A2E74199400E1280A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
VK_NO_PROTOTYPES,
MVK_SAMP_CUBE,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/VisionOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.moltenvk.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = Cube;
SDKROOT = xros;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = "xros xrsimulator";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "VisionOS/Cube-VisionOS-Bridging-Header.h";
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
VALIDATE_PRODUCT = YES;
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -660,6 +894,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F1F8A33C2E74199400E1280A /* Build configuration list for PBXNativeTarget "Cube-VisionOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F1F8A3392E74199400E1280A /* Debug */,
F1F8A33A2E74199400E1280A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1F8A32B2E74199300E1280A"
BuildableName = "Cube.app"
BlueprintName = "Cube-VisionOS"
ReferencedContainer = "container:Cube.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1F8A32B2E74199300E1280A"
BuildableName = "Cube.app"
BlueprintName = "Cube-VisionOS"
ReferencedContainer = "container:Cube.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1F8A32B2E74199300E1280A"
BuildableName = "Cube.app"
BlueprintName = "Cube-VisionOS"
ReferencedContainer = "container:Cube.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,76 @@
import SwiftUI
import QuartzCore
import Metal
final class MetalHostView: UIView {
override class var layerClass: AnyClass { CAMetalLayer.self }
var metalLayer: CAMetalLayer { layer as! CAMetalLayer }
private var didStart = false
override func layoutSubviews() {
super.layoutSubviews()
// Make sure we actually have size
guard bounds.width > 0, bounds.height > 0 else { return }
metalLayer.frame = bounds
metalLayer.contentsScale = 1.0
metalLayer.drawableSize = CGSize(
width: max(1, bounds.width),
height: max(1, bounds.height)
)
if !didStart { // start only once, with real size
didStart = true
let opaque = Unmanaged.passUnretained(metalLayer).toOpaque()
cube_runner_start(opaque)
} else {
cube_runner_resize() // keep resizing after start
}
}
}
struct ContentView: View {
var body: some View {
CubeHostView()
.ignoresSafeArea()
}
}
struct CubeHostView: UIViewRepresentable {
final class Coordinator: NSObject {
var displayLink: CADisplayLink?
@objc func tick() { cube_runner_draw() }
}
func makeCoordinator() -> Coordinator { Coordinator() }
func makeUIView(context: Context) -> MetalHostView {
let view = MetalHostView()
// Configure the CAMetalLayer
view.metalLayer.device = MTLCreateSystemDefaultDevice()
view.metalLayer.pixelFormat = .bgra8Unorm
view.metalLayer.isOpaque = true
view.metalLayer.framebufferOnly = true
view.metalLayer.presentsWithTransaction = false
// Drive rendering
let cADisplayLink = CADisplayLink(target: context.coordinator, selector: #selector(Coordinator.tick))
cADisplayLink.preferredFrameRateRange = CAFrameRateRange(minimum: 30, maximum: 60, preferred: 60)
cADisplayLink.add(to: .main, forMode: .default)
context.coordinator.displayLink = cADisplayLink
return view
}
func updateUIView(_ uiView: MetalHostView, context: Context) {
uiView.setNeedsLayout() // layoutSubviews will size & start/resize
}
static func dismantleUIView(_ uiView: MetalHostView, coordinator: Coordinator) {
coordinator.displayLink?.invalidate()
cube_runner_stop()
}
}

View File

@@ -0,0 +1,6 @@
#import <QuartzCore/CAMetalLayer.h>
void cube_runner_start(void* caMetalLayer);
void cube_runner_draw(void);
void cube_runner_resize(void);
void cube_runner_stop(void);

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationPreferredDefaultSceneSessionRole</key>
<string>UIWindowSceneSessionRoleApplication</string>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict/>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
import SwiftUI
@main
struct VisionOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

View File

@@ -0,0 +1,28 @@
#include <MoltenVK/mvk_vulkan.h>
#include <stdbool.h>
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif
#include "cube.c"
static struct demo g_demo;
void cube_runner_start(void* caMetalLayer) {
memset(&g_demo, 0, sizeof(g_demo));
#if TARGET_OS_SIMULATOR
// Avoid linear host-coherent texture loading on simulator
const char* argv[] = { "cube", "--use_staging" };
demo_main(&g_demo, caMetalLayer, 2, argv);
#else
const char* argv[] = { "cube" };
demo_main(&g_demo, caMetalLayer, 1, argv);
#endif
}
void cube_runner_draw(void) { demo_draw(&g_demo); }
void cube_runner_resize(void) { demo_resize(&g_demo); }
void cube_runner_stop(void) { demo_cleanup(&g_demo); }

View File

@@ -1 +1 @@
682e42f7ae70a8fadf374199c02de737daa5c70d
3e9d7a008869360dccbd8c812f4795afa7f8b416

View File

@@ -31,8 +31,8 @@ all:
@$(MAKE) maccat
@$(MAKE) tvos
@$(MAKE) tvossim
# @$(MAKE) visionos # Requires Xcode 15+
# @$(MAKE) visionossim # Requires Xcode 15+
@$(MAKE) visionos # Requires Xcode 15+
@$(MAKE) visionossim # Requires Xcode 15+
.PHONY: all-debug
all-debug:
@@ -42,8 +42,8 @@ all-debug:
@$(MAKE) maccat-debug
@$(MAKE) tvos-debug
@$(MAKE) tvossim-debug
# @$(MAKE) visionos-debug # Requires Xcode 15+
# @$(MAKE) visionossim-debug # Requires Xcode 15+
@$(MAKE) visionos-debug # Requires Xcode 15+
@$(MAKE) visionossim-debug # Requires Xcode 15+
.PHONY: macos
macos:

View File

@@ -43,7 +43,7 @@
using namespace std;
#if MVK_IOS_OR_TVOS
#if MVK_IOS_OR_TVOS || MVK_VISIONOS
# include <UIKit/UIKit.h>
# define MVKViewClass UIView
#endif
@@ -1636,7 +1636,7 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
// Metal does not allow compressed or depth/stencil formats on 3D textures
if (mvkFmt == kMVKFormatDepthStencil ||
isChromaSubsampled
#if MVK_IOS_OR_TVOS
#if MVK_IOS_OR_TVOS || MVK_VISIONOS
|| (mvkFmt == kMVKFormatCompressed && !_metalFeatures.native3DCompressedTextures)
#endif
) {
@@ -1793,7 +1793,7 @@ uint32_t MVKPhysicalDevice::getExternalResourceMemoryTypeBits(VkExternalMemoryHa
case MTLStorageModeShared:
memoryTypeBits = _hostCoherentMemoryTypes;
break;
#if !MVK_IOS && !MVK_TVOS
#if !MVK_IOS && !MVK_TVOS && !MVK_VISIONOS
case MTLStorageModeManaged:
memoryTypeBits = _hostVisibleMemoryTypes;
break;
@@ -2067,7 +2067,7 @@ VkResult MVKPhysicalDevice::getSurfaceFormats(MVKSurface* surface,
}
#endif
#endif
#if MVK_IOS_OR_TVOS
#if MVK_IOS_OR_TVOS || MVK_VISIONOS
// iOS 8 doesn't support anything but sRGB.
if (mvkOSVersionIsAtLeast(9.0)) {
colorSpaces.push_back(VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT);
@@ -2563,7 +2563,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_0;
_metalFeatures.mtlBufferAlignment = 64;
_metalFeatures.mtlCopyBufferAlignment = 1;
@@ -2674,6 +2674,11 @@ void MVKPhysicalDevice::initMetalFeatures() {
if ( mvkOSVersionIsAtLeast(18.0) ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion3_2;
}
#if MVK_VISIONOS
if ( mvkOSVersionIsAtLeast(2.0) ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion3_2;
}
#endif
#endif
#if MVK_XCODE_26
if ( mvkOSVersionIsAtLeast(26.0) ) {
@@ -2860,7 +2865,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
}
}
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
if (_metalFeatures.simdPermute) {
_metalFeatures.minSubgroupSize = 4;
_metalFeatures.maxSubgroupSize = 32;
@@ -3061,7 +3066,7 @@ void MVKPhysicalDevice::initFeatures() {
}
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
_features.textureCompressionETC2 = true;
if (supportsMTLGPUFamily(Apple2)) {
@@ -3151,7 +3156,7 @@ void MVKPhysicalDevice::initLimits() {
#if MVK_TVOS
_properties.limits.maxColorAttachments = kMVKMaxColorAttachmentCount;
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
if (supportsMTLGPUFamily(Apple2)) {
_properties.limits.maxColorAttachments = kMVKMaxColorAttachmentCount;
} else {
@@ -3235,7 +3240,7 @@ void MVKPhysicalDevice::initLimits() {
_properties.limits.maxUniformBufferRange = (uint32_t)min(_metalFeatures.maxMTLBufferSize, (VkDeviceSize)std::numeric_limits<uint32_t>::max());
}
#endif
#if MVK_IOS_OR_TVOS
#if MVK_IOS_OR_TVOS || MVK_VISIONOS
_properties.limits.maxUniformBufferRange = (uint32_t)min(_metalFeatures.maxMTLBufferSize, (VkDeviceSize)std::numeric_limits<uint32_t>::max());
#endif
_properties.limits.maxStorageBufferRange = (uint32_t)min(_metalFeatures.maxMTLBufferSize, (VkDeviceSize)std::numeric_limits<uint32_t>::max());
@@ -3315,7 +3320,7 @@ void MVKPhysicalDevice::initLimits() {
#if MVK_TVOS
_properties.limits.minTexelBufferOffsetAlignment = 64;
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
if (supportsMTLGPUFamily(Apple3)) {
_properties.limits.minTexelBufferOffsetAlignment = 16;
} else {
@@ -3350,7 +3355,7 @@ void MVKPhysicalDevice::initLimits() {
_properties.limits.maxTessellationGenerationLevel = 16;
_properties.limits.maxTessellationPatchSize = 32;
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
if (mvkOSVersionIsAtLeast(13.0) && supportsMTLGPUFamily(Apple4)) {
_properties.limits.maxFragmentInputComponents = 124;
} else {
@@ -3451,7 +3456,7 @@ void MVKPhysicalDevice::initLimits() {
_properties.limits.maxComputeSharedMemorySize = ((16 * KIBI) - 32);
}
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
if (supportsMTLGPUFamily(Apple4)) {
_properties.limits.maxComputeSharedMemorySize = (32 * KIBI);
} else if (supportsMTLGPUFamily(Apple3)) {
@@ -3771,7 +3776,7 @@ void MVKPhysicalDevice::initMemoryProperties() {
typeIdx++;
}
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
memlessBit = 1 << typeIdx;
setMemoryType(typeIdx, mainHeapIdx, MVK_VK_MEMORY_TYPE_METAL_MEMORYLESS);
typeIdx++;

View File

@@ -85,7 +85,7 @@ MVK_PUBLIC_SYMBOL SPIRVToMSLConversionOptions::SPIRVToMSLConversionOptions() {
#if MVK_MACOS
mslOptions.platform = CompilerMSL::Options::macOS;
#endif
#if MVK_IOS
#if MVK_IOS_OR_VISIONOS
mslOptions.platform = CompilerMSL::Options::iOS;
#endif
#if MVK_TVOS

View File

@@ -166,8 +166,8 @@ while (( "$#" )); do
BLD_MAC_CAT="Y"
BLD_TVOS="Y"
BLD_TVOS_SIM="Y"
# BLD_VISIONOS="Y" # Requires Xcode 15+
# BLD_VISIONOS_SIM="Y" # Requires Xcode 15+
BLD_VISIONOS="Y" # Requires Xcode 15+
BLD_VISIONOS_SIM="Y" # Requires Xcode 15+
shift 1
;;
--none)