diff --git a/Directory.Build.props b/Directory.Build.props index bd6065370..6a476e6d9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,6 @@ 1.0.14 - 1.0.13 2.4.2 @@ -28,12 +27,6 @@ true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - all - runtime; build; native; contentfiles; analyzers - - 3.4.255 diff --git a/src/Veldrid/GraphicsDevice.cs b/src/Veldrid/GraphicsDevice.cs index 68c02ceff..ee20164f8 100644 --- a/src/Veldrid/GraphicsDevice.cs +++ b/src/Veldrid/GraphicsDevice.cs @@ -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; diff --git a/src/Veldrid/MTL/MTLGraphicsDevice.cs b/src/Veldrid/MTL/MTLGraphicsDevice.cs index 88aed3dc1..88817ebfc 100644 --- a/src/Veldrid/MTL/MTLGraphicsDevice.cs +++ b/src/Veldrid/MTL/MTLGraphicsDevice.cs @@ -7,7 +7,6 @@ using System.Runtime.InteropServices; using System.Threading; using Veldrid.MetalBindings; -using NativeLibrary = NativeLibraryLoader.NativeLibrary; namespace Veldrid.MTL { @@ -57,7 +56,7 @@ private static readonly Dictionary 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; @@ -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(); } @@ -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); diff --git a/src/Veldrid/OpenGL/OpenGLGraphicsDevice.cs b/src/Veldrid/OpenGL/OpenGLGraphicsDevice.cs index 3539e8ec9..26637cc8d 100644 --- a/src/Veldrid/OpenGL/OpenGLGraphicsDevice.cs +++ b/src/Veldrid/OpenGL/OpenGLGraphicsDevice.cs @@ -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 { @@ -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 getProcAddress = name => glesLibrary.LoadFunction(name); + Func getProcAddress = name => NativeLibrary.GetExport(glesLibrary, name); LoadAllFunctions(eaglContext.NativePtr, getProcAddress, true); @@ -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( diff --git a/src/Veldrid/Veldrid.csproj b/src/Veldrid/Veldrid.csproj index a09d0bb1c..4f622afb4 100644 --- a/src/Veldrid/Veldrid.csproj +++ b/src/Veldrid/Veldrid.csproj @@ -17,7 +17,6 @@ -