Skip to content

Commit 7d9d2b2

Browse files
committed
Update native meshoptimizer binaries to release [v0.22](https://github.com/zeux/meshoptimizer/releases/tag/v0.22) and C# bindings.
Add official .net9 support.
1 parent 6cd2bcb commit 7d9d2b2

22 files changed

+149
-72
lines changed

Alimer.Bindings.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
1313
.github\workflows\build.yml = .github\workflows\build.yml
1414
EndProjectSection
1515
EndProject
16-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{065268A8-16E6-4CFF-8F67-3FD99155877F}"
16+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{065268A8-16E6-4CFF-8F67-3FD99155877F}"
1717
ProjectSection(SolutionItems) = preProject
1818
.editorconfig = .editorconfig
1919
.gitignore = .gitignore

Directory.Build.props

+7-17
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
</PropertyGroup>
88

99
<PropertyGroup>
10-
<RepositoryUrl>https://github.com/amerkoleci/Alimer.Bindings.WebGPU</RepositoryUrl>
10+
<RepositoryUrl>https://github.com/amerkoleci/Alimer.Bindings</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
1212
</PropertyGroup>
1313

1414
<PropertyGroup>
1515
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
1616
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
17-
<LangVersion>12.0</LangVersion>
17+
<LangVersion>latest</LangVersion>
1818
<ImplicitUsings>enable</ImplicitUsings>
1919
<Nullable>enable</Nullable>
2020
<UseArtifactsOutput>true</UseArtifactsOutput>
@@ -23,32 +23,22 @@
2323
<Features>strict</Features>
2424
<AnalysisLevel>preview</AnalysisLevel>
2525
<RestoreConfigFile>$(MSBuildThisFileDirectory)NuGet.config</RestoreConfigFile>
26+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
27+
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsAotCompatible>
2628
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
2729
</PropertyGroup>
2830

29-
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
30-
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
31-
</PropertyGroup>
32-
3331
<PropertyGroup>
3432
<Authors>Amer Koleci</Authors>
33+
<Owners>Amer Koleci</Owners>
34+
<Company>Amer Koleci</Company>
3535
<Copyright>Copyright (c) Amer Koleci and Contributors</Copyright>
36-
<Product>Alimer.Bindings.WebGPU</Product>
36+
<Product>Alimer.Bindings</Product>
3737
<PackageLicenseExpression>MIT</PackageLicenseExpression>
3838
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
3939
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
4040
<ContinuousIntegrationBuild Condition="'$(GITHUB_RUN_ID)' != ''">true</ContinuousIntegrationBuild>
4141
<UseSharedCompilation>true</UseSharedCompilation>
42-
<PackageTags>webgpu game engine game-development gamedev</PackageTags>
43-
</PropertyGroup>
44-
45-
<!-- https://github.com/dotnet/sourcelink -->
46-
<PropertyGroup>
47-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
48-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
49-
<IncludeSymbols>false</IncludeSymbols>
50-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
51-
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
5242
</PropertyGroup>
5343

5444
</Project>

Directory.Build.targets

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<Project>
2+
<!-- Settings that are only set for executables -->
3+
<PropertyGroup Condition="'$(OutputType)' != 'Library' AND '$(UseWindowsForms)' != 'true' AND '$(UseWPF)' != 'true' AND '$(UseWinUI)' != 'true' ">
4+
<PublishTrimmed>true</PublishTrimmed>
5+
</PropertyGroup>
6+
27
<!-- Emit the [DisableRuntimeMarshalling] attribute for all .NET 8 projects -->
38
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
49
<AssemblyAttribute Include="System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute" />
510
</ItemGroup>
6-
7-
<!-- Settings that are only set for executables -->
8-
<PropertyGroup Condition="'$(OutputType)' != 'Library' AND '$(UseWindowsForms)' != 'true'">
9-
<PublishTrimmed>true</PublishTrimmed>
10-
</PropertyGroup>
1111

12-
<!-- Settings that are only set for libraries -->
13-
<PropertyGroup Condition="'$(OutputType)' == 'Library'">
14-
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
15-
</PropertyGroup>
12+
<!-- Emit the [ComVisible(false)] attribute for WinUI targets -->
13+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows'))">
14+
<AssemblyAttribute Include="System.Runtime.InteropServices.ComVisibleAttribute">
15+
<_Parameter1>false</_Parameter1>
16+
</AssemblyAttribute>
17+
</ItemGroup>
1618

1719
</Project>

Directory.Packages.props

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<!-- https://learn.microsoft.com/nuget/consume-packages/central-package-management -->
44
<ItemGroup>
55
<!-- Generator -->
6-
<PackageVersion Include="CppAst" Version="0.20.2" />
6+
<PackageVersion Include="CppAst" Version="0.21.1" />
77

88
<!-- Samples -->
9-
<PackageVersion Include="Alimer.Bindings.SDL" Version="3.8.0" />
9+
<PackageVersion Include="Alimer.Bindings.SDL" Version="3.9.6" />
1010

1111
<!-- Tests -->
12-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
13-
<PackageVersion Include="NUnit" Version="4.2.2" />
12+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
13+
<PackageVersion Include="NUnit" Version="4.3.2" />
1414
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
1515
</ItemGroup>
1616

NuGet.config

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<packageSourceMapping>
4-
<packageSource key="nuget">
5-
<package pattern="*" />
6-
</packageSource>
7-
</packageSourceMapping>
83
<packageSources>
94
<clear />
105
<add key="nuget" value="https://api.nuget.org/v3/index.json" />

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Collection of cross platform **.net9.0** and **.net8.0** bindings.
99

1010
| Library | Description | Status | NuGet |
1111
| ------- | ----------- | ------ |------ |
12-
| [wgpu](https://github.com/gfx-rs/wgpu-native) | wgpu bindings version [v22.1.0.3](https://github.com/gfx-rs/wgpu-native/releases/tag/v22.1.0.3.1) | Done ✔️ | [![NuGet](https://img.shields.io/nuget/v/Alimer.Bindings.WebGPU.svg)](https://www.nuget.org/packages/Alimer.Bindings.WebGPU)|
13-
| [meshoptimizer](https://github.com/zeux/meshoptimizer) | meshoptimizer bindings | Done ✔️ | [![NuGet](https://img.shields.io/nuget/v/Alimer.Bindings.MeshOptimizer.svg)](https://www.nuget.org/packages/Alimer.Bindings.MeshOptimizer)|
12+
| [wgpu](https://github.com/gfx-rs/wgpu-native) | wgpu bindings [v22.1.0.3](https://github.com/gfx-rs/wgpu-native/releases/tag/v22.1.0.3.1) | Done ✔️ | [![NuGet](https://img.shields.io/nuget/v/Alimer.Bindings.WebGPU.svg)](https://www.nuget.org/packages/Alimer.Bindings.WebGPU)|
13+
| [meshoptimizer](https://github.com/zeux/meshoptimizer) | meshoptimizer bindings [v0.22](https://github.com/zeux/meshoptimizer/releases/tag/v0.22) | Done ✔️ | [![NuGet](https://img.shields.io/nuget/v/Alimer.Bindings.MeshOptimizer.svg)](https://www.nuget.org/packages/Alimer.Bindings.MeshOptimizer)|
1414

1515
## Sponsors
1616
Please consider [SPONSOR](https://github.com/sponsors/amerkoleci) me to further help development and to allow faster issue triaging and new features to be implemented.

global.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
3-
"version": "9.0.100-preview",
4-
"allowPrerelease": true,
5-
"rollForward": "latestFeature"
3+
"version": "9.0.100",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": false
66
}
77
}
41.6 KB
Binary file not shown.
50.5 KB
Binary file not shown.
44.4 KB
Binary file not shown.

native/linux-x64/libmeshoptimizer.so

28.4 KB
Binary file not shown.

native/osx/libmeshoptimizer.dylib

384 Bytes
Binary file not shown.

native/win-arm64/meshoptimizer.dll

16.5 KB
Binary file not shown.

native/win-x64/meshoptimizer.dll

17 KB
Binary file not shown.

src/Alimer.Bindings.MeshOptimizer/Alimer.Bindings.MeshOptimizer.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
77
<PackageLicenseExpression></PackageLicenseExpression>
88
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
9-
<PackageTags>3D graphics meshoptimizer standard game gamedev</PackageTags>
109
<PackageReadmeFile>README.md</PackageReadmeFile>
10+
<PackageTags>compression gpu optimization simplification mesh-processing game engine game-development gamedev bindings</PackageTags>
1111
</PropertyGroup>
1212

1313
<!-- Version -->
1414
<PropertyGroup>
15-
<VersionPrefix>1.1.0</VersionPrefix>
15+
<VersionPrefix>1.1.1</VersionPrefix>
1616
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
1717
</PropertyGroup>
1818

src/Alimer.Bindings.MeshOptimizer/Generated/Commands.cs

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public unsafe partial class Meshopt
4040
[LibraryImport(LibraryName, EntryPoint = "meshopt_generateTessellationIndexBuffer")]
4141
public static partial void GenerateTessellationIndexBuffer(uint* destination, uint* indices, nuint index_count, float* vertex_positions, nuint vertex_count, nuint vertex_positions_stride);
4242

43+
[LibraryImport(LibraryName, EntryPoint = "meshopt_generateProvokingIndexBuffer")]
44+
public static partial nuint GenerateProvokingIndexBuffer(uint* destination, uint* reorder, uint* indices, nuint index_count, nuint vertex_count);
45+
4346
[LibraryImport(LibraryName, EntryPoint = "meshopt_optimizeVertexCache")]
4447
public static partial void OptimizeVertexCache(uint* destination, uint* indices, nuint index_count, nuint vertex_count);
4548

@@ -85,6 +88,9 @@ public unsafe partial class Meshopt
8588
[LibraryImport(LibraryName, EntryPoint = "meshopt_encodeVertexBufferBound")]
8689
public static partial nuint EncodeVertexBufferBound(nuint vertex_count, nuint vertex_size);
8790

91+
[LibraryImport(LibraryName, EntryPoint = "meshopt_encodeVertexBufferLevel")]
92+
public static partial nuint EncodeVertexBufferLevel(byte* buffer, nuint buffer_size, void* vertices, nuint vertex_count, nuint vertex_size, int level);
93+
8894
[LibraryImport(LibraryName, EntryPoint = "meshopt_encodeVertexVersion")]
8995
public static partial void EncodeVertexVersion(int version);
9096

src/Alimer.Bindings.MeshOptimizer/Generated/Constants.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ namespace MeshOptimizer;
1212
public static partial class Meshopt
1313
{
1414
/// <unmanaged>MESHOPTIMIZER_VERSION</unmanaged>
15-
public const uint MESHOPTIMIZER_VERSION = 210;
15+
public const uint MESHOPTIMIZER_VERSION = 220;
1616
}

src/Alimer.Bindings.MeshOptimizer/Generated/Enums.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ public enum EncodeExpMode
1616
EncodeExpSeparate = 0,
1717
EncodeExpSharedVector = 1,
1818
EncodeExpSharedComponent = 2,
19+
EncodeExpClamped = 3,
1920
}
2021

src/Alimer.Bindings.MeshOptimizer/Meshopt.cs

+22
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@ public static void GenerateTessellationIndexBuffer(
191191
GenerateTessellationIndexBuffer(destinationPtr, indicesPtr, (nuint)indices.Length, vertexPositionsPtr, (nuint)vertexPositions.Length, vertexPositionsStride);
192192
}
193193

194+
public static void GenerateProvokingIndexBuffer(
195+
Span<uint> destination,
196+
Span<uint> reorder,
197+
ReadOnlySpan<uint> indices,
198+
nuint vertexCount)
199+
{
200+
fixed (uint* destinationPtr = destination)
201+
fixed (uint* reorderPtr = reorder)
202+
fixed (uint* indicesPtr = indices)
203+
GenerateProvokingIndexBuffer(destinationPtr, reorderPtr, indicesPtr, (nuint)indices.Length, vertexCount);
204+
}
205+
194206
public static void OptimizeVertexCache(
195207
Span<uint> destination,
196208
ReadOnlySpan<uint> indices,
@@ -306,6 +318,16 @@ public static nuint EncodeVertexBuffer<TVertex>(
306318
return EncodeVertexBuffer(bufferPtr, (nuint)buffer.Length, verticesPtr, (nuint)vertices.Length, (nuint)sizeof(TVertex));
307319
}
308320

321+
public static nuint EncodeVertexBufferLevel<TVertex>(
322+
Span<byte> buffer,
323+
ReadOnlySpan<TVertex> vertices, int level)
324+
where TVertex : unmanaged
325+
{
326+
fixed (byte* bufferPtr = buffer)
327+
fixed (TVertex* verticesPtr = vertices)
328+
return EncodeVertexBufferLevel(bufferPtr, (nuint)buffer.Length, verticesPtr, (nuint)vertices.Length, (nuint)sizeof(TVertex), level);
329+
}
330+
309331
public static int DecodeVertexBuffer<TVertex>(
310332
Span<TVertex> destination,
311333
ReadOnlySpan<byte> buffer)

src/Alimer.Bindings.WebGPU/Alimer.Bindings.WebGPU.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<Description>WebGPU low level bindings.</Description>
66
<PackageTags>3D graphics vulkan standard game gamedev</PackageTags>
77
<PackageReadmeFile>README.md</PackageReadmeFile>
8+
<PackageTags>webgpu game engine game-development gamedev bindings</PackageTags>
89
</PropertyGroup>
910

1011
<!-- Version -->

src/Alimer.WebGPU.Native/Alimer.WebGPU.Native.csproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net4.6.1;net8.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net4.6.1;net8.0;net9.0</TargetFrameworks>
55
<Description>wgpu-native libraries</Description>
6-
<PackageVersion>1.0.1</PackageVersion>
6+
<PackageVersion>1.0.2</PackageVersion>
77
<IncludeBuildOutput>false</IncludeBuildOutput>
88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
99
<PackageLicenseExpression></PackageLicenseExpression>
1010
<PackageLicenseFile>LICENSE.MIT.txt</PackageLicenseFile>
1111
<RepositoryUrl>https://github.com/gfx-rs/wgpu-native</RepositoryUrl>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
13+
<PackageTags>webgpu game engine game-development gamedev bindings</PackageTags>
1314
<IncludeSymbols>false</IncludeSymbols>
1415
</PropertyGroup>
1516

@@ -22,6 +23,7 @@
2223
<ItemGroup>
2324
<Content Include="build\**" PackagePath="build/%(RecursiveDir)%(Filename)%(Extension)" />
2425
<Content Include="runtimes\**" PackagePath="runtimes/%(RecursiveDir)%(Filename)%(Extension)" />
26+
<Content Include="$(MSBuildThisFileDirectory)_._" PackagePath="lib/net9.0" />
2527
<Content Include="$(MSBuildThisFileDirectory)_._" PackagePath="lib/net8.0" />
2628
<Content Include="$(MSBuildThisFileDirectory)_._" PackagePath="lib/net461" />
2729
<Content Include="$(MSBuildThisFileDirectory)_._" PackagePath="lib/netstandard2.0" />

0 commit comments

Comments
 (0)