Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MoltenVK #1623

Merged
merged 9 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Silk.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Shaderc", "src\SPI
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Shaderc.Native", "src\Native\Silk.NET.Shaderc.Native\Silk.NET.Shaderc.Native.csproj", "{D1E4EDC7-0A06-498A-B0F9-275B7D508A0E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.MoltenVK.Native", "src\Native\Silk.NET.MoltenVK.Native\Silk.NET.MoltenVK.Native.csproj", "{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -3615,6 +3617,18 @@ Global
{D1E4EDC7-0A06-498A-B0F9-275B7D508A0E}.Release|x64.Build.0 = Release|Any CPU
{D1E4EDC7-0A06-498A-B0F9-275B7D508A0E}.Release|x86.ActiveCfg = Release|Any CPU
{D1E4EDC7-0A06-498A-B0F9-275B7D508A0E}.Release|x86.Build.0 = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|x64.ActiveCfg = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|x64.Build.0 = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|x86.ActiveCfg = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Debug|x86.Build.0 = Debug|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|Any CPU.Build.0 = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|x64.ActiveCfg = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|x64.Build.0 = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|x86.ActiveCfg = Release|Any CPU
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -3904,6 +3918,7 @@ Global
{1E7C6166-58B2-46B3-A9BA-18099BD83AF0} = {20A4A2D1-D699-4D71-AA97-950154638576}
{E77BE8DB-3C74-42EB-9B65-67EAAA9AD7DB} = {15FC3D1A-25D7-446B-87A7-B45BA3C2225F}
{D1E4EDC7-0A06-498A-B0F9-275B7D508A0E} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4}
{32BE0963-C372-4BCA-A7C2-3CA844FDBB78} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F5273D7F-3334-48DF-94E3-41AE6816CD4D}
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Silk.NET.Core/Loader/LibraryLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ private class NetNextNativeLibraryLoader : LibraryLoader
{
protected override nint CoreLoadNativeLibrary(string name)
{
#if NET7_0_OR_GREATER
if (name == null)
Perksey marked this conversation as resolved.
Show resolved Hide resolved
Perksey marked this conversation as resolved.
Show resolved Hide resolved
return NativeLibrary3.GetMainProgramHandle();
#endif

if (NativeLibrary3.TryLoad(name, out var lib))
{
return lib;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Silk.NET.Core/Silk.NET.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>preview</LangVersion>
<SilkPublicApiExempt>true</SilkPublicApiExempt>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\build\props\common.props" />
Perksey marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>.NET Foundation and Contributors</Authors>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/dotnet/Silk.NET</PackageProjectUrl>
<Description>MoltenVK static library.</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/KhronosGroup/MoltenVK</RepositoryUrl>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeContentInPack>true</IncludeContentInPack>
</PropertyGroup>
<ItemGroup>
<Content Include="runtimes\MoltenVK.xcframework\ios-arm64\libMoltenVK.a" PackagePath="runtimes\MoltenVK.xcframework\ios-arm64\libMoltenVK.a" />
<Content Include="runtimes\MoltenVK.xcframework\ios-arm64_x86_64-simulator\libMoltenVK.a" PackagePath="runtimes\MoltenVK.xcframework\ios-arm64_x86_64-simulator\libMoltenVK.a" />
<Content Include="runtimes\MoltenVK.xcframework\ios-arm64_x86_64-maccatalyst\libMoltenVK.a" PackagePath="runtimes\MoltenVK.xcframework\ios-arm64_x86_64-maccatalyst\libMoltenVK.a" />
<Content Include="build\netstandard2.0\Silk.NET.MoltenVK.Native.targets" PackagePath="build\netstandard2.0\Silk.NET.MoltenVK.Native.targets" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project ToolsVersion="15.0">
<PropertyGroup>
<_LibMoltenVKPath Condition="'$(RuntimeIdentifier)' == 'maccatalyst-x64' OR '$(RuntimeIdentifier)' == 'maccatalyst-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\MoltenVK.xcframework\ios-arm64_x86_64-maccatalyst\libMoltenVK.a</_LibMoltenVKPath>
<_LibMoltenVKPath Condition="$(RuntimeIdentifier) == 'iossimulator-x64' OR '$(RuntimeIdentifier)' == 'iossimulator-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\MoltenVK.xcframework\ios-arm64_x86_64-simulator\libMoltenVK.a</_LibMoltenVKPath>
<_LibMoltenVKPath Condition="'$(RuntimeIdentifier)' == 'ios-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\MoltenVK.xcframework\ios-arm64\libMoltenVK.a</_LibMoltenVKPath>
Perksey marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
<NativeReference Include="$(_LibMoltenVKPath)" Condition="'$(_LibMoltenVKPath)' != ''">
<Kind>Static</Kind>
<Forceload>True</Forceload>
<IsCxx>True</IsCxx>
<SmartLink>False</SmartLink>
<LinkerFlags> -framework Metal -framework IOSurface -framework UIKit -framework QuartzCore -framework CoreGraphics -framework IOKit -framework Foundation </LinkerFlags>
</NativeReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_arm64e</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>arm64e</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libMoltenVK.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading