├── .github └── workflows │ └── CI.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Common ├── MVKCommonEnvironment.h ├── MVKOSExtensions.h ├── MVKOSExtensions.mm └── MVKStrings.h ├── Demos ├── Cube │ ├── Cube.entitlements │ ├── Cube.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Cube-iOS.xcscheme │ │ │ ├── Cube-macOS.xcscheme │ │ │ └── Cube-tvOS.xcscheme │ ├── iOS │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── DemoViewController.h │ │ ├── DemoViewController.m │ │ ├── Info.plist │ │ ├── InfoTV.plist │ │ ├── Prefix.pch │ │ ├── Resources │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default~ipad.png │ │ │ ├── Icon.png │ │ │ ├── Main.storyboard │ │ │ └── MainTV.storyboard │ │ └── main.m │ ├── include │ │ ├── cube │ │ └── volk │ └── macOS │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── DemoViewController.h │ │ ├── DemoViewController.m │ │ ├── Info.plist │ │ ├── Prefix.pch │ │ ├── Resources │ │ ├── Main.storyboard │ │ └── macOS.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-128.png │ │ │ ├── Icon-16.png │ │ │ ├── Icon-256.png │ │ │ ├── Icon-32.png │ │ │ └── Icon-512.png │ │ │ └── Contents.json │ │ └── main.m ├── Demos.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── README.md ├── Docs ├── MoltenVK_Configuration_Parameters.md ├── MoltenVK_Runtime_UserGuide.md ├── Whats_New.md └── images │ └── MoltenVK-Logo-Banner.png ├── ExternalDependencies.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── ExternalDependencies (Debug).xcscheme │ ├── ExternalDependencies-iOS.xcscheme │ ├── ExternalDependencies-macOS.xcscheme │ ├── ExternalDependencies-tvOS.xcscheme │ ├── ExternalDependencies-xrOS.xcscheme │ ├── ExternalDependencies.xcscheme │ ├── SPIRV-Cross-iOS.xcscheme │ ├── SPIRV-Cross-macOS.xcscheme │ ├── SPIRV-Cross-tvOS.xcscheme │ ├── SPIRV-Cross-xrOS.xcscheme │ ├── SPIRV-Tools-iOS.xcscheme │ ├── SPIRV-Tools-macOS.xcscheme │ ├── SPIRV-Tools-tvOS.xcscheme │ └── SPIRV-Tools-xrOS.xcscheme ├── ExternalRevisions ├── README.md ├── SPIRV-Cross_repo_revision ├── SPIRV-Headers_repo_revision ├── SPIRV-Tools_repo_revision ├── Volk_repo_revision ├── Vulkan-Headers_repo_revision ├── Vulkan-Tools_repo_revision └── cereal_repo_revision ├── LICENSE ├── Makefile ├── MoltenVK ├── MoltenVK.xcodeproj │ └── project.pbxproj ├── MoltenVK │ ├── API │ │ ├── mvk_config.h │ │ ├── mvk_datatypes.h │ │ ├── mvk_deprecated_api.h │ │ ├── mvk_private_api.h │ │ ├── mvk_vulkan.h │ │ └── vk_mvk_moltenvk.h │ ├── Commands │ │ ├── MVKCmdDebug.h │ │ ├── MVKCmdDebug.mm │ │ ├── MVKCmdDispatch.h │ │ ├── MVKCmdDispatch.mm │ │ ├── MVKCmdDraw.h │ │ ├── MVKCmdDraw.mm │ │ ├── MVKCmdPipeline.h │ │ ├── MVKCmdPipeline.mm │ │ ├── MVKCmdQueries.h │ │ ├── MVKCmdQueries.mm │ │ ├── MVKCmdRendering.h │ │ ├── MVKCmdRendering.mm │ │ ├── MVKCmdTransfer.h │ │ ├── MVKCmdTransfer.mm │ │ ├── MVKCommand.h │ │ ├── MVKCommandBuffer.h │ │ ├── MVKCommandBuffer.mm │ │ ├── MVKCommandEncoderState.h │ │ ├── MVKCommandEncoderState.mm │ │ ├── MVKCommandEncodingPool.h │ │ ├── MVKCommandEncodingPool.mm │ │ ├── MVKCommandPipelineStateFactoryShaderSource.h │ │ ├── MVKCommandPool.h │ │ ├── MVKCommandPool.mm │ │ ├── MVKCommandResourceFactory.h │ │ ├── MVKCommandResourceFactory.mm │ │ ├── MVKCommandTypePools.def │ │ ├── MVKMTLBufferAllocation.h │ │ ├── MVKMTLBufferAllocation.mm │ │ └── MVKMTLResourceBindings.h │ ├── GPUObjects │ │ ├── MVKBuffer.h │ │ ├── MVKBuffer.mm │ │ ├── MVKDescriptor.h │ │ ├── MVKDescriptor.mm │ │ ├── MVKDescriptorSet.h │ │ ├── MVKDescriptorSet.mm │ │ ├── MVKDevice.h │ │ ├── MVKDevice.mm │ │ ├── MVKDeviceFeatureStructs.def │ │ ├── MVKDeviceMemory.h │ │ ├── MVKDeviceMemory.mm │ │ ├── MVKFramebuffer.h │ │ ├── MVKFramebuffer.mm │ │ ├── MVKImage.h │ │ ├── MVKImage.mm │ │ ├── MVKInstance.h │ │ ├── MVKInstance.mm │ │ ├── MVKPipeline.h │ │ ├── MVKPipeline.mm │ │ ├── MVKPixelFormats.h │ │ ├── MVKPixelFormats.mm │ │ ├── MVKQueryPool.h │ │ ├── MVKQueryPool.mm │ │ ├── MVKQueue.h │ │ ├── MVKQueue.mm │ │ ├── MVKRenderPass.h │ │ ├── MVKRenderPass.mm │ │ ├── MVKResource.h │ │ ├── MVKResource.mm │ │ ├── MVKShaderModule.h │ │ ├── MVKShaderModule.mm │ │ ├── MVKSurface.h │ │ ├── MVKSurface.mm │ │ ├── MVKSwapchain.h │ │ ├── MVKSwapchain.mm │ │ ├── MVKSync.h │ │ ├── MVKSync.mm │ │ ├── MVKVulkanAPIObject.h │ │ └── MVKVulkanAPIObject.mm │ ├── Layers │ │ ├── MVKExtensions.def │ │ ├── MVKExtensions.h │ │ ├── MVKExtensions.mm │ │ ├── MVKLayers.h │ │ └── MVKLayers.mm │ ├── OS │ │ ├── CAMetalLayer+MoltenVK.h │ │ ├── CAMetalLayer+MoltenVK.mm │ │ ├── MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h │ │ ├── MTLRenderPassDepthAttachmentDescriptor+MoltenVK.m │ │ ├── MTLRenderPassDescriptor+MoltenVK.h │ │ ├── MTLRenderPassDescriptor+MoltenVK.m │ │ ├── MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h │ │ ├── MTLRenderPassStencilAttachmentDescriptor+MoltenVK.m │ │ ├── MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.h │ │ ├── MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.m │ │ ├── MTLRenderPipelineDescriptor+MoltenVK.h │ │ ├── MTLRenderPipelineDescriptor+MoltenVK.m │ │ ├── MTLSamplerDescriptor+MoltenVK.h │ │ ├── MTLSamplerDescriptor+MoltenVK.m │ │ ├── MTLTextureDescriptor+MoltenVK.h │ │ ├── MTLTextureDescriptor+MoltenVK.m │ │ ├── MVKGPUCapture.h │ │ ├── MVKGPUCapture.mm │ │ ├── NSString+MoltenVK.h │ │ └── NSString+MoltenVK.mm │ ├── Utility │ │ ├── MVKBaseObject.h │ │ ├── MVKBaseObject.mm │ │ ├── MVKBitArray.h │ │ ├── MVKBlockObserver.h │ │ ├── MVKBlockObserver.m │ │ ├── MVKCodec.h │ │ ├── MVKCodec.mm │ │ ├── MVKConfigMembers.def │ │ ├── MVKDXTnCodec.def │ │ ├── MVKEnvironment.cpp │ │ ├── MVKEnvironment.h │ │ ├── MVKFoundation.cpp │ │ ├── MVKFoundation.h │ │ ├── MVKInflectionMap.h │ │ ├── MVKLogging.h │ │ ├── MVKObjectPool.h │ │ ├── MVKSmallVector.h │ │ ├── MVKSmallVectorAllocator.h │ │ ├── MVKWatermark.h │ │ ├── MVKWatermark.mm │ │ ├── MVKWatermarkShaderSource.h │ │ └── MVKWatermarkTextureContent.h │ └── Vulkan │ │ ├── mvk_api.mm │ │ ├── mvk_datatypes.hpp │ │ ├── mvk_datatypes.mm │ │ └── vulkan.mm ├── icd │ └── MoltenVK_icd.json └── include │ ├── MoltenVK │ ├── vk_video │ └── vulkan ├── MoltenVKPackaging.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── MoltenVK Package (MacCat only).xcscheme │ ├── MoltenVK Package (iOS only).xcscheme │ ├── MoltenVK Package (macOS only).xcscheme │ ├── MoltenVK Package (tvOS only).xcscheme │ ├── MoltenVK Package (visionOS only).xcscheme │ └── MoltenVK Package.xcscheme ├── MoltenVKShaderConverter ├── MoltenVKShaderConverter.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── MoltenVKShaderConverter.xcscheme ├── MoltenVKShaderConverter │ ├── FileSupport.h │ ├── FileSupport.mm │ ├── SPIRVConversion.h │ ├── SPIRVConversion.mm │ ├── SPIRVReflection.h │ ├── SPIRVSupport.cpp │ ├── SPIRVSupport.h │ ├── SPIRVToMSLConverter.cpp │ └── SPIRVToMSLConverter.h ├── MoltenVKShaderConverterTool │ ├── MoltenVKShaderConverterTool.cpp │ ├── MoltenVKShaderConverterTool.h │ ├── OSSupport.h │ ├── OSSupport.mm │ └── main.cpp ├── SPIRV-Cross ├── SPIRV-Tools ├── Tools └── include │ └── MoltenVKShaderConverter │ ├── SPIRVConversion.h │ └── SPIRVToMSLConverter.h ├── README.md ├── Scripts ├── clean_dynamic.sh ├── copy_ext_lib_to_staging.sh ├── copy_lib_to_staging.sh ├── copy_to_staging.sh ├── create_dylib_xros.sh ├── create_ext_lib_xcframeworks.sh ├── create_xcframework_func.sh ├── gen_moltenvk_rev_hdr.sh ├── get_failing_cts_tests.py ├── packagePregenSpirvToolsHeaders ├── package_all.sh ├── package_docs.sh ├── package_dylibs.sh ├── package_ext_libs_finish.sh ├── package_headers.sh ├── package_moltenvk_xcframework.sh ├── package_shader_converter_tool.sh ├── package_shader_converter_xcframework.sh ├── package_update_latest.sh └── runcts ├── Templates └── spirv-tools │ └── build.zip └── fetchDependencies /.gitignore: -------------------------------------------------------------------------------- 1 | # MoltenVK runtime build 2 | /Package 3 | 4 | # MoltenVK dependencies 5 | /External 6 | 7 | # Vulkan CTS testing artifacts 8 | /Scripts/TestResults.qpa 9 | /Scripts/shadercache.bin 10 | 11 | # Mac OS X Finder 12 | .DS_Store 13 | 14 | # Xcode 15 | xcuserdata/ 16 | project.xcworkspace/ 17 | *.xccheckout 18 | *.xcscmblueprint 19 | 20 | # build products 21 | build/ 22 | *.[oa] 23 | 24 | # Other source repository archive directories (protects when importing) 25 | .hg 26 | .svn 27 | CVS 28 | 29 | # automatic backup files 30 | *~.nib 31 | *.swp 32 | *~ 33 | *(Autosaved).rtfd/ 34 | Backup[ ]of[ ]*.pages/ 35 | Backup[ ]of[ ]*.key/ 36 | Backup[ ]of[ ]*.numbers/ 37 | 38 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. 2 | -------------------------------------------------------------------------------- /Demos/Cube/Cube.entitlements: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>com.apple.security.app-sandbox</key> 6 | <true/> 7 | <key>com.apple.security.network.client</key> 8 | <true/> 9 | </dict> 10 | </plist> 11 | -------------------------------------------------------------------------------- /Demos/Cube/Cube.xcodeproj/xcshareddata/xcschemes/Cube-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A9B53B291C3AC15200ABC6F6" 18 | BuildableName = "Cube.app" 19 | BlueprintName = "Cube-iOS" 20 | ReferencedContainer = "container:Cube.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "" 36 | selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "YES" 41 | debugXPCServices = "NO" 42 | debugServiceExtension = "internal" 43 | enableGPUFrameCaptureMode = "3" 44 | enableGPUValidationMode = "1" 45 | allowLocationSimulation = "NO" 46 | viewDebuggingEnabled = "No" 47 | queueDebuggingEnabled = "No"> 48 | <BuildableProductRunnable 49 | runnableDebuggingMode = "0"> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "A9B53B291C3AC15200ABC6F6" 53 | BuildableName = "Cube.app" 54 | BlueprintName = "Cube-iOS" 55 | ReferencedContainer = "container:Cube.xcodeproj"> 56 | </BuildableReference> 57 | </BuildableProductRunnable> 58 | </LaunchAction> 59 | <ProfileAction 60 | buildConfiguration = "Release" 61 | shouldUseLaunchSchemeArgsEnv = "YES" 62 | savedToolIdentifier = "" 63 | useCustomWorkingDirectory = "NO" 64 | debugDocumentVersioning = "YES"> 65 | <MacroExpansion> 66 | <BuildableReference 67 | BuildableIdentifier = "primary" 68 | BlueprintIdentifier = "A9B53B291C3AC15200ABC6F6" 69 | BuildableName = "Cube.app" 70 | BlueprintName = "Cube-iOS" 71 | ReferencedContainer = "container:Cube.xcodeproj"> 72 | </BuildableReference> 73 | </MacroExpansion> 74 | </ProfileAction> 75 | <AnalyzeAction 76 | buildConfiguration = "Debug"> 77 | </AnalyzeAction> 78 | <ArchiveAction 79 | buildConfiguration = "Release" 80 | revealArchiveInOrganizer = "YES"> 81 | </ArchiveAction> 82 | </Scheme> 83 | -------------------------------------------------------------------------------- /Demos/Cube/Cube.xcodeproj/xcshareddata/xcschemes/Cube-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A9B53B0F1C3AC0BE00ABC6F6" 18 | BuildableName = "Cube.app" 19 | BlueprintName = "Cube-macOS" 20 | ReferencedContainer = "container:Cube.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "" 36 | selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "NO" 41 | debugXPCServices = "NO" 42 | debugServiceExtension = "internal" 43 | enableGPUFrameCaptureMode = "3" 44 | enableGPUValidationMode = "1" 45 | allowLocationSimulation = "NO" 46 | viewDebuggingEnabled = "No" 47 | queueDebuggingEnabled = "No"> 48 | <BuildableProductRunnable 49 | runnableDebuggingMode = "0"> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "A9B53B0F1C3AC0BE00ABC6F6" 53 | BuildableName = "Cube.app" 54 | BlueprintName = "Cube-macOS" 55 | ReferencedContainer = "container:Cube.xcodeproj"> 56 | </BuildableReference> 57 | </BuildableProductRunnable> 58 | </LaunchAction> 59 | <ProfileAction 60 | buildConfiguration = "Release" 61 | shouldUseLaunchSchemeArgsEnv = "YES" 62 | savedToolIdentifier = "" 63 | useCustomWorkingDirectory = "NO" 64 | debugDocumentVersioning = "YES"> 65 | <BuildableProductRunnable 66 | runnableDebuggingMode = "0"> 67 | <BuildableReference 68 | BuildableIdentifier = "primary" 69 | BlueprintIdentifier = "A9B53B0F1C3AC0BE00ABC6F6" 70 | BuildableName = "Cube.app" 71 | BlueprintName = "Cube-macOS" 72 | ReferencedContainer = "container:Cube.xcodeproj"> 73 | </BuildableReference> 74 | </BuildableProductRunnable> 75 | </ProfileAction> 76 | <AnalyzeAction 77 | buildConfiguration = "Debug"> 78 | </AnalyzeAction> 79 | <ArchiveAction 80 | buildConfiguration = "Release" 81 | revealArchiveInOrganizer = "YES"> 82 | </ArchiveAction> 83 | </Scheme> 84 | -------------------------------------------------------------------------------- /Demos/Cube/Cube.xcodeproj/xcshareddata/xcschemes/Cube-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A93DBF3A24A2A4D500079F64" 18 | BuildableName = "Cube.app" 19 | BlueprintName = "Cube-tvOS" 20 | ReferencedContainer = "container:Cube.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "" 36 | selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "YES" 41 | debugXPCServices = "NO" 42 | debugServiceExtension = "internal" 43 | enableGPUFrameCaptureMode = "3" 44 | enableGPUValidationMode = "1" 45 | allowLocationSimulation = "NO" 46 | viewDebuggingEnabled = "No" 47 | queueDebuggingEnabled = "No"> 48 | <BuildableProductRunnable 49 | runnableDebuggingMode = "0"> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "A93DBF3A24A2A4D500079F64" 53 | BuildableName = "Cube.app" 54 | BlueprintName = "Cube-tvOS" 55 | ReferencedContainer = "container:Cube.xcodeproj"> 56 | </BuildableReference> 57 | </BuildableProductRunnable> 58 | </LaunchAction> 59 | <ProfileAction 60 | buildConfiguration = "Release" 61 | shouldUseLaunchSchemeArgsEnv = "YES" 62 | savedToolIdentifier = "" 63 | useCustomWorkingDirectory = "NO" 64 | debugDocumentVersioning = "YES"> 65 | </ProfileAction> 66 | <AnalyzeAction 67 | buildConfiguration = "Debug"> 68 | </AnalyzeAction> 69 | <ArchiveAction 70 | buildConfiguration = "Release" 71 | revealArchiveInOrganizer = "YES"> 72 | </ArchiveAction> 73 | </Scheme> 74 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AppDelegate.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <UIKit/UIKit.h> 20 | 21 | @interface AppDelegate : UIResponder <UIApplicationDelegate> 22 | 23 | @property (strong, nonatomic) UIWindow *window; 24 | 25 | @end 26 | 27 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * AppDelegate.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import "AppDelegate.h" 20 | 21 | @interface AppDelegate () 22 | 23 | @end 24 | 25 | @implementation AppDelegate 26 | 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 29 | // Override point for customization after application launch. 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 35 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application { 48 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/DemoViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DemoViewController.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <UIKit/UIKit.h> 20 | 21 | 22 | #pragma mark - 23 | #pragma mark DemoViewController 24 | 25 | /** The main view controller for the demo storyboard. */ 26 | @interface DemoViewController : UIViewController 27 | @end 28 | 29 | 30 | #pragma mark - 31 | #pragma mark DemoView 32 | 33 | /** The Metal-compatibile view for the demo Storyboard. */ 34 | @interface DemoView : UIView 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/DemoViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * DemoViewController.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import "DemoViewController.h" 20 | 21 | #include <MoltenVK/mvk_vulkan.h> 22 | #include "cube.c" 23 | 24 | 25 | #pragma mark - 26 | #pragma mark DemoViewController 27 | 28 | @implementation DemoViewController { 29 | CADisplayLink* _displayLink; 30 | struct demo demo; 31 | } 32 | 33 | /** Since this is a single-view app, initialize Vulkan as view is appearing. */ 34 | -(void) viewWillAppear: (BOOL) animated { 35 | [super viewWillAppear: animated]; 36 | 37 | self.view.contentScaleFactor = UIScreen.mainScreen.nativeScale; 38 | 39 | #if TARGET_OS_SIMULATOR 40 | // Avoid linear host-coherent texture loading on simulator 41 | const char* argv[] = { "cube", "--use_staging" }; 42 | #else 43 | const char* argv[] = { "cube" }; 44 | #endif 45 | int argc = sizeof(argv)/sizeof(char*); 46 | demo_main(&demo, self.view.layer, argc, argv); 47 | demo_draw(&demo); 48 | 49 | uint32_t fps = 60; 50 | _displayLink = [CADisplayLink displayLinkWithTarget: self selector: @selector(renderLoop)]; 51 | [_displayLink setFrameInterval: 60 / fps]; 52 | [_displayLink addToRunLoop: NSRunLoop.currentRunLoop forMode: NSDefaultRunLoopMode]; 53 | } 54 | 55 | -(void) renderLoop { 56 | demo_draw(&demo); 57 | } 58 | 59 | // Allow device rotation to resize the swapchain 60 | -(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { 61 | [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; 62 | demo_resize(&demo); 63 | } 64 | 65 | -(void) viewDidDisappear: (BOOL) animated { 66 | [_displayLink invalidate]; 67 | [_displayLink release]; 68 | demo_cleanup(&demo); 69 | [super viewDidDisappear: animated]; 70 | } 71 | 72 | @end 73 | 74 | 75 | #pragma mark - 76 | #pragma mark DemoView 77 | 78 | @implementation DemoView 79 | 80 | /** Returns a Metal-compatible layer. */ 81 | +(Class) layerClass { return [CAMetalLayer class]; } 82 | 83 | @end 84 | 85 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>CFBundleDevelopmentRegion</key> 6 | <string>English</string> 7 | <key>CFBundleDisplayName</key> 8 | <string>${PRODUCT_NAME}</string> 9 | <key>CFBundleExecutable</key> 10 | <string>${EXECUTABLE_NAME}</string> 11 | <key>CFBundleIconFile</key> 12 | <string>iOS/Resources/Icon.png</string> 13 | <key>CFBundleIcons~ipad</key> 14 | <dict/> 15 | <key>CFBundleIdentifier</key> 16 | <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 17 | <key>CFBundleInfoDictionaryVersion</key> 18 | <string>6.0</string> 19 | <key>CFBundleName</key> 20 | <string>${PRODUCT_NAME}</string> 21 | <key>CFBundlePackageType</key> 22 | <string>APPL</string> 23 | <key>CFBundleShortVersionString</key> 24 | <string>$(MARKETING_VERSION)</string> 25 | <key>CFBundleVersion</key> 26 | <string>$(CURRENT_PROJECT_VERSION)</string> 27 | <key>LSApplicationCategoryType</key> 28 | <string></string> 29 | <key>UIMainStoryboardFile</key> 30 | <string>Main</string> 31 | <key>UIRequiresFullScreen</key> 32 | <true/> 33 | <key>UIStatusBarHidden</key> 34 | <true/> 35 | <key>UISupportedInterfaceOrientations</key> 36 | <array> 37 | <string>UIInterfaceOrientationLandscapeLeft</string> 38 | <string>UIInterfaceOrientationLandscapeRight</string> 39 | <string>UIInterfaceOrientationPortrait</string> 40 | <string>UIInterfaceOrientationPortraitUpsideDown</string> 41 | </array> 42 | <key>UISupportedInterfaceOrientations~ipad</key> 43 | <array> 44 | <string>UIInterfaceOrientationLandscapeLeft</string> 45 | <string>UIInterfaceOrientationLandscapeRight</string> 46 | <string>UIInterfaceOrientationPortrait</string> 47 | <string>UIInterfaceOrientationPortraitUpsideDown</string> 48 | </array> 49 | <key>UIViewControllerBasedStatusBarAppearance</key> 50 | <false/> 51 | </dict> 52 | </plist> 53 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/InfoTV.plist: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>CFBundleDevelopmentRegion</key> 6 | <string>English</string> 7 | <key>CFBundleDisplayName</key> 8 | <string>${PRODUCT_NAME}</string> 9 | <key>CFBundleExecutable</key> 10 | <string>${EXECUTABLE_NAME}</string> 11 | <key>CFBundleIconFile</key> 12 | <string>iOS/Resources/Icon.png</string> 13 | <key>CFBundleIcons~ipad</key> 14 | <dict/> 15 | <key>CFBundleIdentifier</key> 16 | <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 17 | <key>CFBundleInfoDictionaryVersion</key> 18 | <string>6.0</string> 19 | <key>CFBundleName</key> 20 | <string>${PRODUCT_NAME}</string> 21 | <key>CFBundlePackageType</key> 22 | <string>APPL</string> 23 | <key>CFBundleShortVersionString</key> 24 | <string>$(MARKETING_VERSION)</string> 25 | <key>CFBundleVersion</key> 26 | <string>$(CURRENT_PROJECT_VERSION)</string> 27 | <key>LSApplicationCategoryType</key> 28 | <string></string> 29 | <key>UIMainStoryboardFile</key> 30 | <string>MainTV</string> 31 | <key>UIRequiresFullScreen</key> 32 | <true/> 33 | <key>UIStatusBarHidden</key> 34 | <true/> 35 | <key>UISupportedInterfaceOrientations</key> 36 | <array> 37 | <string>UIInterfaceOrientationLandscapeLeft</string> 38 | <string>UIInterfaceOrientationLandscapeRight</string> 39 | <string>UIInterfaceOrientationPortrait</string> 40 | <string>UIInterfaceOrientationPortraitUpsideDown</string> 41 | </array> 42 | <key>UISupportedInterfaceOrientations~ipad</key> 43 | <array> 44 | <string>UIInterfaceOrientationLandscapeLeft</string> 45 | <string>UIInterfaceOrientationLandscapeRight</string> 46 | <string>UIInterfaceOrientationPortrait</string> 47 | <string>UIInterfaceOrientationPortraitUpsideDown</string> 48 | </array> 49 | <key>UIViewControllerBasedStatusBarAppearance</key> 50 | <false/> 51 | </dict> 52 | </plist> 53 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/Prefix.pch: -------------------------------------------------------------------------------- 1 | #import <TargetConditionals.h> 2 | 3 | #ifdef __OBJC__ 4 | #import <UIKit/UIKit.h> 5 | #endif 6 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /Demos/Cube/iOS/Resources/Default~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/iOS/Resources/Default~ipad.png -------------------------------------------------------------------------------- /Demos/Cube/iOS/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/iOS/Resources/Icon.png -------------------------------------------------------------------------------- /Demos/Cube/iOS/Resources/Main.storyboard: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vmV-Wi-8wg"> 3 | <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/> 4 | <dependencies> 5 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> 6 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 7 | </dependencies> 8 | <scenes> 9 | <!--Demo View Controller--> 10 | <scene sceneID="UPC-Y9-dN2"> 11 | <objects> 12 | <viewController id="vmV-Wi-8wg" customClass="DemoViewController" sceneMemberID="viewController"> 13 | <layoutGuides> 14 | <viewControllerLayoutGuide type="top" id="klr-UD-pWY"/> 15 | <viewControllerLayoutGuide type="bottom" id="lMV-Es-kLU"/> 16 | </layoutGuides> 17 | <view key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="xKx-Gc-5Is" customClass="DemoView"> 18 | <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/> 19 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 20 | </view> 21 | </viewController> 22 | <placeholder placeholderIdentifier="IBFirstResponder" id="ERB-qy-6pP" userLabel="First Responder" sceneMemberID="firstResponder"/> 23 | </objects> 24 | <point key="canvasLocation" x="404" y="555"/> 25 | </scene> 26 | </scenes> 27 | </document> 28 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/Resources/MainTV.storyboard: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="16097" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="fFL-Fw-4sa"> 3 | <device id="appleTV" appearance="light"/> 4 | <dependencies> 5 | <deployment identifier="tvOS"/> 6 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> 7 | <capability name="Safe area layout guides" minToolsVersion="9.0"/> 8 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 9 | </dependencies> 10 | <scenes> 11 | <!--Demo View Controller--> 12 | <scene sceneID="4X5-3H-4Vr"> 13 | <objects> 14 | <viewController id="fFL-Fw-4sa" customClass="DemoViewController" sceneMemberID="viewController"> 15 | <layoutGuides> 16 | <viewControllerLayoutGuide type="top" id="BnD-cI-3CU"/> 17 | <viewControllerLayoutGuide type="bottom" id="Hbq-NS-8mc"/> 18 | </layoutGuides> 19 | <view key="view" contentMode="scaleToFill" id="xhu-n8-sOz" customClass="DemoView"> 20 | <rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/> 21 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 22 | <viewLayoutGuide key="safeArea" id="t9G-P1-nOE"/> 23 | </view> 24 | </viewController> 25 | <placeholder placeholderIdentifier="IBFirstResponder" id="kBP-wi-UBI" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> 26 | </objects> 27 | <point key="canvasLocation" x="-384" y="-36"/> 28 | </scene> 29 | </scenes> 30 | </document> 31 | -------------------------------------------------------------------------------- /Demos/Cube/iOS/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * main.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <UIKit/UIKit.h> 20 | 21 | int main(int argc, char * argv[]) { 22 | @autoreleasepool { 23 | return UIApplicationMain(argc, argv, nil, @"AppDelegate"); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Demos/Cube/include/cube: -------------------------------------------------------------------------------- 1 | ../../../External/Vulkan-Tools/cube -------------------------------------------------------------------------------- /Demos/Cube/include/volk: -------------------------------------------------------------------------------- 1 | ../../../External/Volk -------------------------------------------------------------------------------- /Demos/Cube/macOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AppDelegate.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <Cocoa/Cocoa.h> 20 | 21 | @interface AppDelegate : NSObject <NSApplicationDelegate> 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Demos/Cube/macOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * AppDelegate.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import "AppDelegate.h" 20 | 21 | @interface AppDelegate () 22 | 23 | @end 24 | 25 | @implementation AppDelegate 26 | 27 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 28 | // Insert code here to initialize your application 29 | } 30 | 31 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 32 | // Insert code here to tear down your application 33 | } 34 | 35 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 36 | return YES; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Demos/Cube/macOS/DemoViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DemoViewController.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <AppKit/AppKit.h> 20 | 21 | 22 | #pragma mark - 23 | #pragma mark DemoViewController 24 | 25 | /** The main view controller for the demo storyboard. */ 26 | @interface DemoViewController : NSViewController 27 | @end 28 | 29 | 30 | #pragma mark - 31 | #pragma mark DemoView 32 | 33 | /** The Metal-compatibile view for the demo Storyboard. */ 34 | @interface DemoView : NSView 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /Demos/Cube/macOS/Info.plist: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>CFBundleDevelopmentRegion</key> 6 | <string>en</string> 7 | <key>CFBundleExecutable</key> 8 | <string>${EXECUTABLE_NAME}</string> 9 | <key>CFBundleIdentifier</key> 10 | <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 11 | <key>CFBundleInfoDictionaryVersion</key> 12 | <string>6.0</string> 13 | <key>CFBundleName</key> 14 | <string>${PRODUCT_NAME}</string> 15 | <key>CFBundlePackageType</key> 16 | <string>APPL</string> 17 | <key>CFBundleShortVersionString</key> 18 | <string>1.0</string> 19 | <key>CFBundleSignature</key> 20 | <string>????</string> 21 | <key>CFBundleVersion</key> 22 | <string>1</string> 23 | <key>LSApplicationCategoryType</key> 24 | <string></string> 25 | <key>LSMinimumSystemVersion</key> 26 | <string>${MACOSX_DEPLOYMENT_TARGET}</string> 27 | <key>NSHumanReadableCopyright</key> 28 | <string>Copyright (c) 2015-2025 The Brenwill Workshop Ltd. All rights reserved.</string> 29 | <key>NSMainStoryboardFile</key> 30 | <string>Main</string> 31 | <key>NSPrincipalClass</key> 32 | <string>NSApplication</string> 33 | </dict> 34 | </plist> 35 | -------------------------------------------------------------------------------- /Demos/Cube/macOS/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the project 3 | // 4 | -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "Icon-16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "idiom" : "mac", 11 | "size" : "16x16", 12 | "scale" : "2x" 13 | }, 14 | { 15 | "size" : "32x32", 16 | "idiom" : "mac", 17 | "filename" : "Icon-32.png", 18 | "scale" : "1x" 19 | }, 20 | { 21 | "idiom" : "mac", 22 | "size" : "32x32", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "size" : "128x128", 27 | "idiom" : "mac", 28 | "filename" : "Icon-128.png", 29 | "scale" : "1x" 30 | }, 31 | { 32 | "idiom" : "mac", 33 | "size" : "128x128", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "size" : "256x256", 38 | "idiom" : "mac", 39 | "filename" : "Icon-256.png", 40 | "scale" : "1x" 41 | }, 42 | { 43 | "idiom" : "mac", 44 | "size" : "256x256", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "size" : "512x512", 49 | "idiom" : "mac", 50 | "filename" : "Icon-512.png", 51 | "scale" : "1x" 52 | }, 53 | { 54 | "idiom" : "mac", 55 | "size" : "512x512", 56 | "scale" : "2x" 57 | } 58 | ], 59 | "info" : { 60 | "version" : 1, 61 | "author" : "xcode" 62 | } 63 | } -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-128.png -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-16.png -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-256.png -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-32.png -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Demos/Cube/macOS/Resources/macOS.xcassets/AppIcon.appiconset/Icon-512.png -------------------------------------------------------------------------------- /Demos/Cube/macOS/Resources/macOS.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demos/Cube/macOS/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * main.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #import <Cocoa/Cocoa.h> 20 | 21 | int main(int argc, const char * argv[]) { 22 | return NSApplicationMain(argc, argv); 23 | } 24 | -------------------------------------------------------------------------------- /Demos/Demos.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Workspace 3 | version = "1.0"> 4 | <FileRef 5 | location = "group:README.md"> 6 | </FileRef> 7 | <FileRef 8 | location = "group:Cube/Cube.xcodeproj"> 9 | </FileRef> 10 | </Workspace> 11 | -------------------------------------------------------------------------------- /Demos/Demos.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>IDEDidComputeMac32BitWarning</key> 6 | <true/> 7 | </dict> 8 | </plist> 9 | -------------------------------------------------------------------------------- /Demos/Demos.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key> 6 | <false/> 7 | </dict> 8 | </plist> 9 | -------------------------------------------------------------------------------- /Demos/README.md: -------------------------------------------------------------------------------- 1 | <a class="site-logo" href="https://github.com/KhronosGroup/MoltenVK" title="MoltenVK"> 2 | <img src="../Docs/images/MoltenVK-Logo-Banner.png" alt="MoltenVK" style="width:256px;height:auto"> 3 | </a> 4 | 5 | 6 | 7 | #MoltenVK Demo Projects 8 | 9 | Copyright (c) 2015-2025 [The Brenwill Workshop Ltd.](http://www.brenwill.com) 10 | 11 | [comment]: # "This document is written in Markdown (http://en.wikipedia.org/wiki/Markdown) format." 12 | [comment]: # "For best results, use a Markdown reader." 13 | 14 | 15 | 16 | Table of Contents 17 | ----------------- 18 | 19 | - [*Cube*](#vulkan-tools-cube) 20 | - [Khronos Vulkan-Samples](#khronos-vulkan-samples) 21 | 22 | 23 | <a name="vulkan-tools-cube"></a> 24 | *Cube* 25 | ------ 26 | 27 | The basic canonical *Cube* sample app from the 28 | [*Vulkan-Tools* repository](https://github.com/KhronosGroup/Vulkan-Tools) 29 | is included in this **MoltenVK** package. 30 | 31 | This demo renders a basic textured cube that spins in place. 32 | 33 | The demo can be found in the `Cube` folder, and in the `Cube` group in the 34 | *Xcode Project Navigator* in the `Demos.xcworkspace` *Xcode* workspace. 35 | 36 | To run this demo, run the `Cube-macOS`, `Cube-iOS`, or `Cube-tvOS` *Scheme* from within *Xcode*. 37 | In addition to devices, this demo will also run on an `iOS Simulator` destination. 38 | This demo is not supported on a `tvOS Simulator` destination. 39 | 40 | The `Cube` demo is a simple example of installing **MoltenVK** as a `libMoltenVK.dylib` library that 41 | is dynamically linked to the application, and the _Vulkan_ calls all use _Volk_ to dynamically access 42 | function pointers, retrieved from **MoltenVK** using `vkGetInstanceProcAddr()` and `vkGetDeviceProcAddr()`. 43 | It supports all platforms, including _Mac Catalyst_, _iOSSimulator_ and _tvOS Simulator_. 44 | 45 | 46 | <a name="khronos-vulkan-samples"></a> 47 | *Khronos Vulkan Samples* 48 | ---------------------- 49 | 50 | *Khronos Group* provides a [repository](https://github.com/KhronosGroup/Vulkan-Samples) 51 | containing a full suite of standard *Vulkan* samples that run on **MoltenVK** on *macOS*. 52 | -------------------------------------------------------------------------------- /Docs/images/MoltenVK-Logo-Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Docs/images/MoltenVK-Logo-Banner.png -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies (Debug).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 18 | BuildableName = "ExternalDependencies" 19 | BlueprintName = "ExternalDependencies" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Debug" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 52 | BuildableName = "ExternalDependencies" 53 | BlueprintName = "ExternalDependencies" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 68 | BuildableName = "ExternalDependencies" 69 | BlueprintName = "ExternalDependencies" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A7EA21CEC8030013AB25" 18 | BuildableName = "ExternalDependencies-iOS" 19 | BlueprintName = "ExternalDependencies-iOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A7EA21CEC8030013AB25" 52 | BuildableName = "ExternalDependencies-iOS" 53 | BlueprintName = "ExternalDependencies-iOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A7EA21CEC8030013AB25" 68 | BuildableName = "ExternalDependencies-iOS" 69 | BlueprintName = "ExternalDependencies-iOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A7E421CEC72F0013AB25" 18 | BuildableName = "ExternalDependencies-macOS" 19 | BlueprintName = "ExternalDependencies-macOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A7E421CEC72F0013AB25" 52 | BuildableName = "ExternalDependencies-macOS" 53 | BlueprintName = "ExternalDependencies-macOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A7E421CEC72F0013AB25" 68 | BuildableName = "ExternalDependencies-macOS" 69 | BlueprintName = "ExternalDependencies-macOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.3"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "2FEA0ADD2490320500EEF3AD" 18 | BuildableName = "ExternalDependencies-tvOS" 19 | BlueprintName = "ExternalDependencies-tvOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Debug" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "YES" 41 | debugServiceExtension = "internal" 42 | allowLocationSimulation = "YES"> 43 | </LaunchAction> 44 | <ProfileAction 45 | buildConfiguration = "Release" 46 | shouldUseLaunchSchemeArgsEnv = "YES" 47 | savedToolIdentifier = "" 48 | useCustomWorkingDirectory = "NO" 49 | debugDocumentVersioning = "YES"> 50 | <MacroExpansion> 51 | <BuildableReference 52 | BuildableIdentifier = "primary" 53 | BlueprintIdentifier = "2FEA0ADD2490320500EEF3AD" 54 | BuildableName = "ExternalDependencies-tvOS" 55 | BlueprintName = "ExternalDependencies-tvOS" 56 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 57 | </BuildableReference> 58 | </MacroExpansion> 59 | </ProfileAction> 60 | <AnalyzeAction 61 | buildConfiguration = "Debug"> 62 | </AnalyzeAction> 63 | <ArchiveAction 64 | buildConfiguration = "Release" 65 | revealArchiveInOrganizer = "YES"> 66 | </ArchiveAction> 67 | </Scheme> 68 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-xrOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.7"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "DCFD7EC12A45BAAA007BBBF7" 18 | BuildableName = "ExternalDependencies-xrOS" 19 | BlueprintName = "ExternalDependencies-xrOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES" 30 | shouldAutocreateTestPlan = "YES"> 31 | </TestAction> 32 | <LaunchAction 33 | buildConfiguration = "Release" 34 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 35 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 36 | launchStyle = "0" 37 | useCustomWorkingDirectory = "NO" 38 | ignoresPersistentStateOnLaunch = "NO" 39 | debugDocumentVersioning = "YES" 40 | debugServiceExtension = "internal" 41 | allowLocationSimulation = "YES"> 42 | </LaunchAction> 43 | <ProfileAction 44 | buildConfiguration = "Release" 45 | shouldUseLaunchSchemeArgsEnv = "YES" 46 | savedToolIdentifier = "" 47 | useCustomWorkingDirectory = "NO" 48 | debugDocumentVersioning = "YES"> 49 | <MacroExpansion> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "DCFD7EC12A45BAAA007BBBF7" 53 | BuildableName = "ExternalDependencies-xrOS" 54 | BlueprintName = "ExternalDependencies-xrOS" 55 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 56 | </BuildableReference> 57 | </MacroExpansion> 58 | </ProfileAction> 59 | <AnalyzeAction 60 | buildConfiguration = "Debug"> 61 | </AnalyzeAction> 62 | <ArchiveAction 63 | buildConfiguration = "Release" 64 | revealArchiveInOrganizer = "YES"> 65 | </ArchiveAction> 66 | </Scheme> 67 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 18 | BuildableName = "ExternalDependencies" 19 | BlueprintName = "ExternalDependencies" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 52 | BuildableName = "ExternalDependencies" 53 | BlueprintName = "ExternalDependencies" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A7F221CEC81B0013AB25" 68 | BuildableName = "ExternalDependencies" 69 | BlueprintName = "ExternalDependencies" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Cross-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A90FD75B21CC4EAB00B92BB2" 18 | BuildableName = "libSPIRVCross.a" 19 | BlueprintName = "SPIRV-Cross-iOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "YES" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A90FD75B21CC4EAB00B92BB2" 52 | BuildableName = "libSPIRVCross.a" 53 | BlueprintName = "SPIRV-Cross-iOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A90FD75B21CC4EAB00B92BB2" 68 | BuildableName = "libSPIRVCross.a" 69 | BlueprintName = "SPIRV-Cross-iOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Cross-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A90FD8A021CC4EB900B92BB2" 18 | BuildableName = "libSPIRVCross.a" 19 | BlueprintName = "SPIRV-Cross-macOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A90FD8A021CC4EB900B92BB2" 52 | BuildableName = "libSPIRVCross.a" 53 | BlueprintName = "SPIRV-Cross-macOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A90FD8A021CC4EB900B92BB2" 68 | BuildableName = "libSPIRVCross.a" 69 | BlueprintName = "SPIRV-Cross-macOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Cross-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.3"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "2FEA0CD92490322B00EEF3AD" 18 | BuildableName = "libSPIRVCross.a" 19 | BlueprintName = "SPIRV-Cross-tvOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Debug" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "YES" 41 | debugServiceExtension = "internal" 42 | allowLocationSimulation = "YES"> 43 | </LaunchAction> 44 | <ProfileAction 45 | buildConfiguration = "Release" 46 | shouldUseLaunchSchemeArgsEnv = "YES" 47 | savedToolIdentifier = "" 48 | useCustomWorkingDirectory = "NO" 49 | debugDocumentVersioning = "YES"> 50 | <MacroExpansion> 51 | <BuildableReference 52 | BuildableIdentifier = "primary" 53 | BlueprintIdentifier = "2FEA0CD92490322B00EEF3AD" 54 | BuildableName = "libSPIRVCross.a" 55 | BlueprintName = "SPIRV-Cross-tvOS" 56 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 57 | </BuildableReference> 58 | </MacroExpansion> 59 | </ProfileAction> 60 | <AnalyzeAction 61 | buildConfiguration = "Debug"> 62 | </AnalyzeAction> 63 | <ArchiveAction 64 | buildConfiguration = "Release" 65 | revealArchiveInOrganizer = "YES"> 66 | </ArchiveAction> 67 | </Scheme> 68 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Cross-xrOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.7"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "DCFD7C892A45BA7D007BBBF7" 18 | BuildableName = "libSPIRVCross.a" 19 | BlueprintName = "SPIRV-Cross-xrOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES" 30 | shouldAutocreateTestPlan = "YES"> 31 | </TestAction> 32 | <LaunchAction 33 | buildConfiguration = "Debug" 34 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 35 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 36 | launchStyle = "0" 37 | useCustomWorkingDirectory = "NO" 38 | ignoresPersistentStateOnLaunch = "NO" 39 | debugDocumentVersioning = "YES" 40 | debugServiceExtension = "internal" 41 | allowLocationSimulation = "YES"> 42 | </LaunchAction> 43 | <ProfileAction 44 | buildConfiguration = "Release" 45 | shouldUseLaunchSchemeArgsEnv = "YES" 46 | savedToolIdentifier = "" 47 | useCustomWorkingDirectory = "NO" 48 | debugDocumentVersioning = "YES"> 49 | <MacroExpansion> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "DCFD7C892A45BA7D007BBBF7" 53 | BuildableName = "libSPIRVCross.a" 54 | BlueprintName = "SPIRV-Cross-xrOS" 55 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 56 | </BuildableReference> 57 | </MacroExpansion> 58 | </ProfileAction> 59 | <AnalyzeAction 60 | buildConfiguration = "Debug"> 61 | </AnalyzeAction> 62 | <ArchiveAction 63 | buildConfiguration = "Release" 64 | revealArchiveInOrganizer = "YES"> 65 | </ArchiveAction> 66 | </Scheme> 67 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Tools-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A7FC21CECBBF0013AB25" 18 | BuildableName = "libSPIRVTools.a" 19 | BlueprintName = "SPIRV-Tools-iOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "YES" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A7FC21CECBBF0013AB25" 52 | BuildableName = "libSPIRVTools.a" 53 | BlueprintName = "SPIRV-Tools-iOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A7FC21CECBBF0013AB25" 68 | BuildableName = "libSPIRVTools.a" 69 | BlueprintName = "SPIRV-Tools-iOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Tools-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A972A81021CECBE90013AB25" 18 | BuildableName = "libSPIRVTools.a" 19 | BlueprintName = "SPIRV-Tools-macOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A972A81021CECBE90013AB25" 52 | BuildableName = "libSPIRVTools.a" 53 | BlueprintName = "SPIRV-Tools-macOS" 54 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A972A81021CECBE90013AB25" 68 | BuildableName = "libSPIRVTools.a" 69 | BlueprintName = "SPIRV-Tools-macOS" 70 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Tools-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.3"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "2FEA0B4B2490322100EEF3AD" 18 | BuildableName = "libSPIRVTools.a" 19 | BlueprintName = "SPIRV-Tools-tvOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Debug" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | launchStyle = "0" 38 | useCustomWorkingDirectory = "NO" 39 | ignoresPersistentStateOnLaunch = "NO" 40 | debugDocumentVersioning = "YES" 41 | debugServiceExtension = "internal" 42 | allowLocationSimulation = "YES"> 43 | </LaunchAction> 44 | <ProfileAction 45 | buildConfiguration = "Release" 46 | shouldUseLaunchSchemeArgsEnv = "YES" 47 | savedToolIdentifier = "" 48 | useCustomWorkingDirectory = "NO" 49 | debugDocumentVersioning = "YES"> 50 | <MacroExpansion> 51 | <BuildableReference 52 | BuildableIdentifier = "primary" 53 | BlueprintIdentifier = "2FEA0B4B2490322100EEF3AD" 54 | BuildableName = "libSPIRVTools.a" 55 | BlueprintName = "SPIRV-Tools-tvOS" 56 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 57 | </BuildableReference> 58 | </MacroExpansion> 59 | </ProfileAction> 60 | <AnalyzeAction 61 | buildConfiguration = "Debug"> 62 | </AnalyzeAction> 63 | <ArchiveAction 64 | buildConfiguration = "Release" 65 | revealArchiveInOrganizer = "YES"> 66 | </ArchiveAction> 67 | </Scheme> 68 | -------------------------------------------------------------------------------- /ExternalDependencies.xcodeproj/xcshareddata/xcschemes/SPIRV-Tools-xrOS.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "1.7"> 5 | <BuildAction 6 | parallelizeBuildables = "YES" 7 | buildImplicitDependencies = "YES"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "DCFD7D0C2A45BA9C007BBBF7" 18 | BuildableName = "libSPIRVTools.a" 19 | BlueprintName = "SPIRV-Tools-xrOS" 20 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES" 30 | shouldAutocreateTestPlan = "YES"> 31 | </TestAction> 32 | <LaunchAction 33 | buildConfiguration = "Debug" 34 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 35 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 36 | launchStyle = "0" 37 | useCustomWorkingDirectory = "NO" 38 | ignoresPersistentStateOnLaunch = "NO" 39 | debugDocumentVersioning = "YES" 40 | debugServiceExtension = "internal" 41 | allowLocationSimulation = "YES"> 42 | </LaunchAction> 43 | <ProfileAction 44 | buildConfiguration = "Release" 45 | shouldUseLaunchSchemeArgsEnv = "YES" 46 | savedToolIdentifier = "" 47 | useCustomWorkingDirectory = "NO" 48 | debugDocumentVersioning = "YES"> 49 | <MacroExpansion> 50 | <BuildableReference 51 | BuildableIdentifier = "primary" 52 | BlueprintIdentifier = "DCFD7D0C2A45BA9C007BBBF7" 53 | BuildableName = "libSPIRVTools.a" 54 | BlueprintName = "SPIRV-Tools-xrOS" 55 | ReferencedContainer = "container:ExternalDependencies.xcodeproj"> 56 | </BuildableReference> 57 | </MacroExpansion> 58 | </ProfileAction> 59 | <AnalyzeAction 60 | buildConfiguration = "Debug"> 61 | </AnalyzeAction> 62 | <ArchiveAction 63 | buildConfiguration = "Release" 64 | revealArchiveInOrganizer = "YES"> 65 | </ArchiveAction> 66 | </Scheme> 67 | -------------------------------------------------------------------------------- /ExternalRevisions/SPIRV-Cross_repo_revision: -------------------------------------------------------------------------------- 1 | 2345c781f7fc56e32a84730dd249144655e550cd 2 | -------------------------------------------------------------------------------- /ExternalRevisions/SPIRV-Headers_repo_revision: -------------------------------------------------------------------------------- 1 | bab63ff679c41eb75fc67dac76e1dc44426101e1 2 | -------------------------------------------------------------------------------- /ExternalRevisions/SPIRV-Tools_repo_revision: -------------------------------------------------------------------------------- 1 | 783d7033613cedaa7147d0700b517abc5c32312d 2 | -------------------------------------------------------------------------------- /ExternalRevisions/Volk_repo_revision: -------------------------------------------------------------------------------- 1 | 43c29e655cb8117fd9cfb65ad9cefe2d40965102 2 | -------------------------------------------------------------------------------- /ExternalRevisions/Vulkan-Headers_repo_revision: -------------------------------------------------------------------------------- 1 | 9c77de5c3dd216f28e407eec65ed9c0a296c1f74 2 | -------------------------------------------------------------------------------- /ExternalRevisions/Vulkan-Tools_repo_revision: -------------------------------------------------------------------------------- 1 | 682e42f7ae70a8fadf374199c02de737daa5c70d 2 | -------------------------------------------------------------------------------- /ExternalRevisions/cereal_repo_revision: -------------------------------------------------------------------------------- 1 | 51cbda5f30e56c801c07fe3d3aba5d7fb9e6cca4 2 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/API/mvk_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mvk_config.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | 21 | #ifndef __mvk_config_h_ 22 | #define __mvk_config_h_ 1 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif // __cplusplus 27 | 28 | 29 | #include <MoltenVK/mvk_private_api.h> 30 | 31 | 32 | /** 33 | * This header is obsolete and deprecated, and is provided for legacy compatibility only. 34 | * 35 | * To configure MoltenVK, use one of the following mechanisms, 36 | * as documented in MoltenVK_Configuration_Parameters.md: 37 | * 38 | * - The standard Vulkan VK_EXT_layer_settings extension (layer name "MoltenVK"). 39 | * - Application runtime environment variables. 40 | * - Build settings at MoltenVK build time. 41 | * 42 | * For the private MoltenVK functions, include the mvk_private_api.h header. 43 | */ 44 | 45 | #define MVK_CONFIGURATION_API_VERSION 39 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif // __cplusplus 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/API/mvk_vulkan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mvk_vulkan.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | /** 21 | * This is a convenience header file that loads vulkan.h with the appropriate Vulkan platform extensions. 22 | * 23 | * This header automatically enables the VK_EXT_metal_surface Vulkan extension. 24 | * 25 | * When building for iOS, this header also automatically enables the obsolete VK_MVK_ios_surface Vulkan extension. 26 | * When building for macOS, this header also automatically enables the obsolete VK_MVK_macos_surface Vulkan extension. 27 | * Both of these extensions are deprecated. Use the portable VK_EXT_metal_surface extension instead. 28 | */ 29 | 30 | #ifndef __mvk_vulkan_h_ 31 | #define __mvk_vulkan_h_ 1 32 | 33 | 34 | #include <Availability.h> 35 | 36 | #define VK_USE_PLATFORM_METAL_EXT 1 37 | 38 | #define VK_ENABLE_BETA_EXTENSIONS 1 // VK_KHR_portability_subset 39 | 40 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 41 | # define VK_USE_PLATFORM_IOS_MVK 1 42 | #endif 43 | 44 | #ifdef __MAC_OS_X_VERSION_MAX_ALLOWED 45 | # define VK_USE_PLATFORM_MACOS_MVK 1 46 | #endif 47 | 48 | #include <vulkan/vulkan.h> 49 | 50 | /** The name of the MoltenVK driver layer. */ 51 | static const char* kMVKMoltenVKDriverLayerName = "MoltenVK"; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_mvk_moltenvk.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * This header contains obsolete and deprecated MoltenVK functions, that were originally 21 | * part of the obsolete and deprecated non-standard VK_MVK_moltenvk extension. 22 | * This header is provided for legacy compatibility only. 23 | 24 | * Instead, in your application, use the following header file: 25 | * 26 | * #include <MoltenVK/mvk_vulkan.h> 27 | * 28 | * To configure MoltenVK, use one of the following mechanisms, 29 | * as documented in MoltenVK_Configuration_Parameters.md: 30 | * 31 | * - The standard Vulkan VK_EXT_layer_settings extension (layer name "MoltenVK"). 32 | * - Application runtime environment variables. 33 | * - Build settings at MoltenVK build time. 34 | * 35 | * If you require access to private structures and functions to query MoltenVK about MoltenVK 36 | * version, configuration, or runtime performance information, use the following header file: 37 | * 38 | * #include <MoltenVK/mvk_private_api.h> 39 | * 40 | * If you require access to Metal objects underlying equivalent Vulkan objects, 41 | * use the standard Vulkan VK_EXT_metal_objects extension. 42 | */ 43 | 44 | #include <MoltenVK/mvk_vulkan.h> 45 | #include <MoltenVK/mvk_private_api.h> 46 | #include <MoltenVK/mvk_deprecated_api.h> 47 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCmdDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCmdDebug.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKCommand.h" 22 | 23 | #import <Metal/Metal.h> 24 | 25 | 26 | #pragma mark - 27 | #pragma mark MVKCmdDebugMarker 28 | 29 | /**Abstract Vulkan class to support debug markers. */ 30 | class MVKCmdDebugMarker : public MVKCommand { 31 | 32 | public: 33 | VkResult setContent(MVKCommandBuffer* cmdBuff, const char* pMarkerName, const float color[4]); 34 | 35 | ~MVKCmdDebugMarker() override; 36 | 37 | protected: 38 | NSString* _markerName = nil; 39 | }; 40 | 41 | 42 | #pragma mark - 43 | #pragma mark MVKCmdDebugMarkerBegin 44 | 45 | class MVKCmdDebugMarkerBegin : public MVKCmdDebugMarker { 46 | 47 | public: 48 | void encode(MVKCommandEncoder* cmdEncoder) override; 49 | 50 | protected: 51 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 52 | 53 | }; 54 | 55 | 56 | #pragma mark - 57 | #pragma mark MVKCmdDebugMarkerEnd 58 | 59 | class MVKCmdDebugMarkerEnd : public MVKCommand { 60 | 61 | public: 62 | VkResult setContent(MVKCommandBuffer* cmdBuff); 63 | 64 | void encode(MVKCommandEncoder* cmdEncoder) override; 65 | 66 | protected: 67 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 68 | 69 | }; 70 | 71 | 72 | #pragma mark - 73 | #pragma mark MVKCmdDebugMarkerInsert 74 | 75 | class MVKCmdDebugMarkerInsert : public MVKCmdDebugMarker { 76 | 77 | public: 78 | void encode(MVKCommandEncoder* cmdEncoder) override; 79 | 80 | protected: 81 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 82 | 83 | }; 84 | 85 | 86 | #pragma mark - 87 | #pragma mark Support functions 88 | 89 | void mvkPushDebugGroup(id<MTLCommandBuffer> mtlCmdBuffer, NSString* name); 90 | 91 | void mvkPopDebugGroup(id<MTLCommandBuffer> mtlCmdBuffer); 92 | 93 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCmdDebug.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCmdDebug.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKCmdDebug.h" 20 | #include "MVKCommandBuffer.h" 21 | #include "MVKCommandPool.h" 22 | 23 | #pragma mark - 24 | #pragma mark MVKCmdDebugMarker 25 | 26 | VkResult MVKCmdDebugMarker::setContent(MVKCommandBuffer* cmdBuff, 27 | const char* pMarkerName, 28 | const float color[4]) { 29 | [_markerName release]; 30 | _markerName = [[NSString alloc] initWithUTF8String: pMarkerName]; // retained 31 | 32 | return VK_SUCCESS; 33 | } 34 | 35 | MVKCmdDebugMarker::~MVKCmdDebugMarker() { 36 | [_markerName release]; 37 | } 38 | 39 | #pragma mark - 40 | #pragma mark MVKCmdDebugMarkerBegin 41 | 42 | // Vulkan debug groups are more general than Metal's. 43 | // If a renderpass is active, push on the render command encoder, otherwise push on the command buffer. 44 | void MVKCmdDebugMarkerBegin::encode(MVKCommandEncoder* cmdEncoder) { 45 | id<MTLRenderCommandEncoder> mtlCmdEnc = cmdEncoder->_mtlRenderEncoder; 46 | if (mtlCmdEnc) { 47 | [mtlCmdEnc pushDebugGroup: _markerName]; 48 | } else { 49 | mvkPushDebugGroup(cmdEncoder->_mtlCmdBuffer, _markerName); 50 | } 51 | } 52 | 53 | 54 | #pragma mark - 55 | #pragma mark MVKCmdDebugMarkerEnd 56 | 57 | VkResult MVKCmdDebugMarkerEnd::setContent(MVKCommandBuffer* cmdBuff) { return VK_SUCCESS; } 58 | 59 | // Vulkan debug groups are more general than Metal's. 60 | // If a renderpass is active, pop from the render command encoder, otherwise pop from the command buffer. 61 | void MVKCmdDebugMarkerEnd::encode(MVKCommandEncoder* cmdEncoder) { 62 | id<MTLRenderCommandEncoder> mtlCmdEnc = cmdEncoder->_mtlRenderEncoder; 63 | if (mtlCmdEnc) { 64 | [mtlCmdEnc popDebugGroup]; 65 | } else { 66 | mvkPopDebugGroup(cmdEncoder->_mtlCmdBuffer); 67 | } 68 | } 69 | 70 | 71 | #pragma mark - 72 | #pragma mark MVKCmdDebugMarkerInsert 73 | 74 | void MVKCmdDebugMarkerInsert::encode(MVKCommandEncoder* cmdEncoder) { 75 | [cmdEncoder->getMTLEncoder() insertDebugSignpost: _markerName]; 76 | } 77 | 78 | 79 | #pragma mark - 80 | #pragma mark Support functions 81 | 82 | void mvkPushDebugGroup(id<MTLCommandBuffer> mtlCmdBuffer, NSString* name) { 83 | if ([mtlCmdBuffer respondsToSelector: @selector(pushDebugGroup:)]) { 84 | [mtlCmdBuffer pushDebugGroup: name]; 85 | } 86 | } 87 | 88 | void mvkPopDebugGroup(id<MTLCommandBuffer> mtlCmdBuffer) { 89 | if ([mtlCmdBuffer respondsToSelector: @selector(popDebugGroup)]) { 90 | [mtlCmdBuffer popDebugGroup]; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCmdDispatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCmdDispatch.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKCommand.h" 22 | 23 | #import <Metal/Metal.h> 24 | 25 | 26 | #pragma mark - 27 | #pragma mark MVKCmdDispatch 28 | 29 | class MVKCmdDispatch : public MVKCommand { 30 | 31 | public: 32 | VkResult setContent(MVKCommandBuffer* cmdBuff, 33 | uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, 34 | uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); 35 | 36 | void encode(MVKCommandEncoder* cmdEncoder) override; 37 | 38 | protected: 39 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 40 | 41 | uint32_t _baseGroupX; 42 | uint32_t _baseGroupY; 43 | uint32_t _baseGroupZ; 44 | uint32_t _groupCountX; 45 | uint32_t _groupCountY; 46 | uint32_t _groupCountZ; 47 | }; 48 | 49 | 50 | #pragma mark - 51 | #pragma mark MVKCmdDispatchIndirect 52 | 53 | class MVKCmdDispatchIndirect : public MVKCommand { 54 | 55 | public: 56 | VkResult setContent(MVKCommandBuffer* cmdBuff, VkBuffer buffer, VkDeviceSize offset); 57 | 58 | void encode(MVKCommandEncoder* cmdEncoder) override; 59 | 60 | protected: 61 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 62 | 63 | id<MTLBuffer> _mtlIndirectBuffer; 64 | VkDeviceSize _mtlIndirectBufferOffset; 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCmdDispatch.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCmdDispatch.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKCmdDispatch.h" 20 | #include "MVKCommandBuffer.h" 21 | #include "MVKCommandPool.h" 22 | #include "MVKBuffer.h" 23 | #include "MVKPipeline.h" 24 | #include "MVKFoundation.h" 25 | #include "mvk_datatypes.hpp" 26 | 27 | 28 | #pragma mark - 29 | #pragma mark MVKCmdDispatch 30 | 31 | VkResult MVKCmdDispatch::setContent(MVKCommandBuffer* cmdBuff, 32 | uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, 33 | uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { 34 | _baseGroupX = baseGroupX; 35 | _baseGroupY = baseGroupY; 36 | _baseGroupZ = baseGroupZ; 37 | 38 | _groupCountX = groupCountX; 39 | _groupCountY = groupCountY; 40 | _groupCountZ = groupCountZ; 41 | 42 | return VK_SUCCESS; 43 | } 44 | 45 | void MVKCmdDispatch::encode(MVKCommandEncoder* cmdEncoder) { 46 | MTLRegion mtlThreadgroupCount = MTLRegionMake3D(_baseGroupX, _baseGroupY, _baseGroupZ, _groupCountX, _groupCountY, _groupCountZ); 47 | cmdEncoder->finalizeDispatchState(); // Ensure all updated state has been submitted to Metal 48 | id<MTLComputeCommandEncoder> mtlEncoder = cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch); 49 | auto* pipeline = cmdEncoder->getComputePipeline(); 50 | if (pipeline->allowsDispatchBase()) { 51 | if ([mtlEncoder respondsToSelector: @selector(setStageInRegion:)]) { 52 | // We'll use the stage-input region to pass the base along to the shader. 53 | // Hopefully Metal won't complain that we didn't set up a stage-input descriptor. 54 | [mtlEncoder setStageInRegion: mtlThreadgroupCount]; 55 | } else { 56 | // We have to pass the base group in a buffer. 57 | uint32_t base[3] = {(uint32_t)mtlThreadgroupCount.origin.x, (uint32_t)mtlThreadgroupCount.origin.y, (uint32_t)mtlThreadgroupCount.origin.z}; 58 | cmdEncoder->setComputeBytes(mtlEncoder, base, sizeof(base), pipeline->getIndirectParamsIndex().stages[kMVKShaderStageCompute]); 59 | } 60 | } 61 | [mtlEncoder dispatchThreadgroups: mtlThreadgroupCount.size 62 | threadsPerThreadgroup: cmdEncoder->_mtlThreadgroupSize]; 63 | } 64 | 65 | 66 | #pragma mark - 67 | #pragma mark MVKCmdDispatchIndirect 68 | 69 | VkResult MVKCmdDispatchIndirect::setContent(MVKCommandBuffer* cmdBuff, VkBuffer buffer, VkDeviceSize offset) { 70 | MVKBuffer* mvkBuffer = (MVKBuffer*)buffer; 71 | _mtlIndirectBuffer = mvkBuffer->getMTLBuffer(); 72 | _mtlIndirectBufferOffset = mvkBuffer->getMTLBufferOffset() + offset; 73 | 74 | return VK_SUCCESS; 75 | } 76 | 77 | void MVKCmdDispatchIndirect::encode(MVKCommandEncoder* cmdEncoder) { 78 | cmdEncoder->finalizeDispatchState(); // Ensure all updated state has been submitted to Metal 79 | [cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) dispatchThreadgroupsWithIndirectBuffer: _mtlIndirectBuffer 80 | indirectBufferOffset: _mtlIndirectBufferOffset 81 | threadsPerThreadgroup: cmdEncoder->_mtlThreadgroupSize]; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCmdQueries.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCmdQueries.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKCommand.h" 22 | #include "MVKBuffer.h" 23 | 24 | class MVKQueryPool; 25 | 26 | 27 | #pragma mark - 28 | #pragma mark MVKCmdQuery 29 | 30 | /** Abstract Vulkan command to manage queries. */ 31 | class MVKCmdQuery : public MVKCommand { 32 | 33 | public: 34 | VkResult setContent(MVKCommandBuffer* cmdBuff, 35 | VkQueryPool queryPool, 36 | uint32_t query); 37 | 38 | protected: 39 | MVKQueryPool* _queryPool; 40 | uint32_t _query; 41 | }; 42 | 43 | 44 | #pragma mark - 45 | #pragma mark MVKCmdBeginQuery 46 | 47 | class MVKCmdBeginQuery : public MVKCmdQuery { 48 | 49 | public: 50 | VkResult setContent(MVKCommandBuffer* cmdBuff, 51 | VkQueryPool queryPool, 52 | uint32_t query, 53 | VkQueryControlFlags flags); 54 | 55 | void encode(MVKCommandEncoder* cmdEncoder) override; 56 | 57 | protected: 58 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 59 | 60 | VkQueryControlFlags _flags; 61 | }; 62 | 63 | 64 | #pragma mark - 65 | #pragma mark MVKCmdEndQuery 66 | 67 | class MVKCmdEndQuery : public MVKCmdQuery { 68 | 69 | public: 70 | void encode(MVKCommandEncoder* cmdEncoder) override; 71 | 72 | protected: 73 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 74 | 75 | }; 76 | 77 | 78 | #pragma mark - 79 | #pragma mark MVKCmdWriteTimestamp 80 | 81 | class MVKCmdWriteTimestamp : public MVKCmdQuery { 82 | 83 | public: 84 | VkResult setContent(MVKCommandBuffer* cmdBuff, 85 | VkPipelineStageFlags2 stage, 86 | VkQueryPool queryPool, 87 | uint32_t query); 88 | 89 | void encode(MVKCommandEncoder* cmdEncoder) override; 90 | 91 | protected: 92 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 93 | 94 | VkPipelineStageFlags2 _stage; 95 | }; 96 | 97 | 98 | #pragma mark - 99 | #pragma mark MVKCmdResetQueryPool 100 | 101 | class MVKCmdResetQueryPool : public MVKCmdQuery { 102 | 103 | public: 104 | VkResult setContent(MVKCommandBuffer* cmdBuff, 105 | VkQueryPool queryPool, 106 | uint32_t firstQuery, 107 | uint32_t queryCount); 108 | 109 | void encode(MVKCommandEncoder* cmdEncoder) override; 110 | 111 | protected: 112 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 113 | 114 | uint32_t _queryCount; 115 | }; 116 | 117 | 118 | #pragma mark - 119 | #pragma mark MVKCmdCopyQueryPoolResults 120 | 121 | class MVKCmdCopyQueryPoolResults : public MVKCmdQuery { 122 | 123 | public: 124 | VkResult setContent(MVKCommandBuffer* cmdBuff, 125 | VkQueryPool queryPool, 126 | uint32_t firstQuery, 127 | uint32_t queryCount, 128 | VkBuffer destBuffer, 129 | VkDeviceSize destOffset, 130 | VkDeviceSize destStride, 131 | VkQueryResultFlags flags); 132 | 133 | void encode(MVKCommandEncoder* cmdEncoder) override; 134 | 135 | protected: 136 | MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; 137 | 138 | MVKBuffer* _destBuffer; 139 | VkDeviceSize _destOffset; 140 | VkDeviceSize _destStride; 141 | VkQueryResultFlags _flags; 142 | uint32_t _queryCount; 143 | }; 144 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Commands/MVKCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKCommand.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | 22 | #include "MVKObjectPool.h" 23 | 24 | class MVKCommandBuffer; 25 | class MVKCommandEncoder; 26 | class MVKCommandPool; 27 | 28 | 29 | #pragma mark - 30 | #pragma mark MVKCommandTypePool 31 | 32 | /** A pool of MVKCommand instances of a particular type. */ 33 | template <class T> 34 | class MVKCommandTypePool : public MVKObjectPool<T> { 35 | 36 | public: 37 | 38 | /** Returns the Vulkan API opaque object controlling this object. */ 39 | MVKVulkanAPIObject* getVulkanAPIObject() override { return nullptr; } 40 | 41 | MVKCommandTypePool(bool isPooling = true) : MVKObjectPool<T>(isPooling) {} 42 | 43 | protected: 44 | T* newObject() override { return new T(); } 45 | 46 | }; 47 | 48 | 49 | #pragma mark - 50 | #pragma mark MVKCommand 51 | 52 | /** 53 | * Abstract class that represents a Vulkan command. 54 | * 55 | * To allow command contents to be populated in a standard way, all concrete 56 | * subclasses must support a public member function of the following form: 57 | * 58 | * VkResult setContent(MVKCommandBuffer* cmdBuff, ...); 59 | */ 60 | class MVKCommand : public MVKBaseObject, public MVKLinkableMixin<MVKCommand> { 61 | 62 | public: 63 | 64 | /** Returns the Vulkan API opaque object controlling this object. */ 65 | MVKVulkanAPIObject* getVulkanAPIObject() override { return nullptr; } 66 | 67 | /** Encodes this command on the specified command encoder. */ 68 | virtual void encode(MVKCommandEncoder* cmdEncoder) = 0; 69 | 70 | protected: 71 | friend MVKCommandBuffer; 72 | 73 | // Returns the command type pool used by this command, from the command pool. 74 | // This function is overridden in each concrete subclass declaration, but the implementation of 75 | // this function in each subclass is automatically generated in the MVKCommandPool implementation. 76 | virtual MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) = 0; 77 | }; 78 | 79 | 80 | #pragma mark - 81 | #pragma mark MVKSingleValueCommand 82 | 83 | /** Abstract class of a simple Vulkan command that simply holds a single value to encode. */ 84 | template <typename Tv> 85 | class MVKSingleValueCommand : public MVKCommand { 86 | 87 | public: 88 | VkResult setContent(MVKCommandBuffer* cmdBuff, Tv value) { 89 | _value = value; 90 | return VK_SUCCESS; 91 | } 92 | 93 | protected: 94 | Tv _value; 95 | }; 96 | 97 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/GPUObjects/MVKFramebuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKFramebuffer.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKDevice.h" 22 | #include "MVKImage.h" 23 | #include "MVKSmallVector.h" 24 | #include <mutex> 25 | 26 | class MVKRenderSubpass; 27 | 28 | 29 | #pragma mark MVKFramebuffer 30 | 31 | /** Represents a Vulkan framebuffer. */ 32 | class MVKFramebuffer : public MVKVulkanAPIDeviceObject { 33 | 34 | public: 35 | 36 | /** Returns the Vulkan type of this object. */ 37 | VkObjectType getVkObjectType() override { return VK_OBJECT_TYPE_FRAMEBUFFER; } 38 | 39 | /** Returns the debug report object type of this object. */ 40 | VkDebugReportObjectTypeEXT getVkDebugReportObjectType() override { return VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT; } 41 | 42 | /** Returns the dimensions of this framebuffer. */ 43 | VkExtent2D getExtent2D() { return _extent; } 44 | 45 | /** Returns the layers covered by this framebuffer. */ 46 | uint32_t getLayerCount() { return _layerCount; } 47 | 48 | /** Returns the attachments. */ 49 | MVKArrayRef<MVKImageView*> getAttachments() { return _attachments.contents(); } 50 | 51 | /** 52 | * Returns a MTLTexture for use as a dummy texture when a render subpass, 53 | * that is compatible with the specified subpass, has no attachments. 54 | */ 55 | id<MTLTexture> getDummyAttachmentMTLTexture(MVKRenderSubpass* subpass, uint32_t passIdx); 56 | 57 | #pragma mark Construction 58 | 59 | MVKFramebuffer(MVKDevice* device, const VkFramebufferCreateInfo* pCreateInfo); 60 | 61 | MVKFramebuffer(MVKDevice* device, const VkRenderingInfo* pRenderingInfo); 62 | 63 | ~MVKFramebuffer() override; 64 | 65 | protected: 66 | void propagateDebugName() override {} 67 | 68 | MVKSmallVector<MVKImageView*, 4> _attachments; 69 | id<MTLTexture> _mtlDummyTex = nil; 70 | std::mutex _lock; 71 | VkExtent2D _extent; 72 | uint32_t _layerCount; 73 | }; 74 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/GPUObjects/MVKResource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKResource.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKDevice.h" 22 | #include "MVKDeviceMemory.h" 23 | #include "MVKMTLResourceBindings.h" 24 | 25 | class MVKCommandEncoder; 26 | 27 | 28 | #pragma mark - 29 | #pragma mark MVKResource 30 | 31 | /** Represents an abstract Vulkan resource. Specialized subclasses include MVKBuffer and MVKImage. */ 32 | class MVKResource : public MVKVulkanAPIDeviceObject { 33 | 34 | public: 35 | 36 | /** Returns the number of bytes required for the entire resource. */ 37 | VkDeviceSize getByteCount() { return _byteCount; } 38 | 39 | /** Returns the byte offset in the bound device memory. */ 40 | VkDeviceSize getDeviceMemoryOffset() { return _deviceMemoryOffset; } 41 | 42 | /** Binds this resource to the specified offset within the specified memory allocation. */ 43 | virtual VkResult bindDeviceMemory(MVKDeviceMemory* mvkMem, VkDeviceSize memOffset); 44 | 45 | /** Returns the device memory underlying this resource. */ 46 | MVKDeviceMemory* getDeviceMemory() { return _deviceMemory; } 47 | 48 | /** Returns whether the memory is accessible from the host. */ 49 | bool isMemoryHostAccessible() { return _deviceMemory && _deviceMemory->isMemoryHostAccessible(); } 50 | 51 | /** Returns whether the memory is automatically coherent between device and host. */ 52 | bool isMemoryHostCoherent() { return _deviceMemory && _deviceMemory->isMemoryHostCoherent(); } 53 | 54 | /** 55 | * Returns the host memory address of this resource, or NULL if the memory is not mapped to a 56 | * host address yet, or if the memory is marked as device-only and cannot be mapped to a host address. 57 | */ 58 | void* getHostMemoryAddress() { 59 | void* devMemHostAddr = _deviceMemory ? _deviceMemory->getHostMemoryAddress() : nullptr; 60 | return devMemHostAddr ? (void*)((uintptr_t)devMemHostAddr + _deviceMemoryOffset) : nullptr; 61 | } 62 | 63 | /** Applies the specified global memory barrier. */ 64 | virtual void applyMemoryBarrier(MVKPipelineBarrier& barrier, 65 | MVKCommandEncoder* cmdEncoder, 66 | MVKCommandUse cmdUse) = 0; 67 | 68 | 69 | #pragma mark Construction 70 | 71 | MVKResource(MVKDevice* device) : MVKVulkanAPIDeviceObject(device) {} 72 | 73 | protected: 74 | MVKDeviceMemory* _deviceMemory = nullptr; 75 | VkDeviceSize _deviceMemoryOffset = 0; 76 | VkDeviceSize _byteCount = 0; 77 | VkDeviceSize _byteAlignment = 0; 78 | VkExternalMemoryHandleTypeFlags _externalMemoryHandleTypes = 0; 79 | bool _requiresDedicatedMemoryAllocation = false; 80 | }; 81 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/GPUObjects/MVKResource.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKResource.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKResource.h" 20 | #include "MVKCommandBuffer.h" 21 | 22 | 23 | #pragma mark MVKResource 24 | 25 | VkResult MVKResource::bindDeviceMemory(MVKDeviceMemory* mvkMem, VkDeviceSize memOffset) { 26 | // Don't do anything with a non-zero offset into a dedicated allocation. 27 | if (mvkMem && mvkMem->isDedicatedAllocation() && memOffset) { 28 | _deviceMemory = nullptr; 29 | return VK_SUCCESS; 30 | } 31 | _deviceMemory = mvkMem; 32 | _deviceMemoryOffset = memOffset; 33 | return VK_SUCCESS; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/GPUObjects/MVKSurface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKSurface.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKVulkanAPIObject.h" 22 | #include <mutex> 23 | 24 | #import <Metal/Metal.h> 25 | #import <QuartzCore/CAMetalLayer.h> 26 | 27 | class MVKInstance; 28 | class MVKSwapchain; 29 | 30 | @class MVKBlockObserver; 31 | 32 | 33 | #pragma mark MVKSurface 34 | 35 | /** Represents a Vulkan WSI surface. */ 36 | class MVKSurface : public MVKVulkanAPIObject { 37 | 38 | public: 39 | 40 | /** Returns the Vulkan type of this object. */ 41 | VkObjectType getVkObjectType() override { return VK_OBJECT_TYPE_SURFACE_KHR; } 42 | 43 | /** Returns the debug report object type of this object. */ 44 | VkDebugReportObjectTypeEXT getVkDebugReportObjectType() override { return VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT; } 45 | 46 | /** Returns a pointer to the Vulkan instance. */ 47 | MVKInstance* getInstance() override { return _mvkInstance; } 48 | 49 | /** Returns the CAMetalLayer underlying this surface. */ 50 | CAMetalLayer* getCAMetalLayer(); 51 | 52 | /** Returns the extent of this surface. */ 53 | VkExtent2D getExtent(); 54 | 55 | /** Returns the extent for which the underlying CAMetalLayer will not need to be scaled when composited. */ 56 | VkExtent2D getNaturalExtent(); 57 | 58 | /** Returns whether this surface is headless. */ 59 | bool isHeadless() { return !_mtlCAMetalLayer && wasConfigurationSuccessful(); } 60 | 61 | #pragma mark Construction 62 | 63 | MVKSurface(MVKInstance* mvkInstance, 64 | const VkMetalSurfaceCreateInfoEXT* pCreateInfo, 65 | const VkAllocationCallbacks* pAllocator); 66 | 67 | MVKSurface(MVKInstance* mvkInstance, 68 | const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, 69 | const VkAllocationCallbacks* pAllocator); 70 | 71 | MVKSurface(MVKInstance* mvkInstance, 72 | const Vk_PLATFORM_SurfaceCreateInfoMVK* pCreateInfo, 73 | const VkAllocationCallbacks* pAllocator); 74 | 75 | ~MVKSurface() override; 76 | 77 | protected: 78 | friend class MVKSwapchain; 79 | 80 | void propagateDebugName() override {} 81 | void setActiveSwapchain(MVKSwapchain* swapchain); 82 | void initLayer(CAMetalLayer* mtlLayer, const char* vkFuncName, bool isHeadless); 83 | void releaseLayer(); 84 | 85 | std::mutex _layerLock; 86 | MVKInstance* _mvkInstance = nullptr; 87 | CAMetalLayer* _mtlCAMetalLayer = nil; 88 | MVKBlockObserver* _layerObserver = nil; 89 | MVKSwapchain* _activeSwapchain = nullptr; 90 | }; 91 | 92 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/GPUObjects/MVKVulkanAPIObject.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKVulkanAPIObject.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKVulkanAPIObject.h" 20 | 21 | using namespace std; 22 | 23 | 24 | #pragma mark - 25 | #pragma mark MVKVulkanAPIObject 26 | 27 | VkResult MVKVulkanAPIObject::setDebugName(const char* pObjectName) { 28 | if (pObjectName) { 29 | [_debugName release]; 30 | _debugName = [[NSString alloc] initWithUTF8String: pObjectName]; // retained 31 | propagateDebugName(); 32 | } 33 | return VK_SUCCESS; 34 | } 35 | 36 | #pragma clang diagnostic push 37 | #pragma clang diagnostic ignored "-Wobjc-method-access" 38 | void MVKVulkanAPIObject::setMetalObjectLabel(id mtlObj, NSString* label) { 39 | if ( !label ) { return; } 40 | 41 | // If debug mode is enabled, append the object address. 42 | if (getMVKConfig().debugMode) { 43 | [mtlObj setLabel: [label stringByAppendingFormat: @" (%p)", mtlObj]]; 44 | } else { 45 | [mtlObj setLabel: label]; 46 | } 47 | } 48 | #pragma clang diagnostic pop 49 | 50 | MVKVulkanAPIObject* MVKVulkanAPIObject::getMVKVulkanAPIObject(VkDebugReportObjectTypeEXT objType, uint64_t object) { 51 | void* pVkObj = (void*)object; 52 | switch (objType) { 53 | case VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT: 54 | case VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT: 55 | case VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT: 56 | case VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT: 57 | case VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT: 58 | return MVKDispatchableVulkanAPIObject::getDispatchableObject(pVkObj); 59 | default: 60 | return (MVKVulkanAPIObject*)pVkObj; 61 | } 62 | } 63 | 64 | MVKVulkanAPIObject* MVKVulkanAPIObject::getMVKVulkanAPIObject(VkObjectType objType, uint64_t objectHandle) { 65 | void* pVkObj = (void*)objectHandle; 66 | switch (objType) { 67 | case VK_OBJECT_TYPE_INSTANCE: 68 | case VK_OBJECT_TYPE_PHYSICAL_DEVICE: 69 | case VK_OBJECT_TYPE_DEVICE: 70 | case VK_OBJECT_TYPE_QUEUE: 71 | case VK_OBJECT_TYPE_COMMAND_BUFFER: 72 | return MVKDispatchableVulkanAPIObject::getDispatchableObject(pVkObj); 73 | default: 74 | return (MVKVulkanAPIObject*)pVkObj; 75 | } 76 | } 77 | 78 | MVKVulkanAPIObject::MVKVulkanAPIObject(const MVKVulkanAPIObject& other) { 79 | _debugName = [other._debugName retain]; 80 | } 81 | 82 | MVKVulkanAPIObject& MVKVulkanAPIObject::operator=(const MVKVulkanAPIObject& other) { 83 | if (_debugName != other._debugName) { 84 | [_debugName release]; 85 | _debugName = [other._debugName retain]; 86 | } 87 | return *this; 88 | } 89 | 90 | MVKVulkanAPIObject::~MVKVulkanAPIObject() { 91 | [_debugName release]; 92 | } 93 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Layers/MVKLayers.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKLayers.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKLayers.h" 20 | #include "MVKFoundation.h" 21 | #include <mutex> 22 | 23 | using namespace std; 24 | 25 | 26 | #pragma mark MVKLayer 27 | 28 | const char* MVKLayer::getName() { return (const char*)&_layerProperties.layerName; } 29 | 30 | VkLayerProperties* const MVKLayer::getLayerProperties() { return &_layerProperties; } 31 | 32 | VkResult MVKLayer::getInstanceExtensionProperties(uint32_t* pCount, VkExtensionProperties* pProperties) { 33 | return _supportedInstanceExtensions.getProperties(pCount, pProperties); 34 | } 35 | 36 | 37 | #pragma mark Object Creation 38 | 39 | MVKLayer::MVKLayer() : _supportedInstanceExtensions(nullptr, true) { 40 | 41 | // The core driver layer 42 | mvkClear(_layerProperties.layerName, VK_MAX_EXTENSION_NAME_SIZE); 43 | strcpy(_layerProperties.layerName, kMVKMoltenVKDriverLayerName); 44 | mvkClear(_layerProperties.description, VK_MAX_DESCRIPTION_SIZE); 45 | strcpy(_layerProperties.description, "MoltenVK driver layer"); 46 | _layerProperties.specVersion = getMVKConfig().apiVersionToAdvertise; 47 | _layerProperties.implementationVersion = MVK_VERSION; 48 | 49 | ((MVKExtensionList*)&_supportedInstanceExtensions)->disableAllButEnabledInstanceExtensions(); 50 | } 51 | 52 | 53 | #pragma mark MVKLayerManager 54 | 55 | MVKLayer* MVKLayerManager::getDriverLayer() { return &(_layers[0]); } 56 | 57 | MVKLayer* MVKLayerManager::getLayerNamed(const char* pLayerName) { 58 | 59 | // If name is null, return the driver layer 60 | if ( !pLayerName ) { return getDriverLayer(); } 61 | 62 | // Otherwise look for a layer with the specified name 63 | uint32_t layCnt = (uint32_t)_layers.size(); 64 | for (uint32_t layIdx = 0; layIdx < layCnt; layIdx++) { 65 | MVKLayer* pLayer = &_layers[layIdx]; 66 | if (mvkStringsAreEqual(pLayer->getName(), pLayerName)) { return pLayer; } 67 | } 68 | return VK_NULL_HANDLE; 69 | } 70 | 71 | VkResult MVKLayerManager::getLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) { 72 | 73 | // If properties aren't actually being requested yet, simply update the returned count 74 | if ( !pProperties ) { 75 | *pCount = (uint32_t)_layers.size(); 76 | return VK_SUCCESS; 77 | } 78 | 79 | // Otherwise, determine how many layers we'll return, and return that count 80 | uint32_t layerCnt = (uint32_t)_layers.size(); 81 | VkResult result = (*pCount >= layerCnt) ? VK_SUCCESS : VK_INCOMPLETE; 82 | *pCount = min(layerCnt, *pCount); 83 | 84 | // Now populate the layer properties 85 | for (uint32_t layIdx = 0; layIdx < *pCount; layIdx++) { 86 | pProperties[layIdx] = *(&_layers[layIdx])->getLayerProperties(); 87 | } 88 | 89 | return result; 90 | } 91 | 92 | 93 | #pragma mark Object Creation 94 | 95 | // Populate the layers 96 | MVKLayerManager::MVKLayerManager() { 97 | _layers.emplace_back(); 98 | } 99 | 100 | static mutex _lock; 101 | static MVKLayerManager* _globalManager = VK_NULL_HANDLE; 102 | 103 | // Test first and lock only if we need to create it. 104 | // Test again after lock established to ensure it wasn't added by another thread between test and lock. 105 | MVKLayerManager* MVKLayerManager::globalManager() { 106 | if ( !_globalManager ) { 107 | lock_guard<mutex> lock(_lock); 108 | if ( !_globalManager ) { 109 | _globalManager = new MVKLayerManager(); 110 | } 111 | } 112 | return _globalManager; 113 | } 114 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/CAMetalLayer+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CAMetalLayer+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKCommonEnvironment.h" 22 | 23 | #import <QuartzCore/QuartzCore.h> 24 | 25 | #if MVK_IOS_OR_TVOS || MVK_MACCAT 26 | # include <UIKit/UIScreen.h> 27 | #endif 28 | 29 | #if MVK_MACOS && !MVK_MACCAT 30 | # include <AppKit/NSScreen.h> 31 | #endif 32 | 33 | /** Extensions to CAMetalLayer to support MoltenVK. */ 34 | @interface CAMetalLayer (MoltenVK) 35 | 36 | /** 37 | * Returns the natural drawable size for this layer. 38 | * 39 | * The natural drawable size is the size of the bounds 40 | * property multiplied by the contentsScale property. 41 | */ 42 | @property(nonatomic, readonly) CGSize naturalDrawableSizeMVK; 43 | 44 | /** 45 | * Replacement for the displaySyncEnabled property. 46 | * 47 | * This property allows support under all OS versions. Delegates to the displaySyncEnabled 48 | * property if it is available. otherwise, returns YES when read and does nothing when set. 49 | */ 50 | @property(nonatomic, readwrite) BOOL displaySyncEnabledMVK; 51 | 52 | /** 53 | * Replacement for the maximumDrawableCount property. 54 | * 55 | * This property allows support under all OS versions. Delegates to the maximumDrawableCount 56 | * property if it is available. otherwise, returns zero when read and does nothing when set. 57 | */ 58 | @property(nonatomic, readwrite) NSUInteger maximumDrawableCountMVK; 59 | 60 | /** 61 | * Replacement for the wantsExtendedDynamicRangeContent property. 62 | * 63 | * This property allows support under all OS versions. Delegates to the wantsExtendedDynamicRangeContent 64 | * property if it is available. Otherwise, returns NO when read and does nothing when set. 65 | */ 66 | @property(nonatomic, readwrite) BOOL wantsExtendedDynamicRangeContentMVK; 67 | 68 | /** 69 | * The name of the CGColorSpaceRef in the colorspace property of this layer. 70 | * 71 | * Reading this property returns the name of the CGColorSpaceRef in the colorspace property. 72 | * Setting this property sets the value in the colorspace property to a CGColorSpaceRef 73 | * with that name, creating and releasing the CGColorSpaceRef object itself as needed. 74 | */ 75 | @property(nonatomic, readwrite) CFStringRef colorspaceNameMVK; 76 | 77 | #if MVK_IOS_OR_TVOS || MVK_MACCAT 78 | /** Returns the screen on which this layer is rendering. */ 79 | @property(nonatomic, readonly) UIScreen* screenMVK; 80 | #endif 81 | 82 | #if MVK_MACOS && !MVK_MACCAT 83 | /** Returns the screen on which this layer is rendering. */ 84 | @property(nonatomic, readonly) NSScreen* screenMVK; 85 | 86 | @property(nonatomic, readonly) NSScreen* privateScreenMVKImpl; 87 | #endif 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2020-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | /** Extensions to MTLRenderPassDepthAttachmentDescriptor to support MoltenVK. */ 24 | @interface MTLRenderPassDepthAttachmentDescriptor (MoltenVK) 25 | 26 | /** 27 | * Replacement for the depthResolveFilter property. 28 | * 29 | * This property allows support under all OS versions. Delegates to the depthResolveFilter 30 | * property if it is available. Otherwise, returns MTLMultisampleDepthResolveFilterSample0 when read and does nothing when set. 31 | */ 32 | @property(nonatomic, readwrite) MTLMultisampleDepthResolveFilter depthResolveFilterMVK; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassDepthAttachmentDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2020-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h" 21 | 22 | 23 | @implementation MTLRenderPassDepthAttachmentDescriptor (MoltenVK) 24 | 25 | -(MTLMultisampleDepthResolveFilter) depthResolveFilterMVK { 26 | if ( [self respondsToSelector: @selector(depthResolveFilter)] ) { 27 | return self.depthResolveFilter; 28 | } 29 | return MTLMultisampleDepthResolveFilterSample0; 30 | } 31 | 32 | -(void) setDepthResolveFilterMVK: (MTLMultisampleDepthResolveFilter) filter { 33 | if ( [self respondsToSelector: @selector(setDepthResolveFilter:)] ) { 34 | self.depthResolveFilter = filter; 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | /** Extensions to MTLRenderPassDescriptor to support MoltenVK. */ 24 | @interface MTLRenderPassDescriptor (MoltenVK) 25 | 26 | /** 27 | * Replacement for the renderTargetArrayLength property. 28 | * 29 | * This property allows support under all OS versions. Delegates to the renderTargetArrayLength 30 | * property if it is available. otherwise, returns 0 when read and does nothing when set. 31 | */ 32 | @property(nonatomic, readwrite) NSUInteger renderTargetArrayLengthMVK; 33 | 34 | /** 35 | * Replacement for the renderTargetWidth property. 36 | * 37 | * This property allows support under all OS versions. Delegates to the renderTargetWidth 38 | * property if it is available. otherwise, returns 0 when read and does nothing when set. 39 | */ 40 | @property(nonatomic, readwrite) NSUInteger renderTargetWidthMVK; 41 | 42 | /** 43 | * Replacement for the renderTargetHeight property. 44 | * 45 | * This property allows support under all OS versions. Delegates to the renderTargetHeight 46 | * property if it is available. otherwise, returns 0 when read and does nothing when set. 47 | */ 48 | @property(nonatomic, readwrite) NSUInteger renderTargetHeightMVK; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLRenderPassDescriptor+MoltenVK.h" 21 | #include "MVKCommonEnvironment.h" 22 | 23 | @implementation MTLRenderPassDescriptor (MoltenVK) 24 | 25 | -(NSUInteger) renderTargetArrayLengthMVK { 26 | 27 | #if MVK_MACOS 28 | return self.renderTargetArrayLength; 29 | #endif 30 | #if MVK_TVOS 31 | return 0; 32 | #endif 33 | #if MVK_IOS_OR_VISIONOS 34 | if ( [self respondsToSelector: @selector(renderTargetArrayLength)] ) { 35 | return self.renderTargetArrayLength; 36 | } 37 | return 0; 38 | #endif 39 | 40 | } 41 | 42 | -(void) setRenderTargetArrayLengthMVK: (NSUInteger) length { 43 | 44 | #if MVK_MACOS 45 | self.renderTargetArrayLength = length; 46 | #endif 47 | #if MVK_IOS_OR_VISIONOS 48 | if ( [self respondsToSelector: @selector(setRenderTargetArrayLength:)] ) { 49 | self.renderTargetArrayLength = length; 50 | } 51 | #endif 52 | 53 | } 54 | 55 | -(NSUInteger) renderTargetWidthMVK { 56 | 57 | #if MVK_TVOS 58 | return 0; 59 | #else 60 | if ([self respondsToSelector: @selector(renderTargetWidth)]) 61 | return self.renderTargetWidth; 62 | return 0; 63 | #endif 64 | 65 | } 66 | 67 | -(void) setRenderTargetWidthMVK: (NSUInteger) width { 68 | 69 | #if !MVK_TVOS 70 | if ([self respondsToSelector: @selector(setRenderTargetWidth:)]) 71 | self.renderTargetWidth = width; 72 | #endif 73 | 74 | } 75 | 76 | -(NSUInteger) renderTargetHeightMVK { 77 | 78 | #if MVK_TVOS 79 | return 0; 80 | #else 81 | if ([self respondsToSelector: @selector(renderTargetHeight)]) 82 | return self.renderTargetHeight; 83 | return 0; 84 | #endif 85 | 86 | } 87 | 88 | -(void) setRenderTargetHeightMVK: (NSUInteger) height { 89 | 90 | #if !MVK_TVOS 91 | if ([self respondsToSelector: @selector(setRenderTargetHeight:)]) 92 | self.renderTargetHeight = height; 93 | #endif 94 | 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2020-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | /** Extensions to MTLRenderPassStencilAttachmentDescriptor to support MoltenVK. */ 24 | @interface MTLRenderPassStencilAttachmentDescriptor (MoltenVK) 25 | 26 | /** 27 | * Replacement for the stencilResolveFilter property. 28 | * 29 | * This property allows support under all OS versions. Delegates to the stencilResolveFilter 30 | * property if it is available. Otherwise, returns MTLMultisampleStencilResolveFilterSample0 when read and does nothing when set. 31 | */ 32 | @property(nonatomic, readwrite) MTLMultisampleStencilResolveFilter stencilResolveFilterMVK; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPassStencilAttachmentDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2020-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h" 21 | 22 | 23 | @implementation MTLRenderPassStencilAttachmentDescriptor (MoltenVK) 24 | 25 | -(MTLMultisampleStencilResolveFilter) stencilResolveFilterMVK { 26 | if ( [self respondsToSelector: @selector(stencilResolveFilter)] ) { 27 | return self.stencilResolveFilter; 28 | } 29 | return MTLMultisampleStencilResolveFilterSample0; 30 | } 31 | 32 | -(void) setStencilResolveFilterMVK: (MTLMultisampleStencilResolveFilter) filter { 33 | if ( [self respondsToSelector: @selector(setStencilResolveFilter:)] ) { 34 | self.stencilResolveFilter = filter; 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2018-2023 Chip Davis 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | 24 | /** Extensions to MTLRenderPipelineColorAttachmentDescriptor to support MoltenVK. */ 25 | @interface MTLRenderPipelineColorAttachmentDescriptor (MoltenVK) 26 | 27 | /** 28 | * Replacement for the logicOpEnabled property. 29 | * 30 | * This property allows support under all OS versions. Delegates to the logicOpEnabled 31 | * property if it is available. otherwise, returns NO when read and does nothing when set. 32 | */ 33 | @property(nonatomic, readwrite, getter=isLogicOpEnabledMVK) BOOL logicOpEnabledMVK; 34 | 35 | /** 36 | * Replacement for the logicOp property. 37 | * 38 | * This property allows support under all OS versions. Delegates to the logicOp 39 | * property if it is available. otherwise, returns MTLLogicOperationCopy when 40 | * read and does nothing when set. 41 | * 42 | * The value is treated as an NSUInteger to support OS versions on which the enum is unavailable. 43 | */ 44 | @property(nonatomic, readwrite) NSUInteger logicOpMVK; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPipelineDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2018-2023 Chip Davis 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MVKCommonEnvironment.h" 21 | 22 | #if MVK_USE_METAL_PRIVATE_API 23 | 24 | #include "MTLRenderPipelineDescriptor+MoltenVK.h" 25 | 26 | typedef NSUInteger MTLLogicOperation; 27 | 28 | @interface MTLRenderPipelineColorAttachmentDescriptor () 29 | 30 | - (BOOL)isLogicOpEnabled; 31 | - (void)setLogicOpEnabled: (BOOL)enable; 32 | - (MTLLogicOperation)logicOp; 33 | - (void)setLogicOp: (MTLLogicOperation)op; 34 | 35 | @end 36 | 37 | @implementation MTLRenderPipelineColorAttachmentDescriptor (MoltenVK) 38 | 39 | - (BOOL)isLogicOpEnabledMVK { 40 | if ([self respondsToSelector:@selector(isLogicOpEnabled)]) { 41 | return [self isLogicOpEnabled]; 42 | } 43 | return NO; 44 | } 45 | 46 | - (void)setLogicOpEnabledMVK: (BOOL)enable { 47 | if ([self respondsToSelector:@selector(setLogicOpEnabled:)]) { 48 | [self setLogicOpEnabled: enable]; 49 | } 50 | } 51 | 52 | - (NSUInteger)logicOpMVK { 53 | if ([self respondsToSelector:@selector(logicOp)]) { 54 | return [self logicOp]; 55 | } 56 | return 3 /* MTLLogicOperationCopy */; 57 | } 58 | 59 | - (void)setLogicOpMVK: (MTLLogicOperation)op { 60 | if ([self respondsToSelector:@selector(setLogicOp:)]) { 61 | [self setLogicOp: (MTLLogicOperation)op]; 62 | } 63 | } 64 | 65 | @end 66 | 67 | #endif /* MVK_CONFIG_SUPPORT_METAL_SPIS */ 68 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPipelineDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | 24 | /** Extensions to MTLRenderPassDescriptor to support MoltenVK. */ 25 | @interface MTLRenderPipelineDescriptor (MoltenVK) 26 | 27 | /** 28 | * Replacement for the inputPrimitiveTopology property. 29 | * 30 | * This property allows support under all OS versions. Delegates to the inputPrimitiveTopology 31 | * property if it is available. otherwise, returns MTLPrimitiveTopologyClassUnspecified when 32 | * read and does nothing when set. 33 | */ 34 | @property(nonatomic, readwrite) MTLPrimitiveTopologyClass inputPrimitiveTopologyMVK; 35 | 36 | /** 37 | * Replacement for the sampleMask property. 38 | * 39 | * This property allows support under all OS versions. Delegates to the sampleMask 40 | * property if it is available. otherwise, returns 0xFFFFFFFF when 41 | * read and does nothing when set. 42 | */ 43 | @property(nonatomic, readwrite) NSUInteger sampleMaskMVK; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLRenderPipelineDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLRenderPipelineDescriptor+MoltenVK.h" 21 | #include "MVKCommonEnvironment.h" 22 | 23 | #if MVK_USE_METAL_PRIVATE_API 24 | // These properties aren't public yet. 25 | @interface MTLRenderPipelineDescriptor () 26 | 27 | @property(nonatomic, readwrite) NSUInteger sampleMask; 28 | @property(nonatomic, readwrite) float sampleCoverage; 29 | 30 | @end 31 | #endif 32 | 33 | @implementation MTLRenderPipelineDescriptor (MoltenVK) 34 | 35 | -(MTLPrimitiveTopologyClass) inputPrimitiveTopologyMVK { 36 | if ( [self respondsToSelector: @selector(inputPrimitiveTopology)] ) { return [self inputPrimitiveTopology]; } 37 | return MTLPrimitiveTopologyClassUnspecified; 38 | } 39 | 40 | -(void) setInputPrimitiveTopologyMVK: (MTLPrimitiveTopologyClass) topology { 41 | if ([self respondsToSelector: @selector(setInputPrimitiveTopology:)]) { [self setInputPrimitiveTopology:topology]; } 42 | } 43 | 44 | -(NSUInteger) sampleMaskMVK { 45 | #if MVK_USE_METAL_PRIVATE_API 46 | if ( [self respondsToSelector: @selector(sampleMask)] ) { return self.sampleMask; } 47 | #endif 48 | return 0xFFFFFFFFFFFFFFFFULL; 49 | } 50 | 51 | -(void) setSampleMaskMVK: (NSUInteger) mask { 52 | #if MVK_USE_METAL_PRIVATE_API 53 | if ([self respondsToSelector: @selector(setSampleMask:)]) { self.sampleMask = mask; } 54 | #endif 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLSamplerDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | /** Extensions to MTLSamplerDescriptor to support MoltenVK. */ 24 | @interface MTLSamplerDescriptor (MoltenVK) 25 | 26 | /** 27 | * Replacement for the compareFunction property. 28 | * 29 | * This property allows support under all OS versions. Delegates to the compareFunction 30 | * property if it is available. otherwise, returns MTLTextureUsageUnknown when read and 31 | * does nothing when set. 32 | */ 33 | @property(nonatomic, readwrite) MTLCompareFunction compareFunctionMVK; 34 | 35 | /** 36 | * Replacement for the borderColor property. 37 | * 38 | * This property allows support under all OS versions. Delegates to the borderColor 39 | * property if it is available. otherwise, returns MTLSamplerBorderColorTransparentBlack when read and 40 | * does nothing when set. 41 | */ 42 | @property(nonatomic, readwrite) /*MTLSamplerBorderColor*/ NSUInteger borderColorMVK; 43 | 44 | /** 45 | * Replacement for the lodBias property. 46 | * 47 | * This property allows support under all OS versions. Delegates to the lodBias 48 | * property if it is available. otherwise, returns 0 when read and 49 | * does nothing when set. 50 | */ 51 | @property(nonatomic, readwrite) float lodBiasMVK; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLSamplerDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLSamplerDescriptor+MoltenVK.h" 21 | #include "MVKCommonEnvironment.h" 22 | 23 | 24 | #if MVK_USE_METAL_PRIVATE_API 25 | /** Additional methods not necessarily declared in <Metal/MTLSampler.h>. */ 26 | @interface MTLSamplerDescriptor () 27 | 28 | @property(nonatomic, readwrite) float lodBias; 29 | 30 | @end 31 | #endif 32 | 33 | @implementation MTLSamplerDescriptor (MoltenVK) 34 | 35 | -(MTLCompareFunction) compareFunctionMVK { 36 | if ( [self respondsToSelector: @selector(compareFunction)] ) { return self.compareFunction; } 37 | return MTLCompareFunctionNever; 38 | } 39 | 40 | -(void) setCompareFunctionMVK: (MTLCompareFunction) cmpFunc { 41 | if ( [self respondsToSelector: @selector(setCompareFunction:)] ) { self.compareFunction = cmpFunc; } 42 | } 43 | 44 | -(NSUInteger) borderColorMVK { 45 | #if MVK_MACOS_OR_IOS 46 | if ( [self respondsToSelector: @selector(borderColor)] ) { return self.borderColor; } 47 | #endif 48 | return /*MTLSamplerBorderColorTransparentBlack*/ 0; 49 | } 50 | 51 | -(void) setBorderColorMVK: (NSUInteger) color { 52 | #if MVK_MACOS_OR_IOS 53 | if ( [self respondsToSelector: @selector(setBorderColor:)] ) { self.borderColor = (MTLSamplerBorderColor) color; } 54 | #endif 55 | } 56 | 57 | -(float) lodBiasMVK { 58 | #if MVK_USE_METAL_PRIVATE_API 59 | if ( [self respondsToSelector: @selector(lodBias)] ) { return self.lodBias; } 60 | #endif 61 | return 0.0f; 62 | } 63 | 64 | -(void) setLodBiasMVK: (float) bias { 65 | #if MVK_USE_METAL_PRIVATE_API 66 | if ( [self respondsToSelector: @selector(setLodBias:)] ) { self.lodBias = bias; } 67 | #endif 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLTextureDescriptor+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Metal/Metal.h> 22 | 23 | /** Extensions to MTLTextureDescriptor to support MoltenVK. */ 24 | @interface MTLTextureDescriptor (MoltenVK) 25 | 26 | /** 27 | * Replacement for the usage property. 28 | * 29 | * This property allows support under all OS versions. Delegates to the usage property if it 30 | * is available. otherwise, returns MTLTextureUsageUnknown when read and does nothing when set. 31 | */ 32 | @property(nonatomic, readwrite) MTLTextureUsage usageMVK; 33 | 34 | /** 35 | * Replacement for the storageMode property. 36 | * 37 | * This property allows support under all OS versions. Delegates to the storageMode 38 | * property if it is available. otherwise, returns MTLStorageModeShared when read 39 | * and does nothing when set. 40 | */ 41 | @property(nonatomic, readwrite) MTLStorageMode storageModeMVK; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MTLTextureDescriptor+MoltenVK.m 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "MTLTextureDescriptor+MoltenVK.h" 21 | 22 | @implementation MTLTextureDescriptor (MoltenVK) 23 | 24 | -(MTLTextureUsage) usageMVK { 25 | if ( [self respondsToSelector: @selector(usage)] ) { return self.usage; } 26 | return MTLTextureUsageUnknown; 27 | } 28 | 29 | -(void) setUsageMVK: (MTLTextureUsage) usage { 30 | if ( [self respondsToSelector: @selector(setUsage:)] ) { self.usage = usage; } 31 | } 32 | 33 | -(MTLStorageMode) storageModeMVK { 34 | if ( [self respondsToSelector: @selector(storageMode)] ) { return self.storageMode; } 35 | return MTLStorageModeShared; 36 | } 37 | 38 | -(void) setStorageModeMVK: (MTLStorageMode) storageMode { 39 | if ( [self respondsToSelector: @selector(setStorageMode:)] ) { self.storageMode = storageMode; } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MVKGPUCapture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKGPUCapture.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "MVKQueue.h" 22 | 23 | #import <Metal/Metal.h> 24 | 25 | 26 | #pragma mark - 27 | #pragma mark MVKGPUCaptureScope 28 | 29 | /** 30 | * Represents a capture scope for capturing GPU activity within Xcode. 31 | * 32 | * If the OS supports the MTLCaptureScope protocol, this class creates and wraps an MTLCaptureScope 33 | * instance for a MTLQueue, otherwise it interacts directly with the MTLQueue to define capture boundaries. 34 | */ 35 | class MVKGPUCaptureScope : public MVKBaseObject { 36 | 37 | public: 38 | 39 | /** Returns the Vulkan API opaque object controlling this object. */ 40 | MVKVulkanAPIObject* getVulkanAPIObject() override { return nullptr; } 41 | 42 | /** Marks the beginning boundary of a capture scope. */ 43 | void beginScope(); 44 | 45 | /** Marks the end boundary of a capture scope. */ 46 | void endScope(); 47 | 48 | /** Makes this instance the default capture scope within Xcode. */ 49 | void makeDefault(); 50 | 51 | /** 52 | * Constructs an instance for the specified queue. 53 | * 54 | * If the queue has a debug name, it will be displayed in Xcode when selecting a capture scope to use. 55 | */ 56 | MVKGPUCaptureScope(MVKQueue* mvkQueue); 57 | 58 | ~MVKGPUCaptureScope() override; 59 | 60 | protected: 61 | id<MTLCaptureScope> _mtlCaptureScope = nil; 62 | id<MTLCommandQueue> _mtlQueue = nil; 63 | bool _isFirstBoundary = true; 64 | bool _isDefault = false; 65 | }; 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/MVKGPUCapture.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKGPUCapture.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MVKGPUCapture.h" 20 | #include "MVKOSExtensions.h" 21 | 22 | 23 | #pragma mark - 24 | #pragma mark MVKGPUCaptureScope 25 | 26 | /** Old-style debug capture was deprecated in macOS 10.13 and iOS 11.0, and is not available on Mac Catalyst. */ 27 | #if MVK_MACOS 28 | # define MVK_NEED_OLD_DEBUG_CAPTURE (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_13) && !MVK_MACCAT 29 | #endif 30 | 31 | #if MVK_IOS 32 | # define MVK_NEED_OLD_DEBUG_CAPTURE (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_11_0) 33 | #endif 34 | 35 | #if MVK_TVOS 36 | # define MVK_NEED_OLD_DEBUG_CAPTURE (__TV_OS_VERSION_MIN_REQUIRED < __TVOS_11_0) 37 | #endif 38 | 39 | 40 | void MVKGPUCaptureScope::beginScope() { 41 | if (_mtlCaptureScope) { 42 | [_mtlCaptureScope beginScope]; 43 | } else if (_isDefault && _isFirstBoundary) { 44 | #if MVK_NEED_OLD_DEBUG_CAPTURE 45 | [_mtlQueue insertDebugCaptureBoundary]; 46 | #endif 47 | } 48 | _isFirstBoundary = false; 49 | } 50 | 51 | void MVKGPUCaptureScope::endScope() { 52 | if (_mtlCaptureScope) { 53 | [_mtlCaptureScope endScope]; 54 | } else if (_isDefault) { 55 | #if MVK_NEED_OLD_DEBUG_CAPTURE 56 | [_mtlQueue insertDebugCaptureBoundary]; 57 | #endif 58 | } 59 | } 60 | 61 | void MVKGPUCaptureScope::makeDefault() { 62 | _isDefault = true; 63 | if (_mtlCaptureScope) { 64 | [MTLCaptureManager sharedCaptureManager].defaultCaptureScope = _mtlCaptureScope; 65 | } 66 | } 67 | 68 | MVKGPUCaptureScope::MVKGPUCaptureScope(MVKQueue* mvkQueue) { 69 | _mtlQueue = [mvkQueue->getMTLCommandQueue() retain]; // retained 70 | if (mvkOSVersionIsAtLeast(10.13, 11.0, 1.0)) { 71 | _mtlCaptureScope = [[MTLCaptureManager sharedCaptureManager] newCaptureScopeWithCommandQueue: _mtlQueue]; // retained 72 | mvkQueue->setMetalObjectLabel(_mtlCaptureScope, @(mvkQueue->getName().c_str())); 73 | 74 | // Due to an retain bug in Metal when the capture layer is installed, capture scopes 75 | // on older OS versions can have too many references on them. If so, release the excess 76 | // references so the scope, and command queue, aren't leaked. This is a horrible kludge 77 | // that depends on Apple not taking internal references to capture scopes, but without it, 78 | // we could get hung up waiting for a new queue, because the old queues are still outstanding. 79 | // This bug was fixed by Apple in macOS 12.4 and iOS 15.4. 80 | if ( !mvkOSVersionIsAtLeast(12.04, 15.04, 1.0) ) { 81 | while (_mtlCaptureScope.retainCount > 1) { 82 | [_mtlCaptureScope release]; 83 | } 84 | } 85 | } 86 | } 87 | 88 | MVKGPUCaptureScope::~MVKGPUCaptureScope() { 89 | [_mtlCaptureScope release]; 90 | [_mtlQueue release]; 91 | } 92 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/NSString+MoltenVK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NSString+MoltenVK.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #import <Foundation/Foundation.h> 22 | 23 | 24 | #pragma mark - 25 | #pragma mark NSMutableString extension 26 | 27 | /** Extensions to NSMutableString to support MoltenVK. */ 28 | @interface NSMutableString (MoltenVK) 29 | 30 | /** Appends the string and a new line. */ 31 | -(void) appendLineMVK:(NSString*) aString; 32 | 33 | /** Appends an empty new line. */ 34 | -(void) appendLineMVK; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/OS/NSString+MoltenVK.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * NSString+MoltenVK.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #include "NSString+MoltenVK.h" 21 | 22 | 23 | #pragma mark - 24 | #pragma mark NSMutableString extension 25 | 26 | @implementation NSMutableString (MoltenVK) 27 | 28 | -(void) appendLineMVK:(NSString*) aString { 29 | [self appendString: aString]; 30 | [self appendLineMVK]; 31 | } 32 | 33 | -(void) appendLineMVK { 34 | [self appendString: @"\n"]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Utility/MVKBlockObserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKBlockObserver.h 3 | * 4 | * Copyright (c) 2019-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #import <Foundation/NSObject.h> 21 | #import <Foundation/NSKeyValueObserving.h> 22 | 23 | 24 | #pragma mark MVKBlockObserver 25 | 26 | typedef void (^MVKKeyValueObserverBlock)(NSString* keyPath, id object, NSDictionary* changeDict, void* context); 27 | 28 | /** Class that calls a block on any key-value observation callback. */ 29 | @interface MVKBlockObserver : NSObject { 30 | MVKKeyValueObserverBlock _block; 31 | id _target; 32 | NSString* _keyPath; 33 | } 34 | 35 | - (instancetype)initWithBlock:(MVKKeyValueObserverBlock) block; 36 | - (instancetype)initWithBlock:(MVKKeyValueObserverBlock) block forObject: object atKeyPath:(NSString*) keyPath; 37 | 38 | + (instancetype)observerWithBlock:(MVKKeyValueObserverBlock) block; 39 | + (instancetype)observerWithBlock:(MVKKeyValueObserverBlock) block forObject: object atKeyPath:(NSString*) keyPath; 40 | 41 | - (void)observeValueForKeyPath:(NSString*) path ofObject: object change:(NSDictionary*) changeDict context: (void*)context; 42 | 43 | - (void)startObservingObject: object atKeyPath:(NSString*) keyPath; 44 | - (void)stopObserving; 45 | 46 | @end 47 | 48 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Utility/MVKBlockObserver.m: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKBlockObserver.m 3 | * 4 | * Copyright (c) 2019-2025 Chip Davis for CodeWeavers 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | #import "MVKBlockObserver.h" 21 | 22 | 23 | @implementation MVKBlockObserver 24 | 25 | - (instancetype)initWithBlock:(MVKKeyValueObserverBlock) block { 26 | if ((self = [super init])) { 27 | _block = [block copy]; 28 | } 29 | return self; 30 | } 31 | 32 | - (instancetype)initWithBlock:(MVKKeyValueObserverBlock) block forObject: object atKeyPath:(NSString*) keyPath { 33 | if ((self = [super init])) { 34 | _block = [block copy]; 35 | [self startObservingObject: object atKeyPath: keyPath]; 36 | } 37 | return self; 38 | } 39 | 40 | + (instancetype)observerWithBlock:(MVKKeyValueObserverBlock) block { 41 | return [[self alloc] initWithBlock: block]; 42 | } 43 | 44 | + (instancetype)observerWithBlock:(MVKKeyValueObserverBlock) block forObject: object atKeyPath:(NSString*) keyPath { 45 | return [[self alloc] initWithBlock: block forObject: object atKeyPath: keyPath]; 46 | } 47 | 48 | - (void)dealloc { 49 | [self stopObserving]; 50 | [_block release]; 51 | [super dealloc]; 52 | } 53 | 54 | - (void)observeValueForKeyPath:(NSString*) path ofObject: object change:(NSDictionary*) changeDict context:(void*) context { 55 | _block(path, object, changeDict, context); 56 | } 57 | 58 | - (void)startObservingObject: object atKeyPath:(NSString*) path { 59 | if ( !_target ) { 60 | _target = [object retain]; 61 | _keyPath = [path copy]; 62 | [_target addObserver: self forKeyPath: _keyPath options: 0 context: NULL]; 63 | } 64 | } 65 | 66 | - (void)stopObserving { 67 | [_target removeObserver: self forKeyPath: _keyPath context: NULL]; 68 | [_target release]; 69 | [_keyPath release]; 70 | _target = nil; 71 | _keyPath = nil; 72 | } 73 | 74 | @end 75 | 76 | -------------------------------------------------------------------------------- /MoltenVK/MoltenVK/Utility/MVKWatermarkShaderSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MVKWatermarkShaderSource.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | 22 | /** This file contains static source code for the Watermark shaders. */ 23 | 24 | static const char* __watermarkShaderSource = " \n\ 25 | #include <metal_stdlib> \n\ 26 | using namespace metal; \n\ 27 | \n\ 28 | typedef struct { \n\ 29 | float4x4 mvpMtx; \n\ 30 | float4 color; \n\ 31 | } Uniforms; \n\ 32 | \n\ 33 | typedef struct { \n\ 34 | float2 a_position [[attribute(0)]]; \n\ 35 | float2 a_texCoord [[attribute(1)]]; \n\ 36 | } Attributes; \n\ 37 | \n\ 38 | typedef struct { \n\ 39 | float4 v_position [[position]]; \n\ 40 | float2 v_texCoord; \n\ 41 | float4 v_fragColor; \n\ 42 | } Varyings; \n\ 43 | \n\ 44 | vertex Varyings watermarkVertex(Attributes attributes [[stage_in]], \n\ 45 | constant Uniforms& uniforms [[ buffer(0) ]]) { \n\ 46 | Varyings varyings; \n\ 47 | varyings.v_position = uniforms.mvpMtx * float4(attributes.a_position, 0.0, 1.0); \n\ 48 | varyings.v_fragColor = uniforms.color; \n\ 49 | varyings.v_texCoord = attributes.a_texCoord; \n\ 50 | return varyings; \n\ 51 | } \n\ 52 | \n\ 53 | fragment float4 watermarkFragment(Varyings varyings [[stage_in]], \n\ 54 | texture2d<float> texture [[ texture(0) ]], \n\ 55 | sampler sampler [[ sampler(0) ]]) { \n\ 56 | return varyings.v_fragColor * texture.sample(sampler, varyings.v_texCoord); \n\ 57 | }; \n\ 58 | "; 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /MoltenVK/icd/MoltenVK_icd.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_format_version" : "1.0.0", 3 | "ICD": { 4 | "library_path": "./libMoltenVK.dylib", 5 | "api_version" : "1.3.0", 6 | "is_portability_driver" : true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /MoltenVK/include/MoltenVK: -------------------------------------------------------------------------------- 1 | ../MoltenVK/API -------------------------------------------------------------------------------- /MoltenVK/include/vk_video: -------------------------------------------------------------------------------- 1 | ../../External/Vulkan-Headers/include/vk_video -------------------------------------------------------------------------------- /MoltenVK/include/vulkan: -------------------------------------------------------------------------------- 1 | ../../External/Vulkan-Headers/include/vulkan -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package (MacCat only).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A91170FD2B9110050057AD37" 18 | BuildableName = "MoltenVK-MacCat" 19 | BlueprintName = "MoltenVK-MacCat" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | </LaunchAction> 49 | <ProfileAction 50 | buildConfiguration = "Release" 51 | shouldUseLaunchSchemeArgsEnv = "YES" 52 | savedToolIdentifier = "" 53 | useCustomWorkingDirectory = "NO" 54 | debugDocumentVersioning = "YES"> 55 | </ProfileAction> 56 | <AnalyzeAction 57 | buildConfiguration = "Debug"> 58 | </AnalyzeAction> 59 | <ArchiveAction 60 | buildConfiguration = "Release" 61 | revealArchiveInOrganizer = "YES"> 62 | </ArchiveAction> 63 | </Scheme> 64 | -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package (iOS only).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A975D5782140585200D4834F" 18 | BuildableName = "MoltenVK-iOS" 19 | BlueprintName = "MoltenVK-iOS" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A975D5782140585200D4834F" 52 | BuildableName = "MoltenVK-iOS" 53 | BlueprintName = "MoltenVK-iOS" 54 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A975D5782140585200D4834F" 68 | BuildableName = "MoltenVK-iOS" 69 | BlueprintName = "MoltenVK-iOS" 70 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package (macOS only).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A975D58B2140586700D4834F" 18 | BuildableName = "MoltenVK-macOS" 19 | BlueprintName = "MoltenVK-macOS" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A975D58B2140586700D4834F" 52 | BuildableName = "MoltenVK-macOS" 53 | BlueprintName = "MoltenVK-macOS" 54 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A975D58B2140586700D4834F" 68 | BuildableName = "MoltenVK-macOS" 69 | BlueprintName = "MoltenVK-macOS" 70 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package (tvOS only).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "2FEA0A2F24902F5E00EEF3AD" 18 | BuildableName = "MoltenVK-tvOS" 19 | BlueprintName = "MoltenVK-tvOS" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | </LaunchAction> 49 | <ProfileAction 50 | buildConfiguration = "Release" 51 | shouldUseLaunchSchemeArgsEnv = "YES" 52 | savedToolIdentifier = "" 53 | useCustomWorkingDirectory = "NO" 54 | debugDocumentVersioning = "YES"> 55 | </ProfileAction> 56 | <AnalyzeAction 57 | buildConfiguration = "Debug"> 58 | </AnalyzeAction> 59 | <ArchiveAction 60 | buildConfiguration = "Release" 61 | revealArchiveInOrganizer = "YES"> 62 | </ArchiveAction> 63 | </Scheme> 64 | -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package (visionOS only).xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "DCFD7ED52A45BC56007BBBF7" 18 | BuildableName = "MoltenVK-xrOS" 19 | BlueprintName = "MoltenVK-xrOS" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | </LaunchAction> 49 | <ProfileAction 50 | buildConfiguration = "Release" 51 | shouldUseLaunchSchemeArgsEnv = "YES" 52 | savedToolIdentifier = "" 53 | useCustomWorkingDirectory = "NO" 54 | debugDocumentVersioning = "YES"> 55 | <MacroExpansion> 56 | <BuildableReference 57 | BuildableIdentifier = "primary" 58 | BlueprintIdentifier = "DCFD7ED52A45BC56007BBBF7" 59 | BuildableName = "MoltenVK-xrOS" 60 | BlueprintName = "MoltenVK-xrOS" 61 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 62 | </BuildableReference> 63 | </MacroExpansion> 64 | </ProfileAction> 65 | <AnalyzeAction 66 | buildConfiguration = "Debug"> 67 | </AnalyzeAction> 68 | <ArchiveAction 69 | buildConfiguration = "Release" 70 | revealArchiveInOrganizer = "YES"> 71 | </ArchiveAction> 72 | </Scheme> 73 | -------------------------------------------------------------------------------- /MoltenVKPackaging.xcodeproj/xcshareddata/xcschemes/MoltenVK Package.xcscheme: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Scheme 3 | LastUpgradeVersion = "9999" 4 | version = "2.0"> 5 | <BuildAction 6 | parallelizeBuildables = "NO" 7 | buildImplicitDependencies = "NO"> 8 | <BuildActionEntries> 9 | <BuildActionEntry 10 | buildForTesting = "YES" 11 | buildForRunning = "YES" 12 | buildForProfiling = "YES" 13 | buildForArchiving = "YES" 14 | buildForAnalyzing = "YES"> 15 | <BuildableReference 16 | BuildableIdentifier = "primary" 17 | BlueprintIdentifier = "A9FEADBC1F3517480010240E" 18 | BuildableName = "MoltenVK" 19 | BlueprintName = "MoltenVK" 20 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 21 | </BuildableReference> 22 | </BuildActionEntry> 23 | </BuildActionEntries> 24 | </BuildAction> 25 | <TestAction 26 | buildConfiguration = "Debug" 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 29 | shouldUseLaunchSchemeArgsEnv = "YES"> 30 | <Testables> 31 | </Testables> 32 | </TestAction> 33 | <LaunchAction 34 | buildConfiguration = "Release" 35 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 36 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 37 | disableMainThreadChecker = "YES" 38 | launchStyle = "0" 39 | useCustomWorkingDirectory = "NO" 40 | ignoresPersistentStateOnLaunch = "NO" 41 | debugDocumentVersioning = "NO" 42 | debugXPCServices = "NO" 43 | debugServiceExtension = "internal" 44 | enableGPUFrameCaptureMode = "3" 45 | enableGPUValidationMode = "1" 46 | allowLocationSimulation = "NO" 47 | queueDebuggingEnabled = "No"> 48 | <MacroExpansion> 49 | <BuildableReference 50 | BuildableIdentifier = "primary" 51 | BlueprintIdentifier = "A9FEADBC1F3517480010240E" 52 | BuildableName = "MoltenVK" 53 | BlueprintName = "MoltenVK" 54 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 55 | </BuildableReference> 56 | </MacroExpansion> 57 | </LaunchAction> 58 | <ProfileAction 59 | buildConfiguration = "Release" 60 | shouldUseLaunchSchemeArgsEnv = "YES" 61 | savedToolIdentifier = "" 62 | useCustomWorkingDirectory = "NO" 63 | debugDocumentVersioning = "YES"> 64 | <MacroExpansion> 65 | <BuildableReference 66 | BuildableIdentifier = "primary" 67 | BlueprintIdentifier = "A9FEADBC1F3517480010240E" 68 | BuildableName = "MoltenVK" 69 | BlueprintName = "MoltenVK" 70 | ReferencedContainer = "container:MoltenVKPackaging.xcodeproj"> 71 | </BuildableReference> 72 | </MacroExpansion> 73 | </ProfileAction> 74 | <AnalyzeAction 75 | buildConfiguration = "Debug"> 76 | </AnalyzeAction> 77 | <ArchiveAction 78 | buildConfiguration = "Release" 79 | revealArchiveInOrganizer = "YES"> 80 | </ArchiveAction> 81 | </Scheme> 82 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverter/FileSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FileSupport.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | 22 | #include <string> 23 | #include <vector> 24 | 25 | 26 | namespace mvk { 27 | 28 | 29 | /** Returns an absolute path from the specified path, which may be absolute or relative. */ 30 | std::string absolutePath(const std::string& path); 31 | 32 | /** Returns the file name from the path, with or without the file extension. */ 33 | std::string fileName(const std::string& path, bool includeExtenison = true); 34 | 35 | /** Returns the extension component (after the .) of the specified path. */ 36 | std::string pathExtension(const std::string& path); 37 | 38 | /** Returns whether the specified path exists and is a readable file. */ 39 | bool canReadFile(const std::string& path); 40 | 41 | /** Returns whether the specified path is a file that is writable. */ 42 | bool canWriteFile(const std::string& path); 43 | 44 | /** 45 | * Returns a copy of the specified path, with the extension of the path set or changed 46 | * to the specified extension. If includeOrigPathExtn is true, the original file extension 47 | * of the path will be appended to the file name (before the new separator), separated 48 | * by origPathExtnSep string (eg. myshader.vsh -> myshader_vsh.spv). 49 | */ 50 | std::string pathWithExtension(const std::string& path, 51 | const std::string pathExtn, 52 | bool includeOrigPathExtn, 53 | const std::string origPathExtnSep); 54 | 55 | /** 56 | * Reads the contents of the specified file path into the specified contents vector. 57 | * and returns whether the file read was successful. 58 | * 59 | * If successful, copies the file contents into the contents vector and returns true. 60 | * If unsuccessful, places an explanatory error message in the errMsg string and returns false. 61 | * If file was partially read, copies what could be read into the contents vector, places an 62 | * error message in errMsg, and returns false. 63 | */ 64 | bool readFile(const std::string& path, std::vector<char>& contents, std::string& errMsg); 65 | 66 | /** 67 | * Writes the contents of the specified contents string to the file in the specified file 68 | * path, creating the file if necessary, and returns whether the file write was successful. 69 | * 70 | * If successful, overwrites the entire contents of the file and returns true. 71 | * If unsuccessful, places an explanatory error message in the errMsg string and returns false. 72 | */ 73 | bool writeFile(const std::string& path, const std::vector<char>& contents, std::string& errMsg); 74 | 75 | } 76 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVConversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPIRVConversion.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __SPIRVConversion_h_ 20 | #define __SPIRVConversion_h_ 1 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif // __cplusplus 25 | 26 | 27 | #include <stdlib.h> 28 | 29 | 30 | /** This file contains convenience functions for converting SPIR-V to MSL, callable from standard C code. */ 31 | 32 | 33 | /** 34 | * Convenience function that converts the specified SPIR-V code to Metal Shading Language (MSL), 35 | * source code, and returns whether the conversion was successful. 36 | * 37 | * If the pMSL parameter is not NULL, this function allocates space for the converted 38 | * MSL source code, and returns a pointer to that MSL code in the location indicated 39 | * by this parameter. It is the responsibility of the caller to free() the memory returned 40 | * in this parameter. 41 | * 42 | * If the pResultLog parameter is not NULL, a pointer to the contents of the converter 43 | * results log will be set at the location pointed to by the pResultLog parameter. 44 | * It is the responsibility of the caller to free() the memory returned in this parameter. 45 | * 46 | * The boolean flags indicate whether the original SPIR-V code and resulting MSL source code 47 | * should be logged to the converter results log. This can be useful during shader debugging. 48 | */ 49 | bool mvkConvertSPIRVToMSL(uint32_t* spvCode, 50 | size_t spvLength, 51 | char** pMSL, 52 | char** pResultLog, 53 | bool shouldLogSPIRV, 54 | bool shouldLogMSL); 55 | 56 | /** 57 | * Convenience function that converts SPIR-V code in the specified file to 58 | * Metal Shading Language (MSL) source code. The file path should either be 59 | * absolute or relative to the resource directory. 60 | * 61 | * If the pMSL parameter is not NULL, this function allocates space for the converted 62 | * MSL source code, and returns a pointer to that MSL code in the location indicated 63 | * by this parameter. It is the responsibility of the caller to free() the memory returned 64 | * in this parameter. 65 | * 66 | * If the pResultLog parameter is not NULL, a pointer to the contents of the converter 67 | * results log will be set at the location pointed to by the pResultLog parameter. 68 | * It is the responsibility of the caller to free() the memory returned in this parameter. 69 | * 70 | * The boolean flags indicate whether the original SPIR-V code and resulting MSL source code 71 | * should be logged to the converter results log. This can be useful during shader debugging. 72 | */ 73 | bool mvkConvertSPIRVFileToMSL(const char* spvFilepath, 74 | char** pMSL, 75 | char** pResultLog, 76 | bool shouldLogSPIRV, 77 | bool shouldLogMSL); 78 | 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif // __cplusplus 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVConversion.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * SPIRVConversion.mm 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "SPIRVConversion.h" 20 | #include "SPIRVToMSLConverter.h" 21 | #include "MVKCommonEnvironment.h" 22 | 23 | #include <Foundation/Foundation.h> 24 | 25 | using namespace mvk; 26 | 27 | 28 | MVK_PUBLIC_SYMBOL bool mvkConvertSPIRVToMSL(uint32_t* spvCode, 29 | size_t spvLength, 30 | char** pMSL, 31 | char** pResultLog, 32 | bool shouldLogSPIRV, 33 | bool shouldLogMSL) { 34 | SPIRVToMSLConversionConfiguration spvCtx; 35 | SPIRVToMSLConversionResult conversionResult; 36 | SPIRVToMSLConverter spvConverter; 37 | spvConverter.setSPIRV(spvCode, spvLength); 38 | bool wasConverted = spvConverter.convert(spvCtx, conversionResult, shouldLogSPIRV, shouldLogMSL); 39 | 40 | if (pMSL) { 41 | *pMSL = (char*)malloc(conversionResult.msl.size() + 1); 42 | strcpy(*pMSL, conversionResult.msl.data()); 43 | } 44 | 45 | if (pResultLog) { 46 | *pResultLog = (char*)malloc(conversionResult.resultLog.size() + 1); 47 | strcpy(*pResultLog, conversionResult.resultLog.data()); 48 | } 49 | 50 | return wasConverted; 51 | } 52 | 53 | MVK_PUBLIC_SYMBOL bool mvkConvertSPIRVFileToMSL(const char* spvFilepath, 54 | char** pMSL, 55 | char** pResultLog, 56 | bool shouldLogSPIRV, 57 | bool shouldLogMSL) { 58 | NSString* filePath = @(spvFilepath); 59 | if( !filePath.absolutePath ) { 60 | filePath =[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: filePath]; 61 | } 62 | NSError* err = nil; 63 | NSData* spv = [NSData dataWithContentsOfFile: filePath options: 0 error: &err]; 64 | if (err) { 65 | if (pResultLog) { 66 | NSString* errMsg = [NSString stringWithFormat: @"Unable to convert SPIR-V in file %@ to MSL (Error code %li):\n%@", 67 | filePath, (long)err.code, err.localizedDescription]; 68 | *pResultLog = (char*)malloc(errMsg.length + 1); 69 | strcpy(*pResultLog, errMsg.UTF8String); 70 | } 71 | 72 | if (pMSL) { *pMSL = NULL; } 73 | return false; 74 | } 75 | 76 | return mvkConvertSPIRVToMSL((uint32_t*)spv.bytes, spv.length, pMSL, pResultLog, shouldLogSPIRV, shouldLogMSL); 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPIRVSupport.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __SPIRVSupport_h_ 20 | #define __SPIRVSupport_h_ 1 21 | 22 | #include <string> 23 | #include <vector> 24 | 25 | namespace mvk { 26 | 27 | /** Appends the SPIR-V in human-readable form to the specified log string. */ 28 | void logSPIRV(std::vector<uint32_t>& spirv, std::string& spvLog); 29 | 30 | /** Converts the SPIR-V code to an array of bytes (suitable for writing to a file). */ 31 | void spirvToBytes(const std::vector<uint32_t>& spv, std::vector<char>& bytes); 32 | 33 | /** 34 | * Converts the SPIR-V code to header content (suitable for writing to a file) 35 | * with the SPIR-V content assigned to a named uint32_t variable. 36 | */ 37 | void spirvToHeaderBytes(const std::vector<uint32_t>& spv, std::vector<char>& bytes, const std::string& varName); 38 | 39 | /** Converts an array of bytes (as read from a file) to SPIR-V code. */ 40 | void bytesToSPIRV(const std::vector<char>& bytes, std::vector<uint32_t>& spv); 41 | 42 | /** 43 | * Ensures that the specified SPIR-V code has the correct endianness for this system, 44 | * and converts it in place if necessary. This can be used after loading SPIR-V code 45 | * from a file that may have been encoded on a system with the opposite endianness. 46 | * 47 | * This function tests for the SPIR-V magic number (in both endian states) to determine 48 | * whether conversion is required. It will not convert arrays of uint32_t values that 49 | * are not SPIR-V code. 50 | * 51 | * Returns whether the endianness was changed. 52 | */ 53 | bool ensureSPIRVEndianness(std::vector<uint32_t>& spv); 54 | 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverterTool/OSSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OSSupport.h 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | 22 | #include <string> 23 | 24 | 25 | namespace mvk { 26 | 27 | /** 28 | * Iterates through the directory at the specified path, which may be either a relative 29 | * or absolute path, and calls the processFile(std::string filePath) member function 30 | * on the fileProcessor for each file in the directory. If the isRecursive parameter 31 | * is true, the iteration will include all files in all sub-directories as well. 32 | * 33 | * The processFile(std::string filePath) member function on the fileProcessor should 34 | * return whether that file was successfully processed. 35 | * 36 | * Returns false if the directory could not be found or iterated, or if an error 37 | * occurs with the conversion of any file. Returns true otherwise. 38 | */ 39 | template <typename FileProcessor> 40 | bool iterateDirectory(const std::string& dirPath, 41 | FileProcessor& fileProcessor, 42 | bool isRecursive, 43 | std::string& errMsg); 44 | 45 | /** 46 | * Attempts to compile the MSL source code and returns whether it was successful. 47 | * 48 | * If unsuccessful, the return value will be false and the errMsg will contain an 49 | * error message. Otherwise the return value will be true and the errMsg will be empty. 50 | */ 51 | bool compile(const std::string& mslSourceCode, 52 | std::string& errMsg, 53 | uint32_t mslVersionMajor, 54 | uint32_t mslVersionMinor = 0, 55 | uint32_t mslVersionPoint = 0); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/MoltenVKShaderConverterTool/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main.cpp 3 | * 4 | * Copyright (c) 2015-2025 The Brenwill Workshop Ltd. (http://www.brenwill.com) 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "MoltenVKShaderConverterTool.h" 20 | 21 | using namespace mvk; 22 | 23 | 24 | int main(int argc, const char * argv[]) { 25 | MoltenVKShaderConverterTool converter(argc, argv); 26 | return converter.run(); 27 | } 28 | -------------------------------------------------------------------------------- /MoltenVKShaderConverter/SPIRV-Cross: -------------------------------------------------------------------------------- 1 | ../External/SPIRV-Cross -------------------------------------------------------------------------------- /MoltenVKShaderConverter/SPIRV-Tools: -------------------------------------------------------------------------------- 1 | ../External/SPIRV-Tools -------------------------------------------------------------------------------- /MoltenVKShaderConverter/Tools: -------------------------------------------------------------------------------- 1 | ../Package/Latest/MoltenVKShaderConverter/Tools -------------------------------------------------------------------------------- /MoltenVKShaderConverter/include/MoltenVKShaderConverter/SPIRVConversion.h: -------------------------------------------------------------------------------- 1 | ../../MoltenVKShaderConverter/SPIRVConversion.h -------------------------------------------------------------------------------- /MoltenVKShaderConverter/include/MoltenVKShaderConverter/SPIRVToMSLConverter.h: -------------------------------------------------------------------------------- 1 | ../../MoltenVKShaderConverter/SPIRVToMSLConverter.h -------------------------------------------------------------------------------- /Scripts/clean_dynamic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Delete the dynamic components, to force them to be rebuilt. 4 | # This, combined with forcing the Scheme to run sequentially, and building 5 | # the dynamic framework before the dylib, avoids a problem where the dynamic 6 | # components contain no static content after an incremental build. 7 | 8 | rm -rf "${BUILT_PRODUCTS_DIR}/MoltenVK.framework" 9 | rm -rf "${BUILT_PRODUCTS_DIR}/libMoltenVK.dylib" 10 | -------------------------------------------------------------------------------- /Scripts/copy_ext_lib_to_staging.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . "${SRCROOT}/Scripts/copy_lib_to_staging.sh" "lib${PRODUCT_NAME}.a" "${PROJECT_DIR}/External/build/Intermediates" 4 | -------------------------------------------------------------------------------- /Scripts/copy_lib_to_staging.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copy the static library file to its own directory within the XCFrameworkStaging directory. 4 | # and mark the XCFrameworkStaging directory as changed, to trigger packaging dependencies. 5 | # 6 | # Takes 2 parameters: 7 | # 1 - prod_file_name 8 | # 2 - xcfwk_dst_dir, destiation directory in which to create XCFramework 9 | 10 | prod_file_name=${1} 11 | xcfwk_dst_dir=${2} 12 | built_prod_file="${BUILT_PRODUCTS_DIR}/${prod_file_name}" 13 | staging_dir="${xcfwk_dst_dir}/XCFrameworkStaging/${CONFIGURATION}/Platform${EFFECTIVE_PLATFORM_NAME}" 14 | 15 | mkdir -p "${staging_dir}" 16 | cp -a "${built_prod_file}" "${staging_dir}/" 17 | touch "${staging_dir}/.." 18 | -------------------------------------------------------------------------------- /Scripts/copy_to_staging.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copy the static library file to its own directory within the XCFrameworkStaging directory. 4 | # and mark the XCFrameworkStaging directory as changed, to trigger packaging dependencies. 5 | # 6 | # Takes 1 parameter: 7 | # 1 - prod_file_name 8 | 9 | prod_file_name=${1} 10 | . "${SRCROOT}/../Scripts/copy_lib_to_staging.sh" ${prod_file_name} "${BUILD_DIR}" 11 | -------------------------------------------------------------------------------- /Scripts/create_dylib_xros.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export MVK_UX_FWK="UIKit" 6 | export MVK_MIN_OS_VERSION=${XROS_DEPLOYMENT_TARGET} 7 | export MVK_CLANG_OS_MIN_VERSION="" #"-mxros-version-min=${MVK_MIN_OS_VERSION}" 8 | export MVK_IOSURFACE_FWK="-framework IOSurface" 9 | export MVK_IOKIT_FWK="-framework IOKit" 10 | 11 | . "${SRCROOT}/../Scripts/create_dylib.sh" 12 | -------------------------------------------------------------------------------- /Scripts/create_ext_lib_xcframeworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "${SKIP_PACKAGING}" = "Y" ]; then exit 0; fi 4 | 5 | . "${PROJECT_DIR}/Scripts/create_xcframework_func.sh" 6 | 7 | export MVK_EXT_DIR="${PROJECT_DIR}/External" 8 | export MVK_XCFWK_STAGING_DIR="${MVK_EXT_DIR}/build/Intermediates/XCFrameworkStaging" 9 | export MVK_XCFWK_DEST_DIR="${MVK_EXT_DIR}/build/${CONFIGURATION}" 10 | 11 | # Assemble the headers for the external libraries 12 | abs_ext_dir=`cd "${MVK_EXT_DIR}"; pwd; cd - > /dev/null` 13 | hdr_dir="${MVK_XCFWK_STAGING_DIR}/Headers" 14 | rm -rf "${hdr_dir}" 15 | mkdir -p "${hdr_dir}" 16 | ln -sfn "${abs_ext_dir}/SPIRV-Cross" "${hdr_dir}/SPIRVCross" 17 | ln -sfn "${abs_ext_dir}/SPIRVTools" "${hdr_dir}/SPIRVTools" 18 | 19 | create_xcframework "SPIRVCross" "library" 20 | create_xcframework "SPIRVTools" "library" 21 | -------------------------------------------------------------------------------- /Scripts/create_xcframework_func.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Creates a universal XCFramework for a product from any libraries that can be found for the product. 4 | # 5 | # Takes 2 parameters: 6 | # 1 - product_name 7 | # 2 - lib_type (either "library" or "framework") 8 | # 9 | # Requires the variables MVK_XCFWK_STAGING_DIR and MVK_XCFWK_DEST_DIR. 10 | 11 | function create_xcframework() { 12 | prod_name=${1} 13 | lib_type=${2} 14 | has_content="" 15 | 16 | prod_file="lib${prod_name}.a" 17 | if [[ "${lib_type}" == "framework" ]]; then 18 | prod_file="${prod_name}.framework" 19 | fi 20 | 21 | xcfwk_path="${MVK_XCFWK_DEST_DIR}/${prod_name}.xcframework" 22 | hdr_path="${MVK_XCFWK_STAGING_DIR}/Headers/${prod_name}" 23 | 24 | xcfwk_cmd="xcodebuild -quiet -create-xcframework -output \"${xcfwk_path}\"" 25 | 26 | # For each platform directory in the staging directory, add the library to the 27 | # XCFramework if it exists, and for each library, add headers if they exist. 28 | for prod_staging_dir in "${MVK_XCFWK_STAGING_DIR}/${CONFIGURATION}"/*; do 29 | prod_lib_path="${prod_staging_dir}/${prod_file}" 30 | if [[ -e "${prod_lib_path}" ]]; then 31 | xcfwk_cmd+=" -${lib_type} \"${prod_lib_path}\"" 32 | # if [[ -e "${hdr_path}" ]]; then 33 | # xcfwk_cmd+=" -headers \"${hdr_path}\"" # Headers currently break build due to Xcode 12 ProcessXCFramework bug: https://developer.apple.com/forums/thread/651043?answerId=628400022#628400022 34 | # fi 35 | has_content="Y" 36 | fi 37 | done 38 | 39 | if [ "$has_content" != "" ]; then 40 | mkdir -p "${MVK_XCFWK_DEST_DIR}" 41 | rm -rf "${xcfwk_path}" 42 | eval "${xcfwk_cmd}" 43 | fi 44 | } 45 | -------------------------------------------------------------------------------- /Scripts/gen_moltenvk_rev_hdr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Record the MoltenVK GIT revision as a derived header file suitable for including in a build 4 | MVK_GIT_REV=$(git rev-parse HEAD) 5 | MVK_HDR_FILE="${BUILT_PRODUCTS_DIR}/mvkGitRevDerived.h" 6 | echo "// Auto-generated by MoltenVK" > "${MVK_HDR_FILE}" 7 | echo "static const char* mvkRevString = \"${MVK_GIT_REV}\";" >> "${MVK_HDR_FILE}" 8 | 9 | -------------------------------------------------------------------------------- /Scripts/get_failing_cts_tests.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | def getArguments(): 4 | parser = argparse.ArgumentParser(description="Retrieve failing tests from CTS output file") 5 | parser.add_argument("inputFile", help="Input file") 6 | parser.add_argument("-o", "--output", dest="outputFile", default="failingTests.txt", type=str, required=False, help="Output file to store failing tests") 7 | parser.add_argument('-q', action='store_true') 8 | return parser.parse_args() 9 | 10 | if __name__ == "__main__": 11 | args = getArguments() 12 | 13 | with open(args.inputFile, "r") as inputFile: 14 | with open(args.outputFile, "w") as outputFile: 15 | if not args.q: 16 | print("Reading file " + args.inputFile + " for test failures") 17 | 18 | testName = "" 19 | for line in inputFile: 20 | # Empty lines means we have changed test 21 | if line == "\n": 22 | testName = "" 23 | continue 24 | 25 | # Assuming lines with test names are formatted like: "Test case 'dEQP-VK.test.name'.." 26 | if "Test case" in line: 27 | testName = line[11:-4] 28 | continue 29 | 30 | # Failed tests will have a line after the test that should be like: "Fail (sometimes the reason here)" 31 | if testName != "" and "Fail" in line: 32 | outputFile.writelines(testName + "\n") 33 | 34 | if not args.q: 35 | print("Failures written to " + args.outputFile) 36 | pass 37 | -------------------------------------------------------------------------------- /Scripts/packagePregenSpirvToolsHeaders: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2016-2022 The Brenwill Workshop Ltd. 4 | # 5 | # packagePregenSpirvToolsHeaders - Packages Spirv-Tools headers to simplify building SPIRV-Tools. 6 | # 7 | # macOS usage: ./packagePregenSpirvToolsHeaders 8 | # 9 | 10 | set -e 11 | 12 | EXT_DIR=../External 13 | SPV_TLS_BLD_DIR="${EXT_DIR}/SPIRV-Tools/build" 14 | TPLT_DIR=../Templates/spirv-tools 15 | TPLT_BLD_DIR="${TPLT_DIR}/build" 16 | 17 | # Ensure the SPIRV-Tools library is fully built 18 | cd ".." 19 | ./fetchDependencies --build-spirv-tools --none 20 | cd - > /dev/null 21 | 22 | echo Updating SPIRV-Tools template build directory 23 | rm -rf "${TPLT_BLD_DIR}" 24 | mkdir -p "${TPLT_BLD_DIR}" 25 | cp -a "${SPV_TLS_BLD_DIR}/"*.h "${SPV_TLS_BLD_DIR}/"*.inc "${TPLT_BLD_DIR}" 26 | 27 | echo Creating pregenerated SPIRV-Tools build.zip package 28 | cd "${TPLT_DIR}" 29 | rm -f build.zip 30 | zip -qr build.zip build 31 | rm -rf build/ 32 | cd - > /dev/null 33 | 34 | -------------------------------------------------------------------------------- /Scripts/package_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . "${SRCROOT}/Scripts/package_moltenvk_xcframework.sh" 4 | . "${SRCROOT}/Scripts/package_shader_converter_xcframework.sh" 5 | . "${SRCROOT}/Scripts/package_dylibs.sh" 6 | . "${SRCROOT}/Scripts/package_headers.sh" 7 | . "${SRCROOT}/Scripts/package_docs.sh" 8 | . "${SRCROOT}/Scripts/package_update_latest.sh" 9 | 10 | -------------------------------------------------------------------------------- /Scripts/package_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Package folder 6 | export MVK_PKG_CONFIG_PATH="${PROJECT_DIR}/Package/${CONFIGURATION}" 7 | 8 | # Copy the docs. 9 | cp -a "${PROJECT_DIR}/Docs" "${MVK_PKG_CONFIG_PATH}" 10 | cp -a "${PROJECT_DIR}/LICENSE" "${MVK_PKG_CONFIG_PATH}" 11 | -------------------------------------------------------------------------------- /Scripts/package_dylibs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Copy dylibs only if the source file exists. 6 | # 7 | # Takes 2 parameters: 8 | # 1 - source build path OS suffix (aka EFFECTIVE_PLATFORM_NAME during build) 9 | # 2 - destination path OS directory name 10 | 11 | function copy_dylib() { 12 | file_name="lib${mvk_prod_name}.dylib" 13 | src_dir="${BUILT_PRODUCTS_DIR}" 14 | src_file="${src_dir}/${file_name}" 15 | dst_dir="${mvk_pkg_prod_path}/dynamic/dylib/${2}" 16 | 17 | # If dylib file exists, copy it, any debug symbol file, and the Vulkan layer JSON file 18 | if [[ -e "${src_file}" ]]; then 19 | rm -rf "${dst_dir}" 20 | mkdir -p "${dst_dir}" 21 | 22 | cp -p "${src_file}" "${dst_dir}/" 23 | 24 | src_file+=".dSYM" 25 | if [[ -e "${src_file}" ]]; then 26 | cp -a "${src_file}" "${dst_dir}/" 27 | fi 28 | 29 | cp -a "${mvk_prod_proj_path}/icd/${mvk_prod_name}_icd.json" "${dst_dir}" 30 | fi 31 | } 32 | 33 | mvk_prod_name="MoltenVK" 34 | mvk_prod_proj_path="${PROJECT_DIR}/${mvk_prod_name}" 35 | mvk_pkg_prod_path="${PROJECT_DIR}/Package/${CONFIGURATION}/${mvk_prod_name}" 36 | 37 | # Make sure directory is there 38 | mkdir -p "${mvk_pkg_prod_path}" 39 | 40 | # App store distribution does not support naked dylibs, so only include a naked dylib for macOS. 41 | copy_dylib "" "macOS" 42 | #copy_dylib "-iphoneos" "iOS" 43 | #copy_dylib "-iphonesimulator" "iOS-simulator" 44 | #copy_dylib "-appletvos" "tvOS" 45 | #copy_dylib "-appletvsimulator" "tvOS-simulator" 46 | #copy_dylib "-xrvos" "xrOS" 47 | #copy_dylib "-xrsimulator" "xrOS-simulator" 48 | 49 | # For legacy support, symlink old dylib location to new location 50 | ln -sfn "dynamic/dylib" "${mvk_pkg_prod_path}/dylib" 51 | 52 | -------------------------------------------------------------------------------- /Scripts/package_ext_libs_finish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "${SKIP_PACKAGING}" = "Y" ]; then exit 0; fi 4 | 5 | set -e 6 | 7 | export MVK_EXT_LIB_DST_PATH="${PROJECT_DIR}/External/build/" 8 | 9 | # Assign symlink to Latest 10 | ln -sfn "${CONFIGURATION}" "${MVK_EXT_LIB_DST_PATH}/Latest" 11 | 12 | # Remove the large Intermediates directory if no longer needed 13 | if [ "${KEEP_CACHE}" != "Y" ]; then 14 | echo Removing Intermediates library at "${MVK_EXT_LIB_DST_PATH}/Intermediates" 15 | rm -rf "${MVK_EXT_LIB_DST_PATH}/Intermediates" 16 | fi 17 | 18 | # Clean MoltenVK to ensure the next MoltenVK build will use the latest external library versions. 19 | make --quiet clean 20 | 21 | -------------------------------------------------------------------------------- /Scripts/package_headers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | mvk_prod_name="MoltenVK" 6 | mvk_prod_proj_path="${PROJECT_DIR}/${mvk_prod_name}" 7 | mvk_pkg_prod_path="${PROJECT_DIR}/Package/${CONFIGURATION}/${mvk_prod_name}" 8 | 9 | # Make sure directory is there in case no dylibs are created for this platform 10 | mkdir -p "${mvk_pkg_prod_path}" 11 | 12 | # Remove and replace header include folder 13 | rm -rf "${mvk_pkg_prod_path}/include" 14 | cp -pRL "${mvk_prod_proj_path}/include" "${mvk_pkg_prod_path}/" 15 | -------------------------------------------------------------------------------- /Scripts/package_moltenvk_xcframework.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | . "${PROJECT_DIR}/Scripts/create_xcframework_func.sh" 6 | 7 | prod_name="MoltenVK" 8 | export MVK_XCFWK_STAGING_DIR="${BUILD_DIR}/XCFrameworkStaging" 9 | 10 | # Assemble the headers 11 | hdr_dir="${MVK_XCFWK_STAGING_DIR}/Headers" 12 | mkdir -p "${hdr_dir}" 13 | rm -rf "${hdr_dir}/${prod_name}" 14 | cp -pRL "${PROJECT_DIR}/${prod_name}/include/${prod_name}" "${hdr_dir}" 15 | 16 | export MVK_XCFWK_DEST_DIR="${PROJECT_DIR}/Package/${CONFIGURATION}/${prod_name}/static" 17 | create_xcframework "${prod_name}" "library" 18 | 19 | export MVK_XCFWK_DEST_DIR="${PROJECT_DIR}/Package/${CONFIGURATION}/${prod_name}/dynamic" 20 | create_xcframework "${prod_name}" "framework" 21 | -------------------------------------------------------------------------------- /Scripts/package_shader_converter_tool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export MVK_PROD_NAME="MoltenVKShaderConverter" 6 | export MVK_PKG_PROD_PATH_OS="${PROJECT_DIR}/Package/${CONFIGURATION}/${MVK_PROD_NAME}/Tools" 7 | export MVK_BUILT_PROD_DIR="${BUILT_PRODUCTS_DIR}" 8 | 9 | rm -rf "${MVK_PKG_PROD_PATH_OS}" 10 | mkdir -p "${MVK_PKG_PROD_PATH_OS}" 11 | cp -a "${MVK_BUILT_PROD_DIR}/${MVK_PROD_NAME}" "${MVK_PKG_PROD_PATH_OS}" 12 | -------------------------------------------------------------------------------- /Scripts/package_shader_converter_xcframework.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | . "${PROJECT_DIR}/Scripts/create_xcframework_func.sh" 6 | 7 | prod_name="MoltenVKShaderConverter" 8 | export MVK_XCFWK_STAGING_DIR="${BUILD_DIR}/XCFrameworkStaging" 9 | export MVK_XCFWK_DEST_DIR="${PROJECT_DIR}/Package/${CONFIGURATION}/${prod_name}" 10 | 11 | # Assemble the headers for the shader frameworks 12 | hdr_dir="${MVK_XCFWK_STAGING_DIR}/Headers" 13 | mkdir -p "${hdr_dir}" 14 | rm -rf "${hdr_dir}/${prod_name}" 15 | cp -pRL "${PROJECT_DIR}/${prod_name}/include/${prod_name}" "${hdr_dir}" 16 | 17 | # Also copy headers to an include directory in the package. 18 | # This will not be needed once the XCFramework can be created with a Headers directory. 19 | mkdir -p "${MVK_XCFWK_DEST_DIR}" 20 | cp -pRL "${PROJECT_DIR}/${prod_name}/include/" "${MVK_XCFWK_DEST_DIR}/include" 21 | 22 | create_xcframework "${prod_name}" "library" 23 | -------------------------------------------------------------------------------- /Scripts/package_update_latest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Package folder 6 | export MVK_PKG_PATH="${PROJECT_DIR}/Package" 7 | 8 | # Assign symlink to Latest 9 | ln -sfn "${CONFIGURATION}" "${MVK_PKG_PATH}/Latest" 10 | -------------------------------------------------------------------------------- /Templates/spirv-tools/build.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/MoltenVK/7cacb932bd771878d4d4a83a1f3593b5bfa6b95f/Templates/spirv-tools/build.zip --------------------------------------------------------------------------------