Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<PropertyGroup>
<VeldridSpirvVersion>1.0.14</VeldridSpirvVersion>
<NativeLibraryLoaderVersion>1.0.13</NativeLibraryLoaderVersion>
<VorticeWindowsVersion>2.4.2</VorticeWindowsVersion>
</PropertyGroup>

Expand All @@ -28,12 +27,6 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
<NerdbankGitVersioningVersion>3.4.255</NerdbankGitVersioningVersion>
Expand Down
1 change: 0 additions & 1 deletion src/Veldrid/GraphicsDevice.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Veldrid.D3D11;
using Veldrid.MTL;
Expand Down
10 changes: 5 additions & 5 deletions src/Veldrid/MTL/MTLGraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Runtime.InteropServices;
using System.Threading;
using Veldrid.MetalBindings;
using NativeLibrary = NativeLibraryLoader.NativeLibrary;

namespace Veldrid.MTL
{
Expand Down Expand Up @@ -57,7 +56,7 @@ private static readonly Dictionary<IntPtr, MtlGraphicsDevice> s_aot_registered_b
private const string unaligned_buffer_copy_pipeline_mac_os_name = "MTL_UnalignedBufferCopy_macOS";
private const string unaligned_buffer_copy_pipelinei_os_name = "MTL_UnalignedBufferCopy_iOS";
private readonly object unalignedBufferCopyPipelineLock = new object();
private readonly NativeLibrary libSystem;
private readonly IntPtr libSystem;

// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly IntPtr concreteGlobalBlock;
Expand Down Expand Up @@ -122,8 +121,8 @@ public MtlGraphicsDevice(

if (MetalFeatures.IsMacOS)
{
libSystem = new NativeLibrary("libSystem.dylib");
concreteGlobalBlock = libSystem.LoadFunction("_NSConcreteGlobalBlock");
libSystem = NativeLibrary.Load("libSystem.dylib");
concreteGlobalBlock = NativeLibrary.GetExport(libSystem, "_NSConcreteGlobalBlock");
completionHandler = OnCommandBufferCompleted;
displayLink = new MtlcvDisplayLink();
}
Expand Down Expand Up @@ -325,7 +324,8 @@ protected override void PlatformDispose()

lock (s_aot_registered_blocks) s_aot_registered_blocks.Remove(completionBlockLiteral);

libSystem?.Dispose();
NativeLibrary.Free(libSystem);

Marshal.FreeHGlobal(completionBlockDescriptor);
Marshal.FreeHGlobal(completionBlockLiteral);

Expand Down
7 changes: 3 additions & 4 deletions src/Veldrid/OpenGL/OpenGLGraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using static Veldrid.OpenGLBindings.OpenGLNative;
using static Veldrid.OpenGL.OpenGLUtil;
using static Veldrid.OpenGL.EGL.EglNative;
using NativeLibrary = NativeLibraryLoader.NativeLibrary;

namespace Veldrid.OpenGL
{
Expand Down Expand Up @@ -588,9 +587,9 @@ private void initializeUIView(GraphicsDeviceOptions options, IntPtr uIViewPtr)
eaglLayer.Frame = uiView.frame;
uiView.layer.addSublayer(eaglLayer.NativePtr);

var glesLibrary = new NativeLibrary("/System/Library/Frameworks/OpenGLES.framework/OpenGLES");
IntPtr glesLibrary = NativeLibrary.Load("/System/Library/Frameworks/OpenGLES.framework/OpenGLES");

Func<string, IntPtr> getProcAddress = name => glesLibrary.LoadFunction(name);
Func<string, IntPtr> getProcAddress = name => NativeLibrary.GetExport(glesLibrary, name);

LoadAllFunctions(eaglContext.NativePtr, getProcAddress, true);

Expand Down Expand Up @@ -728,7 +727,7 @@ private void initializeUIView(GraphicsDeviceOptions options, IntPtr uIViewPtr)
eaglLayer.RemoveFromSuperlayer();
eaglLayer.Release();
eaglContext.Release();
glesLibrary.Dispose();
NativeLibrary.Free(glesLibrary);
};

var platformInfo = new OpenGLPlatformInfo(
Expand Down
1 change: 0 additions & 1 deletion src/Veldrid/Veldrid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NativeLibraryLoader" Version="$(NativeLibraryLoaderVersion)"/>
<PackageReference Include="ppy.Vk" Version="1.0.26" Condition="'$(ExcludeVulkan)' != 'true'"/>
<PackageReference Include="Vortice.D3DCompiler" Version="$(VorticeWindowsVersion)"/>
<PackageReference Include="Vortice.Direct3D11" Version="$(VorticeWindowsVersion)"/>
Expand Down
Loading