From 7b795a02e108ad272138a355557865238f0d2b26 Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Tue, 21 Apr 2015 16:08:20 +0200 Subject: [PATCH 01/37] Bugfix: Non-null shared contexts for Egl threw Exception The shared context parameter can be either the EglContext directly, or the facade, and we cast to see what it is. --- src/OpenTK/Platform/Egl/EglContext.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index b6cca8f9..2844686d 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -53,6 +53,8 @@ namespace OpenTK.Platform.Egl if (window == null) throw new ArgumentNullException("window"); + EglContext shared = GetSharedEglContext(sharedContext); + WindowInfo = window; // Select an EGLConfig that matches the desired mode. We cannot use the 'mode' @@ -216,6 +218,21 @@ namespace OpenTK.Platform.Egl } } + private EglContext GetSharedEglContext(IGraphicsContext sharedContext) + { + if (sharedContext == null) + { + return null; + } + + var internalContext = sharedContext as IGraphicsContextInternal; + if (internalContext != null) + { + return (EglContext) internalContext.Implementation; + } + return (EglContext) sharedContext; + } + #endregion } } From df66598182e4a24e4d9f68a6218dcd95e070d605 Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Tue, 21 Apr 2015 16:08:50 +0200 Subject: [PATCH 02/37] Added Angle-related enums and definitions + GraphicsContextFlags now has Angle and Offscreen flags. + Egl now has PLATFORM_ANGLE related const ints. + Added eglGetPlatformDisplayEXT p/invoke definition + Added eglQuerySurfacePointerANGLE p/invoke definition + EglWindowInfo.CreatePbufferSurface was commented out. Enabled and fixed it. + GraphicsContextFlags.Offscreen will make the context create a PbufferSurface instead of a WindowSurface in EglContext + SurfaceType enum to select surface type for SelectGraphicsMode --- Source/OpenTK/Platform/Egl/EglAngle.cs | 42 ++++++++++++++ src/OpenTK/Graphics/GraphicsContext.cs | 12 ++++ src/OpenTK/Graphics/GraphicsContextFlags.cs | 26 ++++++++- src/OpenTK/OpenTK.csproj | 1 + src/OpenTK/Platform/Egl/Egl.cs | 11 ++++ src/OpenTK/Platform/Egl/EglContext.cs | 41 +++++++++++--- src/OpenTK/Platform/Egl/EglGraphicsMode.cs | 17 +++++- src/OpenTK/Platform/Egl/EglWindowInfo.cs | 62 ++++++++++++++++++--- 8 files changed, 192 insertions(+), 20 deletions(-) create mode 100644 Source/OpenTK/Platform/Egl/EglAngle.cs diff --git a/Source/OpenTK/Platform/Egl/EglAngle.cs b/Source/OpenTK/Platform/Egl/EglAngle.cs new file mode 100644 index 00000000..9cf708e8 --- /dev/null +++ b/Source/OpenTK/Platform/Egl/EglAngle.cs @@ -0,0 +1,42 @@ +using System; +using System.Runtime.InteropServices; + +namespace OpenTK.Platform.Egl +{ + using EGLDisplay = IntPtr; + using EGLNativeDisplayType = IntPtr; + using EGLSurface = IntPtr; + using ShareHandle = IntPtr; + + static partial class Egl + { + // See + // - ANGLE_platform_angle + // - ANGLE_platform_angle_d3d + // - ANGLE_platform_angle_opengl + public const int PLATFORM_ANGLE = 0x3202; + public const int PLATFORM_ANGLE_TYPE = 0x3203; + public const int PLATFORM_ANGLE_MAX_VERSION_MAJOR = 0x3204; + public const int PLATFORM_ANGLE_MAX_VERSION_MINOR = 0x3205; + public const int PLATFORM_ANGLE_TYPE_DEFAULT = 0x3206; + public const int PLATFORM_ANGLE_TYPE_D3D9 = 0x3207; + public const int PLATFORM_ANGLE_TYPE_D3D11 = 0x3208; + public const int PLATFORM_ANGLE_DEVICE_TYPE = 0x3209; + public const int PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE = 0x320A; + public const int PLATFORM_ANGLE_DEVICE_TYPE_WARP = 0x320B; + public const int PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE = 0x320C; + public const int PLATFORM_ANGLE_TYPE_OPENGL = 0x320D; + public const int PLATFORM_ANGLE_TYPE_OPENGLES = 0x320E; + // See EGL_ANGLE_surface_d3d_texture_2d_share_handle + public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200; + + [DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")] + public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id, + int[] attrib_list); + + [DllImport("libEGL.dll", EntryPoint = "eglQuerySurfacePointerANGLE")] + public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface, + int attribute, out IntPtr value); + + } +} \ No newline at end of file diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index d12e360f..35a5d354 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -112,6 +112,18 @@ namespace OpenTK.Graphics if (minor < 0) minor = 0; + // Angle needs an embedded context + var use_angle_flag = GraphicsContextFlags.Angle + | GraphicsContextFlags.AngleD3D9 + | GraphicsContextFlags.AngleD3D11 + | GraphicsContextFlags.AngleOpenGL; + var use_angle = false; + if ((flags & use_angle_flag) != 0) + { + flags |= GraphicsContextFlags.Embedded; + use_angle = true; + } + Debug.Print("Creating GraphicsContext."); try { diff --git a/src/OpenTK/Graphics/GraphicsContextFlags.cs b/src/OpenTK/Graphics/GraphicsContextFlags.cs index a7ee2f59..a7df6e16 100644 --- a/src/OpenTK/Graphics/GraphicsContextFlags.cs +++ b/src/OpenTK/Graphics/GraphicsContextFlags.cs @@ -56,6 +56,30 @@ namespace OpenTK.Graphics /// /// Indicates that this GraphicsContext is targeting OpenGL|ES. /// - Embedded = 0x0004 + Embedded = 0x0004, + /// + /// Indicates that this GraphicsContext is intended for offscreen rendering. + /// + Offscreen = 0x0008, + /// + /// Indicates that this GraphicsContext is targeting OpenGL|ES via Angle + /// and that angle-specific extensions are available. + /// + Angle = 0x0010, + /// + /// Indicates that this GraphicsContext is targeting OpenGL|ES via Angle + /// and uses Direct3D9 as rendering backend. + /// + AngleD3D9 = 0x0020, + /// + /// Indicates that this GraphicsContext is targeting OpenGL|ES via Angle + /// and uses Direct3D11 as rendering backend. + /// + AngleD3D11 = 0x0040, + /// + /// Indicates that this GraphicsContext is targeting OpenGL|ES via Angle + /// and uses OpenGL as rendering backend. + /// + AngleOpenGL = 0x0080, } } diff --git a/src/OpenTK/OpenTK.csproj b/src/OpenTK/OpenTK.csproj index aaa09898..14760545 100644 --- a/src/OpenTK/OpenTK.csproj +++ b/src/OpenTK/OpenTK.csproj @@ -134,6 +134,7 @@ + diff --git a/src/OpenTK/Platform/Egl/Egl.cs b/src/OpenTK/Platform/Egl/Egl.cs index 118054d1..df395812 100644 --- a/src/OpenTK/Platform/Egl/Egl.cs +++ b/src/OpenTK/Platform/Egl/Egl.cs @@ -78,6 +78,17 @@ namespace OpenTK.Platform.Egl CONTEXT_LOST = 12302, } + enum SurfaceType + { + PBUFFER_BIT = 0x0001, + PIXMAP_BIT = 0x0002, + WINDOW_BIT = 0x0004, + VG_COLORSPACE_LINEAR_BIT = 0x0020, + VG_ALPHA_FORMAT_PRE_BIT = 0x0040, + MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200, + SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400, + } + static partial class Egl { public const int VERSION_1_0 = 1; diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index 2844686d..76992c92 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -28,6 +28,7 @@ using System; using System.Diagnostics; using OpenTK.Graphics; +using OpenTK.Graphics.ES20; namespace OpenTK.Platform.Egl { @@ -36,9 +37,11 @@ namespace OpenTK.Platform.Egl #region Fields protected readonly RenderableFlags Renderable; - protected EglWindowInfo WindowInfo; + internal EglWindowInfo WindowInfo; - IntPtr HandleAsEGLContext { get { return Handle.Handle; } set { Handle = new ContextHandle(value); } } + internal GraphicsContextFlags GraphicsContextFlags { get; set; } + + internal IntPtr HandleAsEGLContext { get { return Handle.Handle; } set { Handle = new ContextHandle(value); } } int swap_interval = 1; // Default interval is defined as 1 in EGL. #endregion @@ -85,19 +88,38 @@ namespace OpenTK.Platform.Egl Debug.Print("[EGL] Failed to bind rendering API. Error: {0}", Egl.GetError()); } - Mode = new EglGraphicsMode().SelectGraphicsMode(window, - mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, - mode.AccumulatorFormat, mode.Buffers, mode.Stereo, - Renderable); + bool offscreen = (flags & GraphicsContextFlags.Offscreen) != 0; + + SurfaceType surface_type = offscreen + ? SurfaceType.PBUFFER_BIT + : SurfaceType.WINDOW_BIT; + + Mode = new EglGraphicsMode().SelectGraphicsMode(surface_type, + window.Display, mode.ColorFormat, mode.Depth, mode.Stencil, + mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo, + Renderable); + if (!Mode.Index.HasValue) throw new GraphicsModeException("Invalid or unsupported GraphicsMode."); IntPtr config = Mode.Index.Value; if (window.Surface == IntPtr.Zero) - window.CreateWindowSurface(config); + { + if (!offscreen) + { + window.CreateWindowSurface(config); + } + else + { + window.CreatePbufferSurface(config); + } + } int[] attrib_list = new int[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE }; - HandleAsEGLContext = Egl.CreateContext(window.Display, config, sharedContext != null ? (sharedContext as IGraphicsContextInternal).Context.Handle : IntPtr.Zero, attrib_list); + var share_context = shared != null ? shared.HandleAsEGLContext : IntPtr.Zero; + HandleAsEGLContext = Egl.CreateContext(window.Display, config, share_context, attrib_list); + + GraphicsContextFlags = flags; } public EglContext(ContextHandle handle, EglWindowInfo window, IGraphicsContext sharedContext, @@ -133,6 +155,9 @@ namespace OpenTK.Platform.Egl { if (window is EglWindowInfo) WindowInfo = (EglWindowInfo) window; + else if (window is IAngleWindowInfoInternal) + WindowInfo = ((IAngleWindowInfoInternal) window).EglWindowInfo; + if (!Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext)) { throw new GraphicsContextException(string.Format("Failed to make context {0} current. Error: {1}", Handle, Egl.GetError())); diff --git a/src/OpenTK/Platform/Egl/EglGraphicsMode.cs b/src/OpenTK/Platform/Egl/EglGraphicsMode.cs index 779e8ff2..682caf3e 100644 --- a/src/OpenTK/Platform/Egl/EglGraphicsMode.cs +++ b/src/OpenTK/Platform/Egl/EglGraphicsMode.cs @@ -47,11 +47,23 @@ namespace OpenTK.Platform.Egl ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo, RenderableFlags renderable_flags) + { + return SelectGraphicsMode( + SurfaceType.WINDOW_BIT, + window.Display, + color, depth, stencil, samples, accum, buffers, stereo, renderable_flags + ); + } + + public GraphicsMode SelectGraphicsMode(SurfaceType surface_type, + IntPtr display, ColorFormat color, int depth, int stencil, + int samples, ColorFormat accum, int buffers, bool stereo, + RenderableFlags renderable_flags) { IntPtr[] configs = new IntPtr[1]; int[] attribList = new int[] { - Egl.SURFACE_TYPE, Egl.WINDOW_BIT, + Egl.SURFACE_TYPE, (int) surface_type, Egl.RENDERABLE_TYPE, (int)renderable_flags, Egl.RED_SIZE, color.Red, @@ -68,8 +80,6 @@ namespace OpenTK.Platform.Egl Egl.NONE, }; - IntPtr display = window.Display; - int num_configs; if (!Egl.ChooseConfig(display, attribList, configs, configs.Length, out num_configs) || num_configs == 0) { @@ -92,5 +102,6 @@ namespace OpenTK.Platform.Egl return new GraphicsMode(active_config, new ColorFormat(r, g, b, a), d, s, sample_buffers > 0 ? samples : 0, 0, 2, false); } + } } diff --git a/src/OpenTK/Platform/Egl/EglWindowInfo.cs b/src/OpenTK/Platform/Egl/EglWindowInfo.cs index 10f495be..db73aa3d 100644 --- a/src/OpenTK/Platform/Egl/EglWindowInfo.cs +++ b/src/OpenTK/Platform/Egl/EglWindowInfo.cs @@ -98,20 +98,66 @@ namespace OpenTK.Platform.Egl public void CreatePbufferSurface(IntPtr config) { - Surface = Egl.CreatePbufferSurface(Display, config, null); + int[] attribs = new int[]{Egl.NONE}; + Surface = Egl.CreatePbufferSurface(Display, config, attribs); + if (Surface == IntPtr.Zero) + { + throw new GraphicsContextException(String.Format( + "[EGL] Failed to create pbuffer surface, error {0}.", Egl.GetError())); + } + } + + public void CreatePbufferSurface(IntPtr config, int width, int height) + { + if (surface != IntPtr.Zero) + { + DestroySurface(); + } + CreatePbufferSurface(config, width, height, out surface); + } + + public void CreatePbufferSurface(IntPtr config, int width, int height, out IntPtr surface_) + { + int[] attribs = new int[] + { + Egl.WIDTH, width, + Egl.HEIGHT, height, + Egl.TEXTURE_TARGET, Egl.TEXTURE_2D, + Egl.TEXTURE_FORMAT, Egl.TEXTURE_RGBA, + Egl.NONE + }; + surface_ = Egl.CreatePbufferSurface(Display, config, attribs); + if (surface_ == IntPtr.Zero) + { + throw new GraphicsContextException(String.Format( + "[EGL] Failed to create pbuffer surface, error {0}.", Egl.GetError())); + } + } public void DestroySurface() { - if (Surface != IntPtr.Zero) - { - if (Egl.GetCurrentSurface(Egl.DRAW) == Surface) - Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + DestroySurface(ref surface); + } - if (!Egl.DestroySurface(Display, Surface)) - Debug.Print("[Warning] Failed to destroy {0}:{1}.", Surface.GetType().Name, Surface); - Surface = IntPtr.Zero; + public void DestroySurface(ref IntPtr surface_) + { + if (surface_ == IntPtr.Zero) + { + return; } + + if (Egl.GetCurrentSurface(Egl.DRAW) == Surface) + Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + + if (Egl.DestroySurface(Display, surface_)) + { + surface_ = IntPtr.Zero; + return; + } + + Debug.Print("[Warning] Failed to destroy {0}:{1}.", Surface.GetType().Name, Surface); + Surface = IntPtr.Zero; } public void TerminateDisplay() From 9d29c8c19bbfa6cc5231c7f82f1333f36b2724c9 Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Tue, 21 Apr 2015 16:09:29 +0200 Subject: [PATCH 03/37] Added AngleWindowInfo and AnglePlatformFactory Both WindowInfo and PlatformFactory wrap the actual platform-specific WindowInfo and PlatformFactory. For offscreen rendering, AngleWindowInfo can be used with a DummyWindowInfo. The API to add additional surfaces was added to IAngleWindowInfo, since all those calls need the Display parameter that is only available on EglWindowInfo (which is not exposed to users). --- Source/OpenTK/Platform/Egl/AngleWindowInfo.cs | 183 ++++++++++++++++++ .../Platform/Egl/EglAnglePlatformFactory.cs | 172 ++++++++++++++++ src/OpenTK/Graphics/GraphicsContext.cs | 8 +- src/OpenTK/OpenTK.csproj | 2 + src/OpenTK/Platform/Factory.cs | 11 +- src/OpenTK/Platform/Utilities.cs | 17 ++ 6 files changed, 390 insertions(+), 3 deletions(-) create mode 100644 Source/OpenTK/Platform/Egl/AngleWindowInfo.cs create mode 100644 Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs diff --git a/Source/OpenTK/Platform/Egl/AngleWindowInfo.cs b/Source/OpenTK/Platform/Egl/AngleWindowInfo.cs new file mode 100644 index 00000000..f062a2d4 --- /dev/null +++ b/Source/OpenTK/Platform/Egl/AngleWindowInfo.cs @@ -0,0 +1,183 @@ +using System; +using OpenTK.Graphics; +using OpenTK.Platform.Windows; + +namespace OpenTK.Platform.Egl +{ + using EGLSurface = IntPtr; + /// + /// A window info for angle. + /// + public interface IAngleWindowInfo : IWindowInfo + { + /// + /// Query the underlying platform pointer / handle for this window's + /// default surface or IntPtr.Zero + /// + IntPtr QuerySurfacePointer(); + /// + /// Create an additional rendering surface that shares the display + /// of this window. + /// + /// width in pixels + /// height in pixels + /// A reference to the new surface + EGLSurface CreateSurface(int width, int height); + /// + /// Destroy a surface created with CreateSurface and clears the passed reference. + /// + /// Reference to the surface. + void DestroySurface(ref EGLSurface surface); + /// + /// MakeCurrent the custom surface created with CreateSurface. + /// + /// Reference to the surface. + void MakeCurrent(EGLSurface surface); + /// + /// Query the underlying platform pointer / handle for an EGLSurface + /// created with CreateSurface. + /// + /// + IntPtr QuerySurfacePointer(EGLSurface surface); + } + + internal interface IAngleWindowInfoInternal : IAngleWindowInfo + { + IWindowInfo PlatformWindow { get; } + IntPtr Display { get; } + IntPtr Surface { get; } + EglContext EglContext { get; set; } + EglWindowInfo EglWindowInfo { get; set; } + IntPtr DeviceContext { get; } + } + + internal class AngleWindowInfo : IAngleWindowInfoInternal + { + private readonly IWindowInfo _platform_window; + private bool _disposed; + + public AngleWindowInfo(IWindowInfo platform_window) + { + _platform_window = platform_window; + } + + public IWindowInfo PlatformWindow + { + get { return _platform_window; } + } + + public IWindowInfo WindowInfo + { + get { return EglWindowInfo; } + } + + public IntPtr DeviceContext + { + get + { + var win_win = _platform_window as WinWindowInfo; + if (win_win != null) + { + return win_win.DeviceContext; + } + return IntPtr.Zero; + } + } + + public EglContext EglContext { get; set; } + public EglWindowInfo EglWindowInfo { get; set; } + + public IntPtr Display + { + get { return EglWindowInfo.Display; } + } + + public IntPtr Surface + { + get { return EglWindowInfo.Surface; } + } + + public void Dispose() + { + Dispose(false); + } + + public IntPtr Handle + { + get { return _platform_window.Handle; } + } + + ~AngleWindowInfo() + { + Dispose(true); + } + + private void Dispose(bool called_from_finalizer) + { + if (_disposed) + { + return; + } + if (!called_from_finalizer) + { + _platform_window.Dispose(); + } + // dispose unmanaged + + _disposed = true; + GC.SuppressFinalize(this); + } + + public IntPtr QuerySurfacePointer() + { + return QuerySurfacePointer(Surface); + } + + public EGLSurface CreateSurface(int width, int height) + { + IntPtr surface; + EglWindowInfo.CreatePbufferSurface( + EglContext.GraphicsMode.Index.Value, + width, height, + out surface); + return surface; + } + + public void DestroySurface(ref EGLSurface surface) + { + EglWindowInfo.DestroySurface(ref surface); + } + + public void MakeCurrent(EGLSurface surface) + { + Egl.MakeCurrent(Display, surface, surface, EglContext.HandleAsEGLContext); + } + + public IntPtr QuerySurfacePointer(IntPtr surface) + { + if (UsesDirect3DBackend()) + { + return QuerySurfacePointer(surface, + Egl.EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE); + } + return IntPtr.Zero; + } + + private IntPtr QuerySurfacePointer(IntPtr surface, int attrib) + { + IntPtr surface_pointer; + if (Egl.QuerySurfacePointerANGLE( + Display, surface, attrib, out surface_pointer)) + { + return surface_pointer; + } + return IntPtr.Zero; + } + + private bool UsesDirect3DBackend() + { + var d3d_flags = GraphicsContextFlags.AngleD3D9 | GraphicsContextFlags.AngleD3D11; + return ((EglContext.GraphicsContextFlags & d3d_flags) != 0); + } + } +} \ No newline at end of file diff --git a/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs b/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs new file mode 100644 index 00000000..6d5f694d --- /dev/null +++ b/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs @@ -0,0 +1,172 @@ +#region License + +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2015 the Open Toolkit library. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +#endregion + +using System; +using OpenTK.Graphics; +using OpenTK.Input; + +namespace OpenTK.Platform.Egl +{ + internal class EglAnglePlatformFactory : PlatformFactoryBase + { + private readonly IPlatformFactory _platform_factory; + #region Public Members + + public EglAnglePlatformFactory(IPlatformFactory platform_factory) + { + _platform_factory = platform_factory; + } + + public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, + GameWindowFlags options, DisplayDevice device) + { + return _platform_factory.CreateNativeWindow(x, y, width, height, title, + mode, options, device); + } + + public override IDisplayDeviceDriver CreateDisplayDeviceDriver() + { + return _platform_factory.CreateDisplayDeviceDriver(); + } + + public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, + IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) + { + var angle_window = (IAngleWindowInfoInternal) window; + var egl_window = CreateWindowInfo(angle_window, major, flags); + var egl_context = new EglWinContext(mode, egl_window, shareContext, major, minor, flags); + angle_window.EglContext = egl_context; + return egl_context; + } + + public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, + IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) + { + var angle_window = (IAngleWindowInfoInternal) window; + var egl_window = CreateWindowInfo(angle_window, major, flags); + var egl_context = new EglWinContext(handle, egl_window, shareContext, major, minor, flags); + angle_window.EglContext = egl_context; + return egl_context; + } + + public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext() + { + return (GraphicsContext.GetCurrentContextDelegate)delegate + { + return new ContextHandle(Platform.Egl.Egl.GetCurrentContext()); + }; + } + + public override IKeyboardDriver2 CreateKeyboardDriver() + { + return _platform_factory.CreateKeyboardDriver(); + } + + public override IMouseDriver2 CreateMouseDriver() + { + return _platform_factory.CreateMouseDriver(); + } + + public override IJoystickDriver2 CreateJoystickDriver() + { + return _platform_factory.CreateJoystickDriver(); + } + + #endregion + + #region Private Members + + private static bool FlagEnabled(GraphicsContextFlags flags, GraphicsContextFlags flag) + { + return (flags & flag) != 0; + } + + private EglWindowInfo CreateWindowInfo(IAngleWindowInfoInternal window_info, + int major, GraphicsContextFlags flags) + { + var egl_display = GetAngleDisplay(window_info.DeviceContext, flags, major); + var egl_window = new EglWindowInfo(window_info.Handle, egl_display); + window_info.EglWindowInfo = egl_window; + return egl_window; + } + + private IntPtr GetAngleDisplay(IntPtr dc, GraphicsContextFlags flags, int major) + { + // default to D3D9 for ES2, but use D3D11 for ES3 as required by Angle. + var platform_type = major == 2 + ? Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9 + : Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11; + if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D11)) + { + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11; + } + else if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D9)) + { + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9; + } + else if (FlagEnabled(flags, GraphicsContextFlags.AngleOpenGL)) + { + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL; + } + else + { + // make sure the correct flag is set. + switch (platform_type) + { + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9: + flags |= GraphicsContextFlags.AngleD3D9; + break; + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11: + flags |= GraphicsContextFlags.AngleD3D11; + break; + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL: + flags |= GraphicsContextFlags.AngleOpenGL; + break; + } + } + + var attribs = new[] + { + Platform.Egl.Egl.PLATFORM_ANGLE_TYPE, platform_type, + Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MAJOR, Platform.Egl.Egl.DONT_CARE, + Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MINOR, Platform.Egl.Egl.DONT_CARE, + Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE, Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE, + Platform.Egl.Egl.NONE + }; + + return Platform.Egl.Egl.GetPlatformDisplay( + Platform.Egl.Egl.PLATFORM_ANGLE, + dc, + attribs + ); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index 35a5d354..da3c9f6a 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -145,8 +145,12 @@ namespace OpenTK.Graphics IPlatformFactory factory = null; switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded) { - case false: factory = Factory.Default; break; - case true: factory = Factory.Embedded; break; + case false: + factory = Factory.Default; + break; + case true: + factory = use_angle ? Factory.Angle : Factory.Embedded; + break; } // Note: this approach does not allow us to mix native and EGL contexts in the same process. diff --git a/src/OpenTK/OpenTK.csproj b/src/OpenTK/OpenTK.csproj index 14760545..758e53a8 100644 --- a/src/OpenTK/OpenTK.csproj +++ b/src/OpenTK/OpenTK.csproj @@ -133,10 +133,12 @@ + + diff --git a/src/OpenTK/Platform/Factory.cs b/src/OpenTK/Platform/Factory.cs index 9e5eb668..35839e08 100644 --- a/src/OpenTK/Platform/Factory.cs +++ b/src/OpenTK/Platform/Factory.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; +using OpenTK.Platform.Egl; namespace OpenTK.Platform { @@ -40,7 +41,7 @@ namespace OpenTK.Platform #region Fields bool disposed; - static IPlatformFactory default_implementation, embedded_implementation; + static IPlatformFactory default_implementation, embedded_implementation, angle_implementation; #endregion @@ -102,11 +103,13 @@ namespace OpenTK.Platform else if (Configuration.RunningOnAndroid) Embedded = new Android.AndroidFactory(); #endif else Embedded = new UnsupportedPlatform(); + Angle = new EglAnglePlatformFactory(Embedded); } #endif else { Embedded = new UnsupportedPlatform(); + Angle = Embedded; } if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform)) @@ -129,6 +132,12 @@ namespace OpenTK.Platform private set { embedded_implementation = value; } } + public static IPlatformFactory Angle + { + get { return angle_implementation; } + private set { angle_implementation = value; } + } + #endregion #region IPlatformFactory Members diff --git a/src/OpenTK/Platform/Utilities.cs b/src/OpenTK/Platform/Utilities.cs index 2a531f62..6746b395 100644 --- a/src/OpenTK/Platform/Utilities.cs +++ b/src/OpenTK/Platform/Utilities.cs @@ -13,6 +13,7 @@ using System.Runtime.InteropServices; using System.Reflection; using System.Diagnostics; using OpenTK.Graphics; +using OpenTK.Platform.Egl; #endregion @@ -393,6 +394,22 @@ namespace OpenTK.Platform #endregion + #region + + /// + /// Creates an IWindowInfo instance for Angle rendering, based on + /// supplied platform window (e.g. a window created with + /// CreateWindowsWindowInfo, or CreateDummyWindowInfo). + /// + /// + /// + public static IAngleWindowInfo CreateAngleWindowInfo(IWindowInfo platform_window) + { + return new AngleWindowInfo(platform_window); + } + + #endregion + #endregion #region RelaxGraphicsMode From 84a210bda5e0eec8e52e0581d547789dcb5f0c7c Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Tue, 21 Apr 2015 16:09:48 +0200 Subject: [PATCH 04/37] Bugfix: Creating a second GraphicsContext forced context sharing. This fix will keep existing behavior (forced sharing) in the default case, but adds a new constructor that allows explicitly specifying the shared context. A user can now explicitly specify null for the shared context to get a new non-shared context. --- src/OpenTK/Graphics/GraphicsContext.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index da3c9f6a..62613c73 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -97,6 +97,23 @@ namespace OpenTK.Graphics /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored. /// public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags) + : this(mode, window, FindSharedContext(), major, minor, flags) + { + } + + /// + /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window. + /// + /// The OpenTK.Graphics.GraphicsMode of the GraphicsContext. + /// The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to. + /// The GraphicsContext to share resources with, or null for explicit non-sharing. + /// The major version of the new GraphicsContext. + /// The minor version of the new GraphicsContext. + /// The GraphicsContextFlags for the GraphicsContext. + /// + /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored. + /// + public GraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags) { lock (SyncRoot) { @@ -133,8 +150,6 @@ namespace OpenTK.Graphics Debug.Print("GraphicsContextFlags: {0}", flags); Debug.Print("Requested version: {0}.{1}", major, minor); - IGraphicsContext shareContext = FindSharedContext(); - // Todo: Add a DummyFactory implementing IPlatformFactory. if (designMode) { From fc332466001b40ff6e6aaf5137aaf5bb6b8295e6 Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Wed, 6 Jan 2016 15:29:34 +0100 Subject: [PATCH 05/37] Use existing ANGLE definitions --- Source/OpenTK/Platform/Egl/EglAngle.cs | 42 ------------------- .../Platform/Egl/EglAnglePlatformFactory.cs | 26 ++++++------ src/OpenTK/OpenTK.csproj | 1 - src/OpenTK/Platform/Egl/Egl.cs | 7 ++++ 4 files changed, 20 insertions(+), 56 deletions(-) delete mode 100644 Source/OpenTK/Platform/Egl/EglAngle.cs diff --git a/Source/OpenTK/Platform/Egl/EglAngle.cs b/Source/OpenTK/Platform/Egl/EglAngle.cs deleted file mode 100644 index 9cf708e8..00000000 --- a/Source/OpenTK/Platform/Egl/EglAngle.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenTK.Platform.Egl -{ - using EGLDisplay = IntPtr; - using EGLNativeDisplayType = IntPtr; - using EGLSurface = IntPtr; - using ShareHandle = IntPtr; - - static partial class Egl - { - // See - // - ANGLE_platform_angle - // - ANGLE_platform_angle_d3d - // - ANGLE_platform_angle_opengl - public const int PLATFORM_ANGLE = 0x3202; - public const int PLATFORM_ANGLE_TYPE = 0x3203; - public const int PLATFORM_ANGLE_MAX_VERSION_MAJOR = 0x3204; - public const int PLATFORM_ANGLE_MAX_VERSION_MINOR = 0x3205; - public const int PLATFORM_ANGLE_TYPE_DEFAULT = 0x3206; - public const int PLATFORM_ANGLE_TYPE_D3D9 = 0x3207; - public const int PLATFORM_ANGLE_TYPE_D3D11 = 0x3208; - public const int PLATFORM_ANGLE_DEVICE_TYPE = 0x3209; - public const int PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE = 0x320A; - public const int PLATFORM_ANGLE_DEVICE_TYPE_WARP = 0x320B; - public const int PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE = 0x320C; - public const int PLATFORM_ANGLE_TYPE_OPENGL = 0x320D; - public const int PLATFORM_ANGLE_TYPE_OPENGLES = 0x320E; - // See EGL_ANGLE_surface_d3d_texture_2d_share_handle - public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200; - - [DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")] - public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id, - int[] attrib_list); - - [DllImport("libEGL.dll", EntryPoint = "eglQuerySurfacePointerANGLE")] - public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface, - int attribute, out IntPtr value); - - } -} \ No newline at end of file diff --git a/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs b/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs index 6d5f694d..914e09c0 100644 --- a/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs +++ b/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs @@ -120,32 +120,32 @@ namespace OpenTK.Platform.Egl { // default to D3D9 for ES2, but use D3D11 for ES3 as required by Angle. var platform_type = major == 2 - ? Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9 - : Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11; + ? Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE + : Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE; if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D11)) { - platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11; + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE; } else if (FlagEnabled(flags, GraphicsContextFlags.AngleD3D9)) { - platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9; + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE; } else if (FlagEnabled(flags, GraphicsContextFlags.AngleOpenGL)) { - platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL; + platform_type = Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL_ANGLE; } else { // make sure the correct flag is set. switch (platform_type) { - case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9: + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D9_ANGLE: flags |= GraphicsContextFlags.AngleD3D9; break; - case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11: + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_D3D11_ANGLE: flags |= GraphicsContextFlags.AngleD3D11; break; - case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL: + case Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_OPENGL_ANGLE: flags |= GraphicsContextFlags.AngleOpenGL; break; } @@ -153,15 +153,15 @@ namespace OpenTK.Platform.Egl var attribs = new[] { - Platform.Egl.Egl.PLATFORM_ANGLE_TYPE, platform_type, - Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MAJOR, Platform.Egl.Egl.DONT_CARE, - Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MINOR, Platform.Egl.Egl.DONT_CARE, - Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE, Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE, + Platform.Egl.Egl.PLATFORM_ANGLE_TYPE_ANGLE, platform_type, + Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, Platform.Egl.Egl.DONT_CARE, + Platform.Egl.Egl.PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, Platform.Egl.Egl.DONT_CARE, + Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, Platform.Egl.Egl.PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE, Platform.Egl.Egl.NONE }; return Platform.Egl.Egl.GetPlatformDisplay( - Platform.Egl.Egl.PLATFORM_ANGLE, + Platform.Egl.Egl.PLATFORM_ANGLE_ANGLE, dc, attribs ); diff --git a/src/OpenTK/OpenTK.csproj b/src/OpenTK/OpenTK.csproj index 758e53a8..eed8fbfe 100644 --- a/src/OpenTK/OpenTK.csproj +++ b/src/OpenTK/OpenTK.csproj @@ -135,7 +135,6 @@ - diff --git a/src/OpenTK/Platform/Egl/Egl.cs b/src/OpenTK/Platform/Egl/Egl.cs index df395812..86b799c2 100644 --- a/src/OpenTK/Platform/Egl/Egl.cs +++ b/src/OpenTK/Platform/Egl/Egl.cs @@ -210,6 +210,11 @@ namespace OpenTK.Platform.Egl // EGL_ANGLE_query_surface_pointer [DllImport("libEGL.dll", EntryPoint = "eglQuerySurfacePointerANGLE")] public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface, int attribute, out IntPtr value); + + [DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")] + public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id, + int[] attrib_list); + // EGL_ANGLE_software_display public static readonly EGLNativeDisplayType SOFTWARE_DISPLAY_ANGLE = new EGLNativeDisplayType(-1); // EGL_ANGLE_direct3d_display @@ -235,6 +240,8 @@ namespace OpenTK.Platform.Egl // EGL_ANGLE_platform_angle_opengl public const int PLATFORM_ANGLE_TYPE_OPENGL_ANGLE = 0x320D; public const int PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE = 0x320E; + // See EGL_ANGLE_surface_d3d_texture_2d_share_handle + public const int EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE = 0x3200; [DllImportAttribute("libEGL.dll", EntryPoint = "eglGetError")] public static extern ErrorCode GetError(); From 8ffe3bc504a42eddbc748f8b816d0c2b9d050d1c Mon Sep 17 00:00:00 2001 From: Manuel Zanin Date: Tue, 29 Nov 2016 11:34:16 +0100 Subject: [PATCH 06/37] Moved AngleWindowInfo and EglAnglePlatformFactory under src --- {Source => src}/OpenTK/Platform/Egl/AngleWindowInfo.cs | 0 {Source => src}/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {Source => src}/OpenTK/Platform/Egl/AngleWindowInfo.cs (100%) rename {Source => src}/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs (100%) diff --git a/Source/OpenTK/Platform/Egl/AngleWindowInfo.cs b/src/OpenTK/Platform/Egl/AngleWindowInfo.cs similarity index 100% rename from Source/OpenTK/Platform/Egl/AngleWindowInfo.cs rename to src/OpenTK/Platform/Egl/AngleWindowInfo.cs diff --git a/Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs b/src/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs similarity index 100% rename from Source/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs rename to src/OpenTK/Platform/Egl/EglAnglePlatformFactory.cs From 69bd4420cb381213e82028814e3d21117b6c3b3c Mon Sep 17 00:00:00 2001 From: Sebastien Pellizzari Date: Tue, 14 Feb 2017 09:17:41 +0100 Subject: [PATCH 07/37] XInputGetStateEx obtained through ordinal --- src/OpenTK/Platform/Windows/XInputJoystick.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/OpenTK/Platform/Windows/XInputJoystick.cs b/src/OpenTK/Platform/Windows/XInputJoystick.cs index 6b718def..357bfd28 100644 --- a/src/OpenTK/Platform/Windows/XInputJoystick.cs +++ b/src/OpenTK/Platform/Windows/XInputJoystick.cs @@ -371,8 +371,8 @@ namespace OpenTK.Platform.Windows // Load the entry points we are interested in from that dll GetCapabilities = (XInputGetCapabilities)Load("XInputGetCapabilities", typeof(XInputGetCapabilities)); GetState = - // undocumented XInputGetStateEx with support for the "Guide" button (requires XINPUT_1_3+) - (XInputGetState)Load("XInputGetStateEx", typeof(XInputGetState)) ?? + // undocumented XInputGetStateEx (Ordinal 100) with support for the "Guide" button (requires XINPUT_1_3+) + (XInputGetState)Load(100, typeof(XInputGetState)) ?? // documented XInputGetState (no support for the "Guide" button) (XInputGetState)Load("XInputGetState", typeof(XInputGetState)); SetState = (XInputSetState)Load("XInputSetState", typeof(XInputSetState)); @@ -380,6 +380,14 @@ namespace OpenTK.Platform.Windows #region Private Members + Delegate Load(ushort ordinal, Type type) + { + IntPtr pfunc = Functions.GetProcAddress(dll, (IntPtr)ordinal); + if (pfunc != IntPtr.Zero) + return Marshal.GetDelegateForFunctionPointer(pfunc, type); + return null; + } + Delegate Load(string name, Type type) { IntPtr pfunc = Functions.GetProcAddress(dll, name); From 30752ed36d4c8dd8cf85817834565071568075bf Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Sat, 18 Mar 2017 14:06:27 +0100 Subject: [PATCH 08/37] ANGLE: keep the backbuffer size updated when the window resizes --- src/OpenTK/Platform/Egl/EglContext.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index b6cca8f9..c45ad7b4 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -171,6 +171,18 @@ namespace OpenTK.Platform.Egl } } + public override void Update(IWindowInfo window) + { + // ANGLE updates the width and height of the back buffer surfaces in the WaitClient function. + // So without this calling this function, the surface won't match the size of the window after it + // was resized. + // https://bugs.chromium.org/p/angleproject/issues/detail?id=1438 + if (!Egl.WaitClient()) + { + Debug.Print("[Warning] Egl.WaitClient() failed. Error: {0}", Egl.GetError()); + } + } + #endregion #region IGraphicsContextInternal Members From 89e792ee478ce977353386db0faaec439065f4bc Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Sun, 19 Mar 2017 15:28:26 +0100 Subject: [PATCH 09/37] be sure the current context is set before calling Egl.WaitClient() --- src/OpenTK/Platform/Egl/EglContext.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index c45ad7b4..9b1639e5 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -173,6 +173,7 @@ namespace OpenTK.Platform.Egl public override void Update(IWindowInfo window) { + MakeCurrent(window); // ANGLE updates the width and height of the back buffer surfaces in the WaitClient function. // So without this calling this function, the surface won't match the size of the window after it // was resized. From 2b15ae37005e64a254efe47d1d4a8a34a6e26b2b Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 19 Mar 2017 23:47:23 -0400 Subject: [PATCH 10/37] IOS- fixed crash on first tick FrameEventArgs throws an exception when setting the Time to a value <= 0. With that knowledge, both the Android and the IOS implementations had a bug when setting the time. On IOS, that bug would cause a crash on the first tick, as the first tick would always set to 0. On Android the bug was probably harmless but there was a redundant check there (and also removed the unneeded allocation that was there on every tick). --- src/OpenTK/Platform/Android/AndroidGameView.cs | 10 ++++------ src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/OpenTK/Platform/Android/AndroidGameView.cs b/src/OpenTK/Platform/Android/AndroidGameView.cs index 6d6d01e0..5cd78e00 100644 --- a/src/OpenTK/Platform/Android/AndroidGameView.cs +++ b/src/OpenTK/Platform/Android/AndroidGameView.cs @@ -493,8 +493,8 @@ namespace OpenTK.Platform.Android DateTime prevRenderTime; DateTime curUpdateTime; DateTime curRenderTime; - FrameEventArgs updateEventArgs; - FrameEventArgs renderEventArgs; + FrameEventArgs updateEventArgs = new FrameEventArgs(); + FrameEventArgs renderEventArgs = new FrameEventArgs(); // this method is called on the main thread if RenderOnUIThread is true void RunIteration (CancellationToken token) @@ -505,21 +505,19 @@ namespace OpenTK.Platform.Android if (!ReadyToRender) return; - updateEventArgs = new FrameEventArgs (); curUpdateTime = DateTime.Now; if (prevUpdateTime.Ticks != 0) { var t = (curUpdateTime - prevUpdateTime).TotalSeconds; - updateEventArgs.Time = t < 0 ? 0 : t; + updateEventArgs.Time = t; } UpdateFrameInternal (updateEventArgs); prevUpdateTime = curUpdateTime; - renderEventArgs = new FrameEventArgs (); curRenderTime = DateTime.Now; if (prevRenderTime.Ticks == 0) { var t = (curRenderTime - prevRenderTime).TotalSeconds; - renderEventArgs.Time = t < 0 ? 0 : t; + renderEventArgs.Time = t; } RenderFrameInternal (renderEventArgs); diff --git a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs index 201f2aac..8d4702ac 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs @@ -861,20 +861,20 @@ namespace OpenTK.Platform.iPhoneOS internal void RunIteration (NSTimer timer) { var curUpdateTime = stopwatch.Elapsed; - if (prevUpdateTime == TimeSpan.Zero) - prevUpdateTime = curUpdateTime; - var t = (curUpdateTime - prevUpdateTime).TotalSeconds; - updateEventArgs.Time = t; + if (prevUpdateTime.Ticks != 0) { + var t = (curUpdateTime - prevUpdateTime).TotalSeconds; + updateEventArgs.Time = t; + } OnUpdateFrame(updateEventArgs); prevUpdateTime = curUpdateTime; gl.BindFramebuffer(All.FramebufferOes, framebuffer); var curRenderTime = stopwatch.Elapsed; - if (prevRenderTime == TimeSpan.Zero) - prevRenderTime = curRenderTime; - t = (curRenderTime - prevRenderTime).TotalSeconds; - renderEventArgs.Time = t; + if (prevRenderTime.Ticks == 0) { + var t = (curRenderTime - prevRenderTime).TotalSeconds; + renderEventArgs.Time = t; + } OnRenderFrame(renderEventArgs); prevRenderTime = curRenderTime; } From 70ac147b5cf467c53d99cc646f7c3a1c213746a8 Mon Sep 17 00:00:00 2001 From: Manuel Zanin Date: Tue, 21 Mar 2017 10:21:22 +0100 Subject: [PATCH 11/37] Addressed comments --- src/OpenTK/Graphics/GraphicsContext.cs | 16 ++++----- src/OpenTK/Platform/Egl/Egl.cs | 3 +- src/OpenTK/Platform/Egl/EglContext.cs | 10 +++--- src/OpenTK/Platform/Egl/EglGraphicsMode.cs | 42 ++++++++++------------ src/OpenTK/Platform/Egl/EglWindowInfo.cs | 24 ++++++------- src/OpenTK/Platform/Factory.cs | 42 +++++++++++----------- src/OpenTK/Platform/Utilities.cs | 6 ++-- 7 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index 62613c73..a2104e36 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -130,15 +130,15 @@ namespace OpenTK.Graphics minor = 0; // Angle needs an embedded context - var use_angle_flag = GraphicsContextFlags.Angle - | GraphicsContextFlags.AngleD3D9 - | GraphicsContextFlags.AngleD3D11 - | GraphicsContextFlags.AngleOpenGL; - var use_angle = false; - if ((flags & use_angle_flag) != 0) + const GraphicsContextFlags useAngleFlag = GraphicsContextFlags.Angle + | GraphicsContextFlags.AngleD3D9 + | GraphicsContextFlags.AngleD3D11 + | GraphicsContextFlags.AngleOpenGL; + var useAngle = false; + if ((flags & useAngleFlag) != 0) { flags |= GraphicsContextFlags.Embedded; - use_angle = true; + useAngle = true; } Debug.Print("Creating GraphicsContext."); @@ -164,7 +164,7 @@ namespace OpenTK.Graphics factory = Factory.Default; break; case true: - factory = use_angle ? Factory.Angle : Factory.Embedded; + factory = useAngle ? Factory.Angle : Factory.Embedded; break; } diff --git a/src/OpenTK/Platform/Egl/Egl.cs b/src/OpenTK/Platform/Egl/Egl.cs index 86b799c2..8a23a006 100644 --- a/src/OpenTK/Platform/Egl/Egl.cs +++ b/src/OpenTK/Platform/Egl/Egl.cs @@ -212,8 +212,7 @@ namespace OpenTK.Platform.Egl public static extern bool QuerySurfacePointerANGLE(EGLDisplay display, EGLSurface surface, int attribute, out IntPtr value); [DllImport("libEGL.dll", EntryPoint = "eglGetPlatformDisplayEXT")] - public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType display_id, - int[] attrib_list); + public static extern EGLDisplay GetPlatformDisplay(int platform, EGLNativeDisplayType displayId, int[] attribList); // EGL_ANGLE_software_display public static readonly EGLNativeDisplayType SOFTWARE_DISPLAY_ANGLE = new EGLNativeDisplayType(-1); diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index 76992c92..1967f2dd 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -90,11 +90,11 @@ namespace OpenTK.Platform.Egl bool offscreen = (flags & GraphicsContextFlags.Offscreen) != 0; - SurfaceType surface_type = offscreen + SurfaceType surfaceType = offscreen ? SurfaceType.PBUFFER_BIT : SurfaceType.WINDOW_BIT; - Mode = new EglGraphicsMode().SelectGraphicsMode(surface_type, + Mode = new EglGraphicsMode().SelectGraphicsMode(surfaceType, window.Display, mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo, Renderable); @@ -115,9 +115,9 @@ namespace OpenTK.Platform.Egl } } - int[] attrib_list = new int[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE }; - var share_context = shared != null ? shared.HandleAsEGLContext : IntPtr.Zero; - HandleAsEGLContext = Egl.CreateContext(window.Display, config, share_context, attrib_list); + int[] attribList = { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE }; + var shareContext = shared?.HandleAsEGLContext ?? IntPtr.Zero; + HandleAsEGLContext = Egl.CreateContext(window.Display, config, shareContext, attribList); GraphicsContextFlags = flags; } diff --git a/src/OpenTK/Platform/Egl/EglGraphicsMode.cs b/src/OpenTK/Platform/Egl/EglGraphicsMode.cs index 682caf3e..8a5b7ea9 100644 --- a/src/OpenTK/Platform/Egl/EglGraphicsMode.cs +++ b/src/OpenTK/Platform/Egl/EglGraphicsMode.cs @@ -26,8 +26,6 @@ #endregion using System; -using System.Collections.Generic; -using System.Text; using OpenTK.Graphics; namespace OpenTK.Platform.Egl @@ -46,25 +44,24 @@ namespace OpenTK.Platform.Egl public GraphicsMode SelectGraphicsMode(EglWindowInfo window, ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo, - RenderableFlags renderable_flags) + RenderableFlags renderableFlags) { return SelectGraphicsMode( SurfaceType.WINDOW_BIT, window.Display, - color, depth, stencil, samples, accum, buffers, stereo, renderable_flags - ); + color, depth, stencil, samples, accum, buffers, stereo, renderableFlags); } - public GraphicsMode SelectGraphicsMode(SurfaceType surface_type, + public GraphicsMode SelectGraphicsMode(SurfaceType surfaceType, IntPtr display, ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo, - RenderableFlags renderable_flags) + RenderableFlags renderableFlags) { IntPtr[] configs = new IntPtr[1]; int[] attribList = new int[] { - Egl.SURFACE_TYPE, (int) surface_type, - Egl.RENDERABLE_TYPE, (int)renderable_flags, + Egl.SURFACE_TYPE, (int) surfaceType, + Egl.RENDERABLE_TYPE, (int)renderableFlags, Egl.RED_SIZE, color.Red, Egl.GREEN_SIZE, color.Green, @@ -80,28 +77,27 @@ namespace OpenTK.Platform.Egl Egl.NONE, }; - int num_configs; - if (!Egl.ChooseConfig(display, attribList, configs, configs.Length, out num_configs) || num_configs == 0) + int numConfigs; + if (!Egl.ChooseConfig(display, attribList, configs, configs.Length, out numConfigs) || numConfigs == 0) { throw new GraphicsModeException(String.Format("Failed to retrieve GraphicsMode, error {0}", Egl.GetError())); } // See what we really got - IntPtr active_config = configs[0]; + IntPtr activeConfig = configs[0]; int r, g, b, a; - Egl.GetConfigAttrib(display, active_config, Egl.RED_SIZE, out r); - Egl.GetConfigAttrib(display, active_config, Egl.GREEN_SIZE, out g); - Egl.GetConfigAttrib(display, active_config, Egl.BLUE_SIZE, out b); - Egl.GetConfigAttrib(display, active_config, Egl.ALPHA_SIZE, out a); + Egl.GetConfigAttrib(display, activeConfig, Egl.RED_SIZE, out r); + Egl.GetConfigAttrib(display, activeConfig, Egl.GREEN_SIZE, out g); + Egl.GetConfigAttrib(display, activeConfig, Egl.BLUE_SIZE, out b); + Egl.GetConfigAttrib(display, activeConfig, Egl.ALPHA_SIZE, out a); int d, s; - Egl.GetConfigAttrib(display, active_config, Egl.DEPTH_SIZE, out d); - Egl.GetConfigAttrib(display, active_config, Egl.STENCIL_SIZE, out s); - int sample_buffers; - Egl.GetConfigAttrib(display, active_config, Egl.SAMPLES, out sample_buffers); - Egl.GetConfigAttrib(display, active_config, Egl.SAMPLES, out samples); + Egl.GetConfigAttrib(display, activeConfig, Egl.DEPTH_SIZE, out d); + Egl.GetConfigAttrib(display, activeConfig, Egl.STENCIL_SIZE, out s); + int sampleBuffers; + Egl.GetConfigAttrib(display, activeConfig, Egl.SAMPLES, out sampleBuffers); + Egl.GetConfigAttrib(display, activeConfig, Egl.SAMPLES, out samples); - return new GraphicsMode(active_config, new ColorFormat(r, g, b, a), d, s, sample_buffers > 0 ? samples : 0, 0, 2, false); + return new GraphicsMode(activeConfig, new ColorFormat(r, g, b, a), d, s, sampleBuffers > 0 ? samples : 0, 0, 2, false); } - } } diff --git a/src/OpenTK/Platform/Egl/EglWindowInfo.cs b/src/OpenTK/Platform/Egl/EglWindowInfo.cs index db73aa3d..0f14dc74 100644 --- a/src/OpenTK/Platform/Egl/EglWindowInfo.cs +++ b/src/OpenTK/Platform/Egl/EglWindowInfo.cs @@ -64,8 +64,8 @@ namespace OpenTK.Platform.Egl Display = display; - int dummy_major, dummy_minor; - if (!Egl.Initialize(Display, out dummy_major, out dummy_minor)) + int dummyMajor, dummyMinor; + if (!Egl.Initialize(Display, out dummyMajor, out dummyMinor)) { throw new GraphicsContextException(String.Format("Failed to initialize EGL, error {0}.", Egl.GetError())); } @@ -116,7 +116,7 @@ namespace OpenTK.Platform.Egl CreatePbufferSurface(config, width, height, out surface); } - public void CreatePbufferSurface(IntPtr config, int width, int height, out IntPtr surface_) + public void CreatePbufferSurface(IntPtr config, int width, int height, out IntPtr bufferSurface) { int[] attribs = new int[] { @@ -126,13 +126,12 @@ namespace OpenTK.Platform.Egl Egl.TEXTURE_FORMAT, Egl.TEXTURE_RGBA, Egl.NONE }; - surface_ = Egl.CreatePbufferSurface(Display, config, attribs); - if (surface_ == IntPtr.Zero) + bufferSurface = Egl.CreatePbufferSurface(Display, config, attribs); + if (bufferSurface == IntPtr.Zero) { throw new GraphicsContextException(String.Format( "[EGL] Failed to create pbuffer surface, error {0}.", Egl.GetError())); } - } public void DestroySurface() @@ -140,19 +139,20 @@ namespace OpenTK.Platform.Egl DestroySurface(ref surface); } - public void DestroySurface(ref IntPtr surface_) + public void DestroySurface(ref IntPtr bufferSurface) { - if (surface_ == IntPtr.Zero) + if (bufferSurface == IntPtr.Zero) { return; } if (Egl.GetCurrentSurface(Egl.DRAW) == Surface) - Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); - - if (Egl.DestroySurface(Display, surface_)) { - surface_ = IntPtr.Zero; + Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + } + if (Egl.DestroySurface(Display, bufferSurface)) + { + bufferSurface = IntPtr.Zero; return; } diff --git a/src/OpenTK/Platform/Factory.cs b/src/OpenTK/Platform/Factory.cs index 35839e08..0117e6c8 100644 --- a/src/OpenTK/Platform/Factory.cs +++ b/src/OpenTK/Platform/Factory.cs @@ -26,9 +26,7 @@ #endregion using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Text; using OpenTK.Platform.Egl; namespace OpenTK.Platform @@ -40,8 +38,10 @@ namespace OpenTK.Platform { #region Fields - bool disposed; - static IPlatformFactory default_implementation, embedded_implementation, angle_implementation; + private bool disposed; + private static IPlatformFactory defaultImplementation; + private static IPlatformFactory embeddedImplementation; + private static IPlatformFactory angleImplementation; #endregion @@ -122,20 +122,20 @@ namespace OpenTK.Platform public static IPlatformFactory Default { - get { return default_implementation; } - private set { default_implementation = value; } + get { return defaultImplementation; } + private set { defaultImplementation = value; } } public static IPlatformFactory Embedded { - get { return embedded_implementation; } - private set { embedded_implementation = value; } + get { return embeddedImplementation; } + private set { embeddedImplementation = value; } } public static IPlatformFactory Angle { - get { return angle_implementation; } - private set { angle_implementation = value; } + get { return angleImplementation; } + private set { angleImplementation = value; } } #endregion @@ -145,60 +145,60 @@ namespace OpenTK.Platform public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device) { - return default_implementation.CreateNativeWindow(x, y, width, height, title, mode, options, device); + return defaultImplementation.CreateNativeWindow(x, y, width, height, title, mode, options, device); } public IDisplayDeviceDriver CreateDisplayDeviceDriver() { - return default_implementation.CreateDisplayDeviceDriver(); + return defaultImplementation.CreateDisplayDeviceDriver(); } public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - return default_implementation.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags); + return defaultImplementation.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags); } public IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - return default_implementation.CreateGLContext(handle, window, shareContext, directRendering, major, minor, flags); + return defaultImplementation.CreateGLContext(handle, window, shareContext, directRendering, major, minor, flags); } public GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext() { - return default_implementation.CreateGetCurrentGraphicsContext(); + return defaultImplementation.CreateGetCurrentGraphicsContext(); } public IKeyboardDriver2 CreateKeyboardDriver() { - return default_implementation.CreateKeyboardDriver(); + return defaultImplementation.CreateKeyboardDriver(); } public IMouseDriver2 CreateMouseDriver() { - return default_implementation.CreateMouseDriver(); + return defaultImplementation.CreateMouseDriver(); } public IGamePadDriver CreateGamePadDriver() { - return default_implementation.CreateGamePadDriver(); + return defaultImplementation.CreateGamePadDriver(); } public IJoystickDriver2 CreateJoystickDriver() { - return default_implementation.CreateJoystickDriver(); + return defaultImplementation.CreateJoystickDriver(); } [Obsolete] public IJoystickDriver CreateLegacyJoystickDriver() { #pragma warning disable 612,618 - return default_implementation.CreateLegacyJoystickDriver(); + return defaultImplementation.CreateLegacyJoystickDriver(); #pragma warning restore 612,618 } public void RegisterResource(IDisposable resource) { - default_implementation.RegisterResource(resource); + defaultImplementation.RegisterResource(resource); } class UnsupportedPlatform : PlatformFactoryBase diff --git a/src/OpenTK/Platform/Utilities.cs b/src/OpenTK/Platform/Utilities.cs index 6746b395..a0c262a3 100644 --- a/src/OpenTK/Platform/Utilities.cs +++ b/src/OpenTK/Platform/Utilities.cs @@ -401,11 +401,11 @@ namespace OpenTK.Platform /// supplied platform window (e.g. a window created with /// CreateWindowsWindowInfo, or CreateDummyWindowInfo). /// - /// + /// /// - public static IAngleWindowInfo CreateAngleWindowInfo(IWindowInfo platform_window) + public static IAngleWindowInfo CreateAngleWindowInfo(IWindowInfo platformWindow) { - return new AngleWindowInfo(platform_window); + return new AngleWindowInfo(platformWindow); } #endregion From 269c336719ad93e70934a66a8ed3786f41303044 Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Wed, 22 Mar 2017 23:30:48 -0400 Subject: [PATCH 12/37] IOS- added a method to resize the buffer on device rotation This allows to keep aspect ratio when rotating to landscape, see here: http://stackoverflow.com/questions/20326947/opengl-what-need-to-reconfig -when-rotate-screen, and also here: https://gamedev.stackexchange.com/questions/75965/how-do-i-reconfigure-m y-gles-frame-buffer-after-a-rotation --- .../Platform/iPhoneOS/iPhoneOSGameView.cs | 73 +++++++++++++------ 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs index 8d4702ac..35cecbdb 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs @@ -553,31 +553,11 @@ namespace OpenTK.Platform.iPhoneOS GraphicsContext.MakeCurrent(WindowInfo); gl = GLCalls.GetGLCalls(ContextRenderingApi); - int oldFramebuffer = 0, oldRenderbuffer = 1; + int oldFramebuffer = 0; gl.GetInteger(All.FramebufferBindingOes, out oldFramebuffer); - gl.GetInteger(All.RenderbufferBindingOes, out oldRenderbuffer); + gl.GenFramebuffers(1, out framebuffer); - gl.GenRenderbuffers(1, out renderbuffer); - gl.BindRenderbuffer(All.RenderbufferOes, renderbuffer); - - if (!EAGLContext.RenderBufferStorage((uint) All.RenderbufferOes, eaglLayer)) { - gl.DeleteRenderbuffers(1, ref renderbuffer); - renderbuffer = 0; - gl.BindRenderbuffer(All.RenderbufferBindingOes, oldRenderbuffer); - throw new InvalidOperationException("Error with EAGLContext.RenderBufferStorage!"); - } - - gl.GenFramebuffers (1, out framebuffer); - gl.BindFramebuffer (All.FramebufferOes, framebuffer); - gl.FramebufferRenderbuffer (All.FramebufferOes, All.ColorAttachment0Oes, All.RenderbufferOes, renderbuffer); - - Size newSize = new Size( - (int) Math.Round(eaglLayer.Bounds.Size.Width), - (int) Math.Round(eaglLayer.Bounds.Size.Height)); - Size = newSize; - - gl.Viewport(0, 0, newSize.Width, newSize.Height); - gl.Scissor(0, 0, newSize.Width, newSize.Height); + CreateFrameBuffer(eaglLayer); frameBufferWindow = new WeakReference(Window); frameBufferLayer = new WeakReference(Layer); @@ -609,6 +589,53 @@ namespace OpenTK.Platform.iPhoneOS gl = null; } + /// + /// Resizes the frame buffer. + /// On IOS, when the device is rotated from portrait to landscape, if the framebuffer is not recreated + /// then the EAGLContext will stretch the render buffer to fit the screen. + /// If you care at all about aspect ratio, then this behavior is not desired, and in that case this method + /// should be called when rotating the device. + /// See here: http://stackoverflow.com/questions/20326947/opengl-what-need-to-reconfig-when-rotate-screen + /// And also here: https://gamedev.stackexchange.com/questions/75965/how-do-i-reconfigure-my-gles-frame-buffer-after-a-rotation + /// + public void ResizeFrameBuffer() + { + MakeCurrent(); + + gl.DeleteRenderbuffers(1, ref renderbuffer); + + CAEAGLLayer eaglLayer = (CAEAGLLayer)Layer; + CreateFrameBuffer(eaglLayer); + } + + void CreateFrameBuffer(CAEAGLLayer eaglLayer) + { + int oldRenderbuffer = 1; + gl.GetInteger(All.RenderbufferBindingOes, out oldRenderbuffer); + + gl.GenRenderbuffers(1, out renderbuffer); + gl.BindRenderbuffer(All.RenderbufferOes, renderbuffer); + + if (!EAGLContext.RenderBufferStorage((uint)All.RenderbufferOes, eaglLayer)) + { + gl.DeleteRenderbuffers(1, ref renderbuffer); + renderbuffer = 0; + gl.BindRenderbuffer(All.RenderbufferBindingOes, oldRenderbuffer); + throw new InvalidOperationException("Error with EAGLContext.RenderBufferStorage!"); + } + + gl.BindFramebuffer(All.FramebufferOes, framebuffer); + gl.FramebufferRenderbuffer(All.FramebufferOes, All.ColorAttachment0Oes, All.RenderbufferOes, renderbuffer); + + Size newSize = new Size( + (int)Math.Round(eaglLayer.Bounds.Size.Width), + (int)Math.Round(eaglLayer.Bounds.Size.Height)); + Size = newSize; + + gl.Viewport(0, 0, newSize.Width, newSize.Height); + gl.Scissor(0, 0, newSize.Width, newSize.Height); + } + public virtual void Close() { AssertValid(); From 5eb75fefa7042adf2faa459b37068cebbc51036b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 23 Mar 2017 15:54:40 +1100 Subject: [PATCH 13/37] Fix default input directories for Generator.Bind --- src/Generator.Bind/Settings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Generator.Bind/Settings.cs b/src/Generator.Bind/Settings.cs index f5993aaf..49a42ecc 100644 --- a/src/Generator.Bind/Settings.cs +++ b/src/Generator.Bind/Settings.cs @@ -20,11 +20,11 @@ namespace Bind OverridesFiles = new List(); } - public string DefaultInputPath = "../../../Source/Bind/Specifications"; + public string DefaultInputPath = "../../../Generator.Bind/Specifications"; public string DefaultOutputPath = "../../../Source/OpenTK/Graphics/OpenGL"; public string DefaultOutputNamespace = "OpenTK.Graphics.OpenGL"; - public string DefaultDocPath = "../../../Source/Bind/Specifications/Docs"; - public string DefaultFallbackDocPath = "../../../Source/Bind/Specifications/Docs/GL"; + public string DefaultDocPath = "../../../Generator.Bind/Specifications/Docs"; + public string DefaultFallbackDocPath = "../../../Generator.Bind/Specifications/Docs/GL"; public string DefaultLicenseFile = "License.txt"; public string DefaultLanguageTypeMapFile = "csharp.tm"; public string DefaultKeywordEscapeCharacter = "@"; From 5fd4e9acd75bedcc74ced8ba10cffc084993480e Mon Sep 17 00:00:00 2001 From: Shard White Date: Thu, 27 Apr 2017 08:43:21 +0100 Subject: [PATCH 14/37] Fixed typos in documentation comments --- src/OpenTK/INativeWindow.cs | 2 +- src/OpenTK/NativeWindow.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenTK/INativeWindow.cs b/src/OpenTK/INativeWindow.cs index 2e915da4..881bcc6c 100644 --- a/src/OpenTK/INativeWindow.cs +++ b/src/OpenTK/INativeWindow.cs @@ -238,7 +238,7 @@ namespace OpenTK event EventHandler WindowStateChanged; /// - /// Occurs whenever a keybord key is pressed. + /// Occurs whenever a keyboard key is pressed. /// event EventHandler KeyDown; diff --git a/src/OpenTK/NativeWindow.cs b/src/OpenTK/NativeWindow.cs index 46445503..78590633 100644 --- a/src/OpenTK/NativeWindow.cs +++ b/src/OpenTK/NativeWindow.cs @@ -635,7 +635,7 @@ namespace OpenTK public event EventHandler IconChanged = delegate { }; /// - /// Occurs whenever a keybord key is pressed. + /// Occurs whenever a keyboard key is pressed. /// public event EventHandler KeyDown = delegate { }; @@ -859,7 +859,7 @@ namespace OpenTK #region OnKeyDown /// - /// Occurs whenever a keybord key is pressed. + /// Occurs whenever a keyboard key is pressed. /// protected virtual void OnKeyDown(KeyboardKeyEventArgs e) { @@ -884,7 +884,7 @@ namespace OpenTK #region OnKeyUp /// - /// Called when a keybord key is released. + /// Called when a keyboard key is released. /// /// The for this event. protected virtual void OnKeyUp(KeyboardKeyEventArgs e) From 974e02b03e3359e9cf5e09aaf0cb3d6b635f1235 Mon Sep 17 00:00:00 2001 From: Neico Date: Sat, 29 Apr 2017 21:33:33 +0200 Subject: [PATCH 15/37] fix AngleWindowInfo compile errors on mobile introduced by #458 --- src/OpenTK/Platform/Android/AndroidGameView.cs | 1 + src/OpenTK/Platform/Egl/EglContext.cs | 2 ++ src/OpenTK/Platform/Factory.cs | 8 ++++++-- src/OpenTK/Platform/Utilities.cs | 9 +++++---- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/OpenTK/Platform/Android/AndroidGameView.cs b/src/OpenTK/Platform/Android/AndroidGameView.cs index 5cd78e00..c167c7ef 100644 --- a/src/OpenTK/Platform/Android/AndroidGameView.cs +++ b/src/OpenTK/Platform/Android/AndroidGameView.cs @@ -27,6 +27,7 @@ using Android.Views; using Android.Runtime; using Android.Graphics; using OpenTK.Platform.Egl; +using SurfaceType = Android.Views.SurfaceType; namespace OpenTK.Platform.Android { diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index 35388b75..51335731 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -155,8 +155,10 @@ namespace OpenTK.Platform.Egl { if (window is EglWindowInfo) WindowInfo = (EglWindowInfo) window; + #if !ANDROID else if (window is IAngleWindowInfoInternal) WindowInfo = ((IAngleWindowInfoInternal) window).EglWindowInfo; + #endif if (!Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext)) { diff --git a/src/OpenTK/Platform/Factory.cs b/src/OpenTK/Platform/Factory.cs index 0117e6c8..c56d22bd 100644 --- a/src/OpenTK/Platform/Factory.cs +++ b/src/OpenTK/Platform/Factory.cs @@ -27,7 +27,6 @@ using System; using System.Diagnostics; -using OpenTK.Platform.Egl; namespace OpenTK.Platform { @@ -103,7 +102,12 @@ namespace OpenTK.Platform else if (Configuration.RunningOnAndroid) Embedded = new Android.AndroidFactory(); #endif else Embedded = new UnsupportedPlatform(); - Angle = new EglAnglePlatformFactory(Embedded); + + #if ANDROID + Angle = new UnsupportedPlatform(); + #else + Angle = new Egl.EglAnglePlatformFactory(Embedded); + #endif } #endif else diff --git a/src/OpenTK/Platform/Utilities.cs b/src/OpenTK/Platform/Utilities.cs index a0c262a3..6720066c 100644 --- a/src/OpenTK/Platform/Utilities.cs +++ b/src/OpenTK/Platform/Utilities.cs @@ -13,7 +13,6 @@ using System.Runtime.InteropServices; using System.Reflection; using System.Diagnostics; using OpenTK.Graphics; -using OpenTK.Platform.Egl; #endregion @@ -396,6 +395,7 @@ namespace OpenTK.Platform #region + #if !__MOBILE__ /// /// Creates an IWindowInfo instance for Angle rendering, based on /// supplied platform window (e.g. a window created with @@ -403,11 +403,12 @@ namespace OpenTK.Platform /// /// /// - public static IAngleWindowInfo CreateAngleWindowInfo(IWindowInfo platformWindow) + public static Egl.IAngleWindowInfo CreateAngleWindowInfo(IWindowInfo platformWindow) { - return new AngleWindowInfo(platformWindow); + return new Egl.AngleWindowInfo(platformWindow); } - + #endif + #endregion #endregion From fffb05a9173a3dd74a09c649d372306a7edaf53f Mon Sep 17 00:00:00 2001 From: varon Date: Mon, 8 May 2017 22:33:09 +0200 Subject: [PATCH 16/37] Release 3.0.0-pre --- RELEASE_NOTES.md | 19 ++++++++++++++++++- src/Generator.Bind/Properties/AssemblyInfo.cs | 8 ++++---- .../Properties/AssemblyInfo.cs | 8 ++++---- .../Properties/AssemblyInfo.cs | 8 ++++---- .../Properties/AssemblyInfo.cs | 8 ++++---- .../Properties/AssemblyInfo.cs | 8 ++++---- src/OpenTK/Properties/AssemblyInfo.cs | 8 ++++---- 7 files changed, 42 insertions(+), 25 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 5b9f46fb..bee0c9ab 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,4 +1,21 @@ -### 2.0.0 - alpha +### 3.0.0-pre + * Replaced JoystickButton enum with simple long. (breaking API change) + * Increase available joystick buttons to 64. + * Add support for OpenGL ES3 through Angle + DIrect3D. + * Fix 2 crashes on android + * Move to built-in System.Diagnostics.Debug for Android + iOS + * Fix for certain joysticks returning invalid HID pages. + * Fix for certain joysticks with negative axis range being inverted. + * Fix Xbox controller D-pad on windows + * Fix joystick hat position sticking on Linux + * Enhance xbox button detection to include GUIDE button. + * Fix iOS GL bindings issue introduced by 2ea8334 + * Fix crash on setting time to <= 0 for iOS + Android. + * Several minor XML documentation fixes and enhancements + * Fix for angle backbuffer size issue on window resize + * Possible fix for broken GLControl package. + +### 2.0.0 * Moved to new FAKE/Paket based build system * Removed superfluous release configurations * Numerous other fixes and enhancements diff --git a/src/Generator.Bind/Properties/AssemblyInfo.cs b/src/Generator.Bind/Properties/AssemblyInfo.cs index ee12cfb3..9767ed4e 100644 --- a/src/Generator.Bind/Properties/AssemblyInfo.cs +++ b/src/Generator.Bind/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("Generator.Bind")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } diff --git a/src/Generator.Converter/Properties/AssemblyInfo.cs b/src/Generator.Converter/Properties/AssemblyInfo.cs index 9890a4ed..1adfda08 100644 --- a/src/Generator.Converter/Properties/AssemblyInfo.cs +++ b/src/Generator.Converter/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("Generator.Convert")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } diff --git a/src/Generator.Rewrite/Properties/AssemblyInfo.cs b/src/Generator.Rewrite/Properties/AssemblyInfo.cs index 296b0cb2..63a68040 100644 --- a/src/Generator.Rewrite/Properties/AssemblyInfo.cs +++ b/src/Generator.Rewrite/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("Generator.Rewrite")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } diff --git a/src/OpenTK.GLControl/Properties/AssemblyInfo.cs b/src/OpenTK.GLControl/Properties/AssemblyInfo.cs index 88b92999..eeeb1acb 100644 --- a/src/OpenTK.GLControl/Properties/AssemblyInfo.cs +++ b/src/OpenTK.GLControl/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("OpenTK.GLControl")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } diff --git a/src/OpenTK.GLWidget/Properties/AssemblyInfo.cs b/src/OpenTK.GLWidget/Properties/AssemblyInfo.cs index a167a861..15d61fa4 100644 --- a/src/OpenTK.GLWidget/Properties/AssemblyInfo.cs +++ b/src/OpenTK.GLWidget/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("OpenTK.GLWidget")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } diff --git a/src/OpenTK/Properties/AssemblyInfo.cs b/src/OpenTK/Properties/AssemblyInfo.cs index 4b085898..e6e2009c 100644 --- a/src/OpenTK/Properties/AssemblyInfo.cs +++ b/src/OpenTK/Properties/AssemblyInfo.cs @@ -5,13 +5,13 @@ using System.Reflection; [assembly: AssemblyTitleAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] -[assembly: AssemblyVersionAttribute("2.0.0")] -[assembly: AssemblyFileVersionAttribute("2.0.0")] +[assembly: AssemblyVersionAttribute("3.0.0")] +[assembly: AssemblyFileVersionAttribute("3.0.0")] [assembly: CLSCompliantAttribute(true)] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library.")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.0.0"; - internal const string InformationalVersion = "2.0.0"; + internal const string Version = "3.0.0"; + internal const string InformationalVersion = "3.0.0"; } } From 239a47a559b736090eb5be7b9d1fc659ec996e52 Mon Sep 17 00:00:00 2001 From: varon Date: Mon, 8 May 2017 22:58:47 +0200 Subject: [PATCH 17/37] update readme about 3.0.0-pre release --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index da67882c..36816f5e 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,13 @@ cd opentk # Enter the source directory News ==== +### 2017-05-08 + +A pre-release package is available. + +https://www.nuget.org/packages/OpenTK/3.0.0-pre +https://www.nuget.org/packages/OpenTK.GLControl/3.0.0-pre + ### 2016-09-23 OpenTK 2.0.0 is now available for download from [Nuget](https://www.nuget.org/packages/OpenTK/2.0.0). From d490fa4b3cfef5cf8b79f366ffce83bb87295610 Mon Sep 17 00:00:00 2001 From: varon Date: Mon, 8 May 2017 23:00:25 +0200 Subject: [PATCH 18/37] Fix formatting in markdown news --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 36816f5e..7751c4f3 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ News A pre-release package is available. https://www.nuget.org/packages/OpenTK/3.0.0-pre + https://www.nuget.org/packages/OpenTK.GLControl/3.0.0-pre ### 2016-09-23 From da71abb963f5a50fd899495be152ab2ca782c9b4 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Fri, 26 May 2017 13:48:00 +0200 Subject: [PATCH 19/37] Updated Generator.Rewrite to use the new Cecil API. Dirty fix. --- paket.dependencies | 4 +- paket.lock | 750 ++++++++++++++---- .../Generator.Rewrite.csproj | 693 ++++++++++++++-- src/Generator.Rewrite/Program.cs | 202 ++--- 4 files changed, 1343 insertions(+), 306 deletions(-) diff --git a/paket.dependencies b/paket.dependencies index f7f692c6..5cd789bb 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -7,5 +7,5 @@ nuget FsCheck.Xunit nuget xunit.runner.console nuget xunit.assert nuget FAKE -nuget Mono.Cecil -nuget GtkSharp \ No newline at end of file +nuget Mono.Cecil >= 0.10.0-beta1 +nuget GtkSharp diff --git a/paket.lock b/paket.lock index 0b74580d..cf9d232f 100644 --- a/paket.lock +++ b/paket.lock @@ -1,165 +1,603 @@ NUGET remote: https://www.nuget.org/api/v2 - FAKE (4.28) - FsCheck (2.4) - FSharp.Core (>= 3.1.2.5) - FsCheck.Xunit (2.4) - FsCheck (>= 2.4) - xunit.extensibility.execution (>= 2.1 < 3.0) + FAKE (4.61.2) + FsCheck (2.9) + FSharp.Core (>= 4.1) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + FSharp.Core (>= 4.1.17) - framework: >= netstandard16 + NETStandard.Library (>= 1.6.1) - framework: >= netstandard16 + FsCheck.Xunit (2.9) + FsCheck (>= 2.9) + FSharp.Core (>= 4.1.17) - framework: >= netstandard16 + NETStandard.Library (>= 1.6.1) - framework: >= netstandard16 + xunit.abstractions (>= 2.0.1) - framework: >= netstandard16 + xunit.core (>= 2.2) - framework: >= netstandard16 + xunit.extensibility.execution (>= 2.2 < 3.0) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 FSharp.Compiler.Service (2.0.0.6) - FSharp.Core (4.0.0.1) + FSharp.Core (4.1.17) - framework: >= net10, >= netstandard10 + System.Collections (>= 4.0.11) - framework: >= netstandard16 + System.Console (>= 4.0) - framework: >= netstandard16 + System.Diagnostics.Debug (>= 4.0.11) - framework: >= netstandard16 + System.Diagnostics.Tools (>= 4.0.1) - framework: >= netstandard16 + System.Globalization (>= 4.0.11) - framework: >= netstandard16 + System.IO (>= 4.1) - framework: >= netstandard16 + System.Linq (>= 4.1) - framework: >= netstandard16 + System.Linq.Expressions (>= 4.1) - framework: >= netstandard16 + System.Linq.Queryable (>= 4.0.1) - framework: >= netstandard16 + System.Net.Requests (>= 4.0.11) - framework: >= netstandard16 + System.Reflection (>= 4.1) - framework: >= netstandard16 + System.Reflection.Extensions (>= 4.0.1) - framework: >= netstandard16 + System.Resources.ResourceManager (>= 4.0.1) - framework: >= netstandard16 + System.Runtime (>= 4.1) - framework: >= netstandard16 + System.Runtime.Extensions (>= 4.1) - framework: >= netstandard16 + System.Runtime.Numerics (>= 4.0.1) - framework: >= netstandard16 + System.Text.RegularExpressions (>= 4.1) - framework: >= netstandard16 + System.Threading (>= 4.0.11) - framework: >= netstandard16 + System.Threading.Tasks (>= 4.0.11) - framework: >= netstandard16 + System.Threading.Tasks.Parallel (>= 4.0.1) - framework: >= netstandard16 + System.Threading.Thread (>= 4.0) - framework: >= netstandard16 + System.Threading.ThreadPool (>= 4.0.10) - framework: >= netstandard16 + System.Threading.Timer (>= 4.0.1) - framework: >= netstandard16 FSharp.Formatting (2.14.4) FSharp.Compiler.Service (2.0.0.6) FSharpVSPowerTools.Core (>= 2.3 < 2.4) FSharpVSPowerTools.Core (2.3) FSharp.Compiler.Service (>= 2.0.0.3) GtkSharp (3.1.3) - Mono.Cecil (0.9.6.1) - System.Collections (4.0.10) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 - System.Threading (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Contracts (4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Debug (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Globalization (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.IO (4.0.10) - framework: dnxcore50 - System.Globalization (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Text.Encoding (>= 4.0) - framework: dnxcore50 - System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 - System.Text.Encoding.Extensions (>= 4.0) - framework: dnxcore50 - System.Threading (>= 4.0) - framework: dnxcore50 - System.Threading.Tasks (>= 4.0) - framework: dnxcore50 - System.Linq (4.0) - framework: dnxcore50 - System.Collections (>= 4.0.10) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 - System.Linq.Expressions (4.0.10) - framework: dnxcore50 - System.Collections (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 - System.Globalization (>= 4.0) - framework: dnxcore50 - System.IO (>= 4.0) - framework: dnxcore50 - System.Linq (>= 4.0) - framework: dnxcore50 - System.ObjectModel (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection.Emit (>= 4.0) - framework: dnxcore50 - System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 - System.Threading (>= 4.0) - framework: dnxcore50 - System.ObjectModel (4.0.10) - framework: dnxcore50 - System.Collections (>= 4.0.10) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Threading (>= 4.0.10) - framework: dnxcore50 - System.Private.Uri (4.0) - framework: dnxcore50 - System.Reflection (4.0.10) - framework: dnxcore50 - System.IO (>= 4.0) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Reflection.Emit (4.0) - framework: dnxcore50 - System.IO (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection.Emit.ILGeneration (>= 4.0) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Reflection.Emit.ILGeneration (4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Reflection.Extensions (4.0) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0.10) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 - System.Reflection.Primitives (4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Threading (>= 4.0) - framework: dnxcore50 - System.Reflection.TypeExtensions (4.0) - framework: dnxcore50 - System.Diagnostics.Contracts (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 - System.Linq (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0.10) - framework: dnxcore50 - System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 - System.Resources.ResourceManager (4.0) - framework: dnxcore50 - System.Globalization (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime (4.0.20) - framework: dnxcore50 - System.Private.Uri (>= 4.0) - framework: dnxcore50 - System.Runtime.Extensions (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Text.Encoding (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Text.Encoding.Extensions (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 - System.Text.RegularExpressions (4.0.10) - framework: dnxcore50 - System.Collections (>= 4.0.10) - framework: dnxcore50 - System.Globalization (>= 4.0.10) - framework: dnxcore50 - System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0.20) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 - System.Threading (>= 4.0.10) - framework: dnxcore50 - System.Threading (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Threading.Tasks (>= 4.0) - framework: dnxcore50 - System.Threading.Tasks (4.0.10) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - xunit.abstractions (2.0) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 - xunit.assert (2.1) - System.Collections (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 - System.Globalization (>= 4.0) - framework: dnxcore50 - System.Linq (>= 4.0) - framework: dnxcore50 - System.ObjectModel (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 - System.Text.RegularExpressions (>= 4.0) - framework: dnxcore50 - System.Threading.Tasks (>= 4.0) - framework: dnxcore50 - xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 - xunit.abstractions (2.0) - xunit.extensibility.execution (2.1) - System.Collections (>= 4.0) - framework: dnxcore50 - System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 - System.Globalization (>= 4.0) - framework: dnxcore50 - System.IO (>= 4.0) - framework: dnxcore50 - System.Linq (>= 4.0) - framework: dnxcore50 - System.Linq.Expressions (>= 4.0) - framework: dnxcore50 - System.Reflection (>= 4.0) - framework: dnxcore50 - System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 - System.Runtime (>= 4.0) - framework: dnxcore50 - System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 - System.Text.Encoding (>= 4.0) - framework: dnxcore50 - System.Threading (>= 4.0) - framework: dnxcore50 - System.Threading.Tasks (>= 4.0) - framework: dnxcore50 - xunit.abstractions (>= 2.0) - framework: dnxcore50 - xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 - xunit.runner.console (2.1) + Microsoft.NETCore.Platforms (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Targets (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.Win32.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + Mono.Cecil (0.10.0-beta6) + System.Collections (>= 4.0.11) - framework: >= netstandard13 + System.IO.FileSystem (>= 4.0.1) - framework: >= netstandard13 + System.IO.FileSystem.Primitives (>= 4.0.1) - framework: >= netstandard13 + System.Reflection (>= 4.1) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.1) - framework: >= netstandard13 + System.Security.Cryptography.Algorithms (>= 4.2) - framework: >= netstandard13 + System.Security.Cryptography.Csp (>= 4.0) - framework: >= netstandard13 + System.Threading (>= 4.0.11) - framework: >= netstandard13 + NETStandard.Library (1.6.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard10 + Microsoft.Win32.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 + System.AppContext (>= 4.3) - framework: >= net46, >= netstandard13 + System.Collections (>= 4.3) - framework: >= netstandard10 + System.Collections.Concurrent (>= 4.3) - framework: >= net45, >= netstandard11 + System.Console (>= 4.3) - framework: >= net46, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard10 + System.Diagnostics.Tools (>= 4.3) - framework: >= netstandard10 + System.Diagnostics.Tracing (>= 4.3) - framework: >= net45, >= netstandard11 + System.Globalization (>= 4.3) - framework: >= netstandard10 + System.Globalization.Calendars (>= 4.3) - framework: >= net46, >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard10 + System.IO.Compression (>= 4.3) - framework: >= net45, >= netstandard11 + System.IO.Compression.ZipFile (>= 4.3) - framework: >= net46, >= netstandard13 + System.IO.FileSystem (>= 4.3) - framework: >= net46, >= netstandard13 + System.IO.FileSystem.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 + System.Linq (>= 4.3) - framework: >= netstandard10 + System.Linq.Expressions (>= 4.3) - framework: >= netstandard10 + System.Net.Http (>= 4.3) - framework: >= net45, >= netstandard11 + System.Net.Primitives (>= 4.3) - framework: >= netstandard10 + System.Net.Sockets (>= 4.3) - framework: >= net46, >= netstandard13 + System.ObjectModel (>= 4.3) - framework: >= netstandard10 + System.Reflection (>= 4.3) - framework: >= netstandard10 + System.Reflection.Extensions (>= 4.3) - framework: >= netstandard10 + System.Reflection.Primitives (>= 4.3) - framework: >= netstandard10 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard10 + System.Runtime (>= 4.3) - framework: >= netstandard10 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard10 + System.Runtime.Handles (>= 4.3) - framework: >= net46, >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: >= net45, >= netstandard11 + System.Runtime.InteropServices.RuntimeInformation (>= 4.3) - framework: >= net45, >= netstandard11 + System.Runtime.Numerics (>= 4.3) - framework: >= net45, >= netstandard11 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: >= net46, >= netstandard13 + System.Security.Cryptography.Encoding (>= 4.3) - framework: >= net46, >= netstandard13 + System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 + System.Security.Cryptography.X509Certificates (>= 4.3) - framework: >= net46, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard10 + System.Text.Encoding.Extensions (>= 4.3) - framework: >= netstandard10 + System.Text.RegularExpressions (>= 4.3) - framework: >= netstandard10 + System.Threading (>= 4.3) - framework: >= netstandard10 + System.Threading.Tasks (>= 4.3) - framework: >= netstandard10 + System.Threading.Timer (>= 4.3) - framework: >= net451, >= netstandard12 + System.Xml.ReaderWriter (>= 4.3) - framework: >= netstandard10 + System.Xml.XDocument (>= 4.3) - framework: >= netstandard10 + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.native.System (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + runtime.native.System.IO.Compression (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + runtime.native.System.Net.Http (4.3) - framework: >= net10, >= netstandard16 + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16 + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3) + runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16 + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.AppContext (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Buffers (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard11 + System.Diagnostics.Tracing (>= 4.3) - framework: >= netstandard11 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard11 + System.Runtime (>= 4.3) - framework: >= netstandard11 + System.Threading (>= 4.3) - framework: >= netstandard11 + System.Collections (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Collections.Concurrent (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Reflection (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Console (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard13 + System.Diagnostics.Debug (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Diagnostics.DiagnosticSource (4.3.1) - framework: >= net10, netstandard13, >= netstandard16 + System.Collections (>= 4.3) - framework: netstandard11, >= netstandard13 + System.Diagnostics.Tracing (>= 4.3) - framework: netstandard11, >= netstandard13 + System.Reflection (>= 4.3) - framework: netstandard11, >= netstandard13 + System.Runtime (>= 4.3) - framework: netstandard11, >= netstandard13 + System.Threading (>= 4.3) - framework: netstandard11, >= netstandard13 + System.Diagnostics.Tools (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Diagnostics.Tracing (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 + System.Globalization (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Globalization.Calendars (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.Globalization (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Globalization.Extensions (4.3) - framework: >= net10, >= netstandard16 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + System.Globalization (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard13 + System.IO (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.IO.Compression (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + runtime.native.System (>= 4.3) - framework: >= netstandard13 + runtime.native.System.IO.Compression (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Buffers (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO.Compression.ZipFile (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 + System.Buffers (>= 4.3) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.IO.Compression (>= 4.3) - framework: >= netstandard13 + System.IO.FileSystem (>= 4.3) - framework: >= netstandard13 + System.IO.FileSystem.Primitives (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard13 + System.IO.FileSystem (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.IO.FileSystem.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: >= netstandard13 + System.IO.FileSystem.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Linq (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard16 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Linq.Expressions (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.IO (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Linq (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.ObjectModel (>= 4.3) - framework: >= netstandard16 + System.Reflection (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard16 + System.Reflection.Emit (>= 4.3) - framework: >= netstandard16 + System.Reflection.Emit.ILGeneration (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Reflection.Emit.Lightweight (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Reflection.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Reflection.Primitives (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Reflection.TypeExtensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Linq.Queryable (4.3) - framework: >= net10, >= netstandard16 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Linq (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Linq.Expressions (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Reflection (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Reflection.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Net.Http (4.3.2) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard13, >= netstandard16 + Microsoft.Win32.Primitives (>= 4.3) - framework: netstandard13 + runtime.native.System (>= 4.3) - framework: >= netstandard16 + runtime.native.System.Net.Http (>= 4.3) - framework: >= netstandard16 + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 + System.Collections (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Diagnostics.DiagnosticSource (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Globalization (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Globalization.Extensions (>= 4.3) - framework: >= netstandard16 + System.IO (>= 4.3) - framework: dnxcore50, netstandard11, netstandard13, >= netstandard16 + System.IO.Compression (>= 4.3) - framework: netstandard13 + System.IO.FileSystem (>= 4.3) - framework: >= netstandard16 + System.Net.Primitives (>= 4.3) - framework: dnxcore50, netstandard11, netstandard13, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, netstandard13, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Runtime.Handles (>= 4.3) - framework: netstandard13, >= netstandard16 + System.Runtime.InteropServices (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Encoding (>= 4.3) - framework: netstandard13, >= netstandard16 + System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Primitives (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.X509Certificates (>= 4.3) - framework: >= net46, dnxcore50, netstandard13, >= netstandard16 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard11, netstandard13, >= netstandard16 + System.Threading (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, netstandard13, >= netstandard16 + System.Net.Primitives (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Net.Requests (4.3) - framework: >= net10, >= netstandard16 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + System.Net.Http (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Net.Primitives (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + System.Net.WebHeaderCollection (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Net.Sockets (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.Net.Primitives (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: >= netstandard13 + System.Net.WebHeaderCollection (4.3) - framework: >= net10, >= netstandard16 + System.Collections (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard13 + System.ObjectModel (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Reflection (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.IO (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Reflection.Primitives (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Reflection.Emit (4.3) - framework: >= net10, >= netstandard16 + System.IO (>= 4.3) - framework: >= netstandard11 + System.Reflection (>= 4.3) - framework: >= netstandard11 + System.Reflection.Emit.ILGeneration (>= 4.3) - framework: >= netstandard11 + System.Reflection.Primitives (>= 4.3) - framework: >= netstandard11 + System.Runtime (>= 4.3) - framework: >= netstandard11 + System.Reflection.Emit.ILGeneration (4.3) - framework: >= net10, >= netstandard16 + System.Reflection (>= 4.3) - framework: >= netstandard10 + System.Reflection.Primitives (>= 4.3) - framework: >= netstandard10 + System.Runtime (>= 4.3) - framework: >= netstandard10 + System.Reflection.Emit.Lightweight (4.3) - framework: >= net10, >= netstandard16 + System.Reflection (>= 4.3) - framework: >= netstandard10 + System.Reflection.Emit.ILGeneration (>= 4.3) - framework: >= netstandard10 + System.Reflection.Primitives (>= 4.3) - framework: >= netstandard10 + System.Runtime (>= 4.3) - framework: >= netstandard10 + System.Reflection.Extensions (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10 + System.Reflection (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Reflection.Primitives (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Reflection.TypeExtensions (4.3) - framework: >= net10, >= netstandard16 + System.Reflection (>= 4.3) - framework: >= net462, dnxcore50, netstandard13, >= netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard15 + System.Resources.ResourceManager (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Reflection (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10 + System.Runtime (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, netstandard12, netstandard13, >= netstandard15 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard12, netstandard13, >= netstandard15 + System.Runtime.Extensions (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 + System.Runtime.Handles (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.InteropServices (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15, netcore11 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15, netcore11 + System.Reflection (>= 4.3) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15, netcore11 + System.Reflection.Primitives (>= 4.3) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15, netcore11 + System.Runtime (>= 4.3) - framework: net462, >= net463, dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15, netcore11 + System.Runtime.Handles (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard15, netcore11 + System.Runtime.InteropServices.RuntimeInformation (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + runtime.native.System (>= 4.3) - framework: >= netstandard11 + System.Reflection (>= 4.3) - framework: dnxcore50, >= netstandard11 + System.Reflection.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard11 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard11 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard11 + System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard11 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard11 + System.Runtime.Numerics (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Security.Cryptography.Algorithms (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard16 + runtime.native.System.Security.Cryptography.Apple (>= 4.3) - framework: >= netstandard16 + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 + System.Collections (>= 4.3) - framework: >= netstandard16 + System.IO (>= 4.3) - framework: >= net463, dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime (>= 4.3) - framework: >= net463, dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime.Handles (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime.InteropServices (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime.Numerics (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Encoding (>= 4.3) - framework: >= net463, dnxcore50, >= netstandard16 + System.Security.Cryptography.Primitives (>= 4.3) - framework: net46, net461, >= net463, dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Security.Cryptography.Cng (4.3) - framework: >= net46, >= netstandard16 + Microsoft.NETCore.Platforms (>= 1.1) - framework: netstandard14, >= netstandard16 + System.IO (>= 4.3) - framework: netstandard13, netstandard14, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: netstandard14, >= netstandard16 + System.Runtime (>= 4.3) - framework: netstandard13, netstandard14, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: netstandard14, >= netstandard16 + System.Runtime.Handles (>= 4.3) - framework: netstandard13, netstandard14, >= netstandard16 + System.Runtime.InteropServices (>= 4.3) - framework: netstandard14, >= netstandard16 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: net46, net461, >= net463, netstandard13, netstandard14, >= netstandard16 + System.Security.Cryptography.Encoding (>= 4.3) - framework: netstandard14, >= netstandard16 + System.Security.Cryptography.Primitives (>= 4.3) - framework: net46, net461, >= net463, netstandard13, netstandard14, >= netstandard16 + System.Text.Encoding (>= 4.3) - framework: netstandard14, >= netstandard16 + System.Security.Cryptography.Csp (4.3) - framework: >= net46, >= netstandard13 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.Reflection (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: >= net46, >= netstandard13 + System.Security.Cryptography.Encoding (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard13 + System.Threading (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.Encoding (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard13 + System.Collections (>= 4.3) - framework: >= netstandard13 + System.Collections.Concurrent (>= 4.3) - framework: >= netstandard13 + System.Linq (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.Primitives (>= 4.3) - framework: >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.OpenSsl (4.3) - framework: >= net10, >= netstandard16 + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= net463, >= netstandard16, monoandroid, monotouch, xamarinios, xamarinmac + System.Collections (>= 4.3) - framework: >= netstandard16 + System.IO (>= 4.3) - framework: >= net463, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard16 + System.Runtime (>= 4.3) - framework: >= net463, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: >= net463, >= netstandard16 + System.Runtime.Handles (>= 4.3) - framework: >= netstandard16 + System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard16 + System.Runtime.Numerics (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: >= net463, >= netstandard16 + System.Security.Cryptography.Encoding (>= 4.3) - framework: >= net463, >= netstandard16 + System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net463, >= netstandard16 + System.Text.Encoding (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard13 + System.Globalization (>= 4.3) - framework: >= netstandard13 + System.IO (>= 4.3) - framework: >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Threading (>= 4.3) - framework: >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: >= netstandard13 + System.Security.Cryptography.X509Certificates (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard16 + runtime.native.System (>= 4.3) - framework: >= netstandard16 + runtime.native.System.Net.Http (>= 4.3) - framework: >= netstandard16 + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard16 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Globalization.Calendars (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.IO (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.IO.FileSystem (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.IO.FileSystem.Primitives (>= 4.3) - framework: >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime.Handles (>= 4.3) - framework: dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Runtime.InteropServices (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime.Numerics (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Security.Cryptography.Algorithms (>= 4.3) - framework: net46, >= net461, dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Security.Cryptography.Cng (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Security.Cryptography.Csp (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Encoding (>= 4.3) - framework: net46, >= net461, dnxcore50, netstandard13, netstandard14, >= netstandard16 + System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 + System.Security.Cryptography.Primitives (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Text.Encoding (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Text.Encoding.Extensions (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Text.RegularExpressions (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard16, netcore11 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard16 + System.Threading (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Threading.Tasks (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Threading.Tasks.Extensions (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: >= netstandard10 + System.Runtime (>= 4.3) - framework: >= netstandard10 + System.Threading.Tasks (>= 4.3) - framework: >= netstandard10 + System.Threading.Tasks.Parallel (4.3) - framework: >= net10, >= netstandard16 + System.Collections.Concurrent (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 + System.Threading.Thread (4.3) - framework: >= net10, >= netstandard16 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Threading.ThreadPool (4.3) - framework: >= net10, >= netstandard16 + System.Runtime (>= 4.3) - framework: >= netstandard13 + System.Runtime.Handles (>= 4.3) - framework: >= netstandard13 + System.Threading.Timer (4.3) - framework: >= net10, >= netstandard12, netstandard13, netstandard14, netstandard15 + Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard12 + Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard12 + System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard12 + System.Xml.ReaderWriter (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.IO.FileSystem (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO.FileSystem.Primitives (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime.InteropServices (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Text.Encoding.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Text.RegularExpressions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Threading.Tasks.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Xml.XDocument (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Diagnostics.Tools (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.IO (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Reflection (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Text.Encoding (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 + System.Xml.ReaderWriter (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 + xunit.abstractions (2.0.1) - framework: >= net452, >= netstandard11 + NETStandard.Library (>= 1.6) - framework: >= netstandard10 + xunit.assert (2.2) + NETStandard.Library (>= 1.6) - framework: >= netstandard11 + xunit.core (2.2) - framework: >= netstandard16 + xunit.extensibility.core (2.2) + xunit.extensibility.execution (2.2) + xunit.extensibility.core (2.2) - framework: >= net452, >= netstandard11 + NETStandard.Library (>= 1.6) - framework: >= netstandard11 + xunit.abstractions (>= 2.0.1) - framework: >= net452, >= netstandard11 + xunit.extensibility.execution (2.2) - framework: >= net10, >= netstandard10 + NETStandard.Library (>= 1.6) - framework: >= netstandard11 + xunit.extensibility.core (2.2) - framework: >= net452, >= netstandard11 + xunit.runner.console (2.2) diff --git a/src/Generator.Rewrite/Generator.Rewrite.csproj b/src/Generator.Rewrite/Generator.Rewrite.csproj index a6472b87..9b50b9fa 100644 --- a/src/Generator.Rewrite/Generator.Rewrite.csproj +++ b/src/Generator.Rewrite/Generator.Rewrite.csproj @@ -9,7 +9,7 @@ Properties OpenTK.Rewrite Rewrite - v3.5 + v4.0 512 12.0.0 2.0 @@ -84,27 +84,13 @@ - - - - ..\..\packages\Mono.Cecil\lib\net20\Mono.Cecil.Mdb.dll - True - True - - - ..\..\packages\Mono.Cecil\lib\net20\Mono.Cecil.Pdb.dll - True - True - - - ..\..\packages\Mono.Cecil\lib\net20\Mono.Cecil.dll - True - True - - - + + ..\..\packages\Mono.Cecil\lib\net35\Mono.Cecil.dll + True + True + ..\..\packages\Mono.Cecil\lib\net35\Mono.Cecil.Mdb.dll True @@ -120,15 +106,15 @@ True True + + + + - ..\..\packages\Mono.Cecil\lib\net35\Mono.Cecil.dll + ..\..\packages\Mono.Cecil\lib\net40\Mono.Cecil.dll True True - - - - ..\..\packages\Mono.Cecil\lib\net40\Mono.Cecil.Mdb.dll True @@ -144,50 +130,653 @@ True True + + + + - ..\..\packages\Mono.Cecil\lib\net40\Mono.Cecil.dll + ..\..\packages\Mono.Cecil\lib\netstandard1.3\Mono.Cecil.dll True True - - - - - ..\..\packages\Mono.Cecil\lib\net45\Mono.Cecil.Mdb.dll + ..\..\packages\Mono.Cecil\lib\netstandard1.3\Mono.Cecil.Mdb.dll True True - ..\..\packages\Mono.Cecil\lib\net45\Mono.Cecil.Pdb.dll + ..\..\packages\Mono.Cecil\lib\netstandard1.3\Mono.Cecil.Pdb.dll True True - ..\..\packages\Mono.Cecil\lib\net45\Mono.Cecil.Rocks.dll - True - True - - - ..\..\packages\Mono.Cecil\lib\net45\Mono.Cecil.dll - True - True - - - - - - - ..\..\packages\Mono.Cecil\lib\sl5\Mono.Cecil.Rocks.dll - True - True - - - ..\..\packages\Mono.Cecil\lib\sl5\Mono.Cecil.dll + ..\..\packages\Mono.Cecil\lib\netstandard1.3\Mono.Cecil.Rocks.dll True True + + + + + ..\..\packages\System.Collections\ref\netstandard1.0\System.Collections.dll + False + True + + + + + + + ..\..\packages\System.Collections\ref\netstandard1.3\System.Collections.dll + False + True + + + + + + + + + ..\..\packages\System.Collections.Concurrent\lib\netstandard1.3\System.Collections.Concurrent.dll + True + True + + + + + + + + + ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.0\System.Diagnostics.Debug.dll + False + True + + + + + + + ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.3\System.Diagnostics.Debug.dll + False + True + + + + + + + + + True + + + ..\..\packages\System.Diagnostics.Tracing\lib\net462\System.Diagnostics.Tracing.dll + True + True + + + + + + + ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.1\System.Diagnostics.Tracing.dll + False + True + + + + + + + ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.2\System.Diagnostics.Tracing.dll + False + True + + + + + + + ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.3\System.Diagnostics.Tracing.dll + False + True + + + + + + + ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.5\System.Diagnostics.Tracing.dll + False + True + + + + + + + + + ..\..\packages\System.Globalization\ref\netstandard1.0\System.Globalization.dll + False + True + + + + + + + ..\..\packages\System.Globalization\ref\netstandard1.3\System.Globalization.dll + False + True + + + + + + + + + ..\..\packages\System.IO\lib\net462\System.IO.dll + True + True + + + + + + + ..\..\packages\System.IO\ref\netstandard1.0\System.IO.dll + False + True + + + + + + + ..\..\packages\System.IO\ref\netstandard1.3\System.IO.dll + False + True + + + + + + + ..\..\packages\System.IO\ref\netstandard1.5\System.IO.dll + False + True + + + + + + + + + True + + + + + + + + + ..\..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll + True + True + + + + + + + ..\..\packages\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll + False + True + + + + + + + + + ..\..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll + True + True + + + + + + + ..\..\packages\System.IO.FileSystem.Primitives\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll + True + True + + + + + + + + + ..\..\packages\System.Linq\lib\net463\System.Linq.dll + True + True + + + + + + + ..\..\packages\System.Linq\lib\netstandard1.6\System.Linq.dll + True + True + + + + + + + + + ..\..\packages\System.Reflection\lib\net462\System.Reflection.dll + True + True + + + + + + + ..\..\packages\System.Reflection\ref\netstandard1.0\System.Reflection.dll + False + True + + + + + + + ..\..\packages\System.Reflection\ref\netstandard1.3\System.Reflection.dll + False + True + + + + + + + ..\..\packages\System.Reflection\ref\netstandard1.5\System.Reflection.dll + False + True + + + + + + + + + True + + + + + + + True + + + ..\..\packages\System.Runtime\lib\net462\System.Runtime.dll + True + True + + + + + + + ..\..\packages\System.Runtime\ref\netstandard1.0\System.Runtime.dll + False + True + + + + + + + ..\..\packages\System.Runtime\ref\netstandard1.2\System.Runtime.dll + False + True + + + + + + + ..\..\packages\System.Runtime\ref\netstandard1.3\System.Runtime.dll + False + True + + + + + + + ..\..\packages\System.Runtime\ref\netstandard1.5\System.Runtime.dll + False + True + + + + + + + + + ..\..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll + True + True + + + + + + + ..\..\packages\System.Runtime.Extensions\ref\netstandard1.0\System.Runtime.Extensions.dll + False + True + + + + + + + ..\..\packages\System.Runtime.Extensions\ref\netstandard1.3\System.Runtime.Extensions.dll + False + True + + + + + + + ..\..\packages\System.Runtime.Extensions\ref\netstandard1.5\System.Runtime.Extensions.dll + False + True + + + + + + + + + ..\..\packages\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll + False + True + + + + + + + + + ..\..\packages\System.Runtime.InteropServices\lib\net462\System.Runtime.InteropServices.dll + True + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll + True + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.1\System.Runtime.InteropServices.dll + False + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.2\System.Runtime.InteropServices.dll + False + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll + False + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll + False + True + + + + + + + + + True + + + + + + + ..\..\packages\System.Runtime.Numerics\ref\netstandard1.1\System.Runtime.Numerics.dll + False + True + + + + + + + ..\..\packages\System.Runtime.Numerics\lib\netstandard1.3\System.Runtime.Numerics.dll + True + True + + + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\lib\net46\System.Security.Cryptography.Algorithms.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\lib\net461\System.Security.Cryptography.Algorithms.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.3\System.Security.Cryptography.Algorithms.dll + False + True + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll + False + True + + + + + + + ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll + False + True + + + + + + + + + ..\..\packages\System.Security.Cryptography.Csp\lib\net46\System.Security.Cryptography.Csp.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Csp\ref\netstandard1.3\System.Security.Cryptography.Csp.dll + False + True + + + + + + + + + ..\..\packages\System.Security.Cryptography.Encoding\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Encoding\ref\netstandard1.3\System.Security.Cryptography.Encoding.dll + False + True + + + + + + + + + ..\..\packages\System.Security.Cryptography.Primitives\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + + + + + ..\..\packages\System.Security.Cryptography.Primitives\lib\netstandard1.3\System.Security.Cryptography.Primitives.dll + True + True + + + + + + + + + ..\..\packages\System.Text.Encoding\ref\netstandard1.0\System.Text.Encoding.dll + False + True + + + + + + + ..\..\packages\System.Text.Encoding\ref\netstandard1.3\System.Text.Encoding.dll + False + True + + + + + + + + + ..\..\packages\System.Threading\lib\netstandard1.3\System.Threading.dll + True + True + + + + + + + + + ..\..\packages\System.Threading.Tasks\ref\netstandard1.0\System.Threading.Tasks.dll + False + True + + + + + + + ..\..\packages\System.Threading.Tasks\ref\netstandard1.3\System.Threading.Tasks.dll + False + True + + + + \ No newline at end of file diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index a1a7e7b4..12977590 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -82,6 +82,7 @@ namespace OpenTK.Rewrite } read_params.SymbolReaderProvider = provider; read_params.ReadSymbols = true; + read_params.ReadWrite = true; write_params.WriteSymbols = true; if (!String.IsNullOrEmpty(keyfile) && File.Exists(keyfile)) @@ -98,57 +99,59 @@ namespace OpenTK.Rewrite } // Load assembly and process all modules - var assembly = AssemblyDefinition.ReadAssembly(file, read_params); - var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute"); - if (rewritten == null) + using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(file, read_params)) { - foreach (var module in assembly.Modules) + var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute"); + if (rewritten == null) { - foreach (var reference in module.AssemblyReferences) + foreach (var module in assembly.Modules) { - try + foreach (var reference in module.AssemblyReferences) { - var resolved = module.AssemblyResolver.Resolve(reference); - if (reference.Name == "mscorlib") + try { - mscorlib = resolved; + var resolved = module.AssemblyResolver.Resolve(reference); + if (reference.Name == "mscorlib") + { + mscorlib = resolved; + } + } + catch (Exception e) + { + Console.Error.WriteLine(e.ToString()); } } - catch (Exception e) + } + + if (mscorlib == null) + { + Console.Error.WriteLine("Failed to locate mscorlib"); + return; + } + TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); + TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder"); + TypeVoid = mscorlib.MainModule.GetType("System.Void"); + TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); + TypeInt32 = mscorlib.MainModule.GetType("System.Int32"); + + TypeBindingsBase = assembly.Modules.Select(m => m.GetType("OpenTK.BindingsBase")).First(); + + foreach (var module in assembly.Modules) + { + foreach (var type in module.Types) { - Console.Error.WriteLine(e.ToString()); + Rewrite(type, options); } } } - - if (mscorlib == null) + else { - Console.Error.WriteLine("Failed to locate mscorlib"); - return; + Console.Error.WriteLine("Error: assembly has already been rewritten"); } - TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); - TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder"); - TypeVoid = mscorlib.MainModule.GetType("System.Void"); - TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); - TypeInt32 = mscorlib.MainModule.GetType("System.Int32"); - TypeBindingsBase = assembly.Modules.Select(m => m.GetType("OpenTK.BindingsBase")).First(); - - foreach (var module in assembly.Modules) - { - foreach (var type in module.Types) - { - Rewrite(type, options); - } - } + // Save rewritten assembly + assembly.Write(write_params); } - else - { - Console.Error.WriteLine("Error: assembly has already been rewritten"); - } - - // Save rewritten assembly - assembly.Write(file, write_params); } void Rewrite(TypeDefinition type, IEnumerable options) @@ -171,7 +174,7 @@ namespace OpenTK.Rewrite var rewritten_constructor = type.GetConstructors().First(); var rewritten = new CustomAttribute(rewritten_constructor); rewritten.ConstructorArguments.Add(new CustomAttributeArgument( - type.Module.Import(mscorlib.MainModule.GetType("System.Boolean")), true)); + type.Module.ImportReference(mscorlib.MainModule.GetType("System.Boolean")), true)); type.Module.Assembly.CustomAttributes.Add(rewritten); } } @@ -272,9 +275,12 @@ namespace OpenTK.Rewrite } // Patch convenience wrappers + int stringBuilderPointerVarIndex = -1; + int stringPointerVarIndex = -1; + int stringArrayPointerVarIndex = -1; if (wrapper.Parameters.Count == native.Parameters.Count) { - EmitParameters(wrapper, native, body, il); + EmitParameters(wrapper, native, body, il, out stringBuilderPointerVarIndex, out stringPointerVarIndex, out stringArrayPointerVarIndex); } else { @@ -301,7 +307,7 @@ namespace OpenTK.Rewrite EmitReturnTypeWrapper(wrapper, native, body, il); } - EmitParameterEpilogues(wrapper, native, body, il); + EmitParameterEpilogues(wrapper, native, body, il, stringBuilderPointerVarIndex, stringPointerVarIndex, stringArrayPointerVarIndex); if (options.Contains("-debug")) { @@ -479,7 +485,7 @@ namespace OpenTK.Rewrite // String return-type wrapper // return new string((sbyte*)((void*)GetString())); - var intptr_to_voidpointer = wrapper.Module.Import(mscorlib.MainModule.GetType("System.IntPtr").GetMethods() + var intptr_to_voidpointer = wrapper.Module.ImportReference(mscorlib.MainModule.GetType("System.IntPtr").GetMethods() .First(m => { return @@ -487,7 +493,7 @@ namespace OpenTK.Rewrite m.ReturnType.Name == "Void*"; })); - var string_constructor = wrapper.Module.Import(mscorlib.MainModule.GetType("System.String").GetConstructors() + var string_constructor = wrapper.Module.ImportReference(mscorlib.MainModule.GetType("System.String").GetConstructors() .First(m => { var p = m.Parameters; @@ -521,28 +527,30 @@ namespace OpenTK.Rewrite } } - static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il) + static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il, + int stringBuilderPointerVarIndex, int stringPointerVarIndex, int stringArrayPointerVarIndex) { - foreach (var p in wrapper.Parameters) + foreach (var p in wrapper.Parameters) // TODO: Should not need to check for >= 0 here, but StringBuilder + // TODO: requires it for some reason. Find out why { - if (p.ParameterType.Name == "StringBuilder") + if (p.ParameterType.Name == "StringBuilder" && stringBuilderPointerVarIndex >= 0) { - EmitStringBuilderEpilogue(wrapper, native, p, body, il); + EmitStringBuilderEpilogue(wrapper, native, p, body, il, stringBuilderPointerVarIndex); } - if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") + if (!p.ParameterType.IsArray && p.ParameterType.Name == "String" && stringPointerVarIndex >= 0) { - EmitStringEpilogue(wrapper, p, body, il); + EmitStringEpilogue(wrapper, p, body, il, stringPointerVarIndex); } - if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") + if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String" && stringArrayPointerVarIndex >= 0) { - EmitStringArrayEpilogue(wrapper, p, body, il); + EmitStringArrayEpilogue(wrapper, p, body, il, stringArrayPointerVarIndex); } } } - static void EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringBuilderPointerIndex) { var p = parameter.ParameterType; @@ -557,25 +565,24 @@ namespace OpenTK.Rewrite // Marshal.FreeHGlobal(sb_ptr); // } // Make sure we have imported StringBuilder::Capacity and Marshal::AllocHGlobal - var sb_get_capacity = method.Module.Import(TypeStringBuilder.Methods.First(m => m.Name == "get_Capacity")); - var alloc_hglobal = method.Module.Import(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal")); + var sb_get_capacity = method.Module.ImportReference(TypeStringBuilder.Methods.First(m => m.Name == "get_Capacity")); + var alloc_hglobal = method.Module.ImportReference(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal")); // IntPtr ptr; - var variable_name = parameter.Name + " _sb_ptr"; - body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); - int index = body.Variables.Count - 1; + body.Variables.Add(new VariableDefinition(TypeIntPtr)); + stringBuilderPointerIndex = body.Variables.Count - 1; // ptr = Marshal.AllocHGlobal(sb.Capacity + 1); il.Emit(OpCodes.Callvirt, sb_get_capacity); il.Emit(OpCodes.Call, alloc_hglobal); - il.Emit(OpCodes.Stloc, index); - il.Emit(OpCodes.Ldloc, index); + il.Emit(OpCodes.Stloc, stringBuilderPointerIndex); + il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); // We'll emit the try-finally block in the epilogue implementation, // because we haven't yet emitted all necessary instructions here. } - static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringBuilderPointerIndex) { var p = parameter.ParameterType; if (p.Name == "StringBuilder") @@ -591,29 +598,27 @@ namespace OpenTK.Rewrite // } // Make sure we have imported BindingsBase::MasrhalPtrToStringBuilder and Marshal::FreeHGlobal - var ptr_to_sb = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalPtrToStringBuilder")); - var free_hglobal = wrapper.Module.Import(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal")); + var ptr_to_sb = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalPtrToStringBuilder")); + var free_hglobal = wrapper.Module.ImportReference(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal")); var block = new ExceptionHandler(ExceptionHandlerType.Finally); block.TryStart = body.Instructions[0]; - var variable_name = parameter.Name + " _sb_ptr"; - var v = body.Variables.First(m => m.Name == variable_name); - il.Emit(OpCodes.Ldloc, v.Index); + il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Call, ptr_to_sb); block.TryEnd = body.Instructions.Last(); block.HandlerStart = body.Instructions.Last(); - il.Emit(OpCodes.Ldloc, v.Index); + il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); il.Emit(OpCodes.Call, free_hglobal); block.HandlerEnd = body.Instructions.Last(); } } - static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringPointerIndex) { var p = parameter.ParameterType; @@ -621,34 +626,31 @@ namespace OpenTK.Rewrite // IntPtr ptr = MarshalStringToPtr(str); // try { calli } // finally { Marshal.FreeHGlobal(ptr); } - var marshal_str_to_ptr = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringToPtr")); + var marshal_str_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringToPtr")); // IntPtr ptr; - var variable_name = parameter.Name + "_string_ptr"; - body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); - int index = body.Variables.Count - 1; + body.Variables.Add(new VariableDefinition(TypeIntPtr)); + stringPointerIndex = body.Variables.Count - 1; // ptr = Marshal.StringToHGlobalAnsi(str); il.Emit(OpCodes.Call, marshal_str_to_ptr); - il.Emit(OpCodes.Stloc, index); - il.Emit(OpCodes.Ldloc, index); + il.Emit(OpCodes.Stloc, stringPointerIndex); + il.Emit(OpCodes.Ldloc, stringPointerIndex); // The finally block will be emitted in the function epilogue } - static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringPointerIndex) { var p = parameter.ParameterType; - var free = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr")); + var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr")); // FreeStringPtr(ptr) - var variable_name = parameter.Name + "_string_ptr"; - var v = body.Variables.First(m => m.Name == variable_name); - il.Emit(OpCodes.Ldloc, v.Index); + il.Emit(OpCodes.Ldloc, stringPointerIndex); il.Emit(OpCodes.Call, free); } - static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringArrayPointerIndex) { var p = parameter.ParameterType; @@ -656,34 +658,31 @@ namespace OpenTK.Rewrite // IntPtr ptr = MarshalStringArrayToPtr(strings); // try { calli } // finally { FreeStringArrayPtr(ptr); } - var marshal_str_array_to_ptr = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr")); + var marshal_str_array_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr")); // IntPtr ptr; - var variable_name = parameter.Name + "_string_array_ptr"; - body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); - int index = body.Variables.Count - 1; + body.Variables.Add(new VariableDefinition(TypeIntPtr)); + stringArrayPointerIndex = body.Variables.Count - 1; // ptr = MarshalStringArrayToPtr(strings); il.Emit(OpCodes.Call, marshal_str_array_to_ptr); - il.Emit(OpCodes.Stloc, index); - il.Emit(OpCodes.Ldloc, index); + il.Emit(OpCodes.Stloc, stringArrayPointerIndex); + il.Emit(OpCodes.Ldloc, stringArrayPointerIndex); // The finally block will be emitted in the function epilogue } - static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) + static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringArrayPointerIndex) { // Note: only works for string vectors (1d arrays). // We do not (and will probably never) support 2d or higher string arrays var p = parameter.ParameterType; - var free = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringArrayPtr")); + var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringArrayPtr")); // FreeStringArrayPtr(string_array_ptr, string_array.Length) - var variable_name = parameter.Name + "_string_array_ptr"; - var v = body.Variables.First(m => m.Name == variable_name); // load string_array_ptr - il.Emit(OpCodes.Ldloc, v.Index); + il.Emit(OpCodes.Ldloc, stringArrayPointerIndex); // load string_array.Length il.Emit(OpCodes.Ldarg, parameter.Index); @@ -729,7 +728,12 @@ namespace OpenTK.Rewrite // return result; // } body.Variables.Add(new VariableDefinition(wrapper.ReturnType)); - EmitParameters(wrapper, native, body, il); + + int dummy1; + int dummy2; + int dummy3; + + EmitParameters(wrapper, native, body, il, out dummy1, out dummy2, out dummy3); il.Emit(OpCodes.Ldloca, body.Variables.Count - 1); } else @@ -757,13 +761,19 @@ namespace OpenTK.Rewrite } } - static int EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il) + static int EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il, + out int stringBuilderPointerVarIndex, out int stringPointerVarIndex, out int stringArrayPointerVarIndex) { + // Default outs + stringBuilderPointerVarIndex = -1; + stringPointerVarIndex = -1; + stringArrayPointerVarIndex = -1; + int i; for (i = 0; i < method.Parameters.Count; i++) { var parameter = method.Parameters[i]; - var p = method.Module.Import(method.Parameters[i].ParameterType); + var p = method.Module.ImportReference(method.Parameters[i].ParameterType); il.Emit(OpCodes.Ldarg, i); if (p.Name.Contains("Int32") && native.Parameters[i].ParameterType.Name.Contains("IntPtr")) @@ -774,11 +784,11 @@ namespace OpenTK.Rewrite } else if (p.Name == "StringBuilder") { - EmitStringBuilderParameter(method, parameter, body, il); + EmitStringBuilderParameter(method, parameter, body, il, out stringBuilderPointerVarIndex); } else if (p.Name == "String" && !p.IsArray) { - EmitStringParameter(method, parameter, body, il); + EmitStringParameter(method, parameter, body, il, out stringPointerVarIndex); } else if (p.IsByReference) { @@ -790,7 +800,7 @@ namespace OpenTK.Rewrite } else if (p.IsArray) { - if (p.Name != method.Module.Import(typeof(string[])).Name) + if (p.Name != method.Module.ImportReference(typeof(string[])).Name) { // .Net treats 1d arrays differently than higher rank arrays. // 1d arrays are directly supported by instructions such as ldlen and ldelema. @@ -834,7 +844,7 @@ namespace OpenTK.Rewrite } else { - var get_length = method.Module.Import( + var get_length = method.Module.ImportReference( mscorlib.MainModule.GetType("System.Array").Methods.First(m => m.Name == "get_Length")); il.Emit(OpCodes.Callvirt, get_length); } @@ -880,7 +890,7 @@ namespace OpenTK.Rewrite } else { - EmitStringArrayParameter(method, parameter, body, il); + EmitStringArrayParameter(method, parameter, body, il, out stringArrayPointerVarIndex); } } } From a29f72663ca31b0e8d7a66d17884cc512612fecd Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:12:43 +0200 Subject: [PATCH 20/37] Changed uses of IEnumerable to List in order to prevent multiple enumerations. --- src/Generator.Rewrite/Program.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 12977590..621b610f 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -45,7 +45,7 @@ namespace OpenTK.Rewrite var file = args[0]; var key = args[1]; var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/")); - program.Rewrite(file, key, options); + program.Rewrite(file, key, options.ToList()); } // mscorlib types @@ -61,7 +61,7 @@ namespace OpenTK.Rewrite static bool dllimport; - void Rewrite(string file, string keyfile, IEnumerable options) + void Rewrite(string file, string keyfile, List options) { dllimport = options.Contains("-dllimport"); @@ -80,6 +80,7 @@ namespace OpenTK.Rewrite { provider = new Mono.Cecil.Mdb.MdbReaderProvider(); } + read_params.SymbolReaderProvider = provider; read_params.ReadSymbols = true; read_params.ReadWrite = true; @@ -154,7 +155,7 @@ namespace OpenTK.Rewrite } } - void Rewrite(TypeDefinition type, IEnumerable options) + void Rewrite(TypeDefinition type, List options) { var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints"); if (entry_points != null) @@ -196,7 +197,7 @@ namespace OpenTK.Rewrite } void Rewrite(TypeDefinition type, FieldDefinition entry_points, - List entry_signatures, IEnumerable options) + List entry_signatures, List options) { // Rewrite all wrapper methods var wrapper_signatures = new List(); @@ -206,8 +207,8 @@ namespace OpenTK.Rewrite foreach (var wrapper in wrapper_signatures) { var autogenerated = wrapper.CustomAttributes - .Where(a => a.AttributeType.Name == "AutoGeneratedAttribute"); - if (autogenerated.Count() > 0) + .Where(a => a.AttributeType.Name == "AutoGeneratedAttribute").ToList(); + if (autogenerated.Any()) { var signature_name = (string)autogenerated.First() .Fields.First(f => f.Name == "EntryPoint").Argument.Value; @@ -258,7 +259,7 @@ namespace OpenTK.Rewrite // Create body for method static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot, - FieldDefinition entry_points, IEnumerable options) + FieldDefinition entry_points, List options) { var body = wrapper.Body; var il = body.GetILProcessor(); From 9f4eb8546e6da6631b47ad5bef984e56fa31927c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:14:46 +0200 Subject: [PATCH 21/37] Removed obsolete manual detection of debug symbol file. --- src/Generator.Rewrite/Program.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 621b610f..11198144 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -69,19 +69,7 @@ namespace OpenTK.Rewrite // We want to keep a valid symbols file (pdb or mdb) var read_params = new ReaderParameters(); var write_params = new WriterParameters(); - var pdb = Path.ChangeExtension(file, "pdb"); - var mdb = file + ".mdb"; - ISymbolReaderProvider provider = null; - if (File.Exists(pdb)) - { - provider = new Mono.Cecil.Pdb.PdbReaderProvider(); - } - else if (File.Exists(mdb)) - { - provider = new Mono.Cecil.Mdb.MdbReaderProvider(); - } - - read_params.SymbolReaderProvider = provider; + read_params.ReadSymbols = true; read_params.ReadWrite = true; write_params.WriteSymbols = true; From f3f90691e614f6819073c10ce688fe838b80e1cc Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:15:49 +0200 Subject: [PATCH 22/37] Changed manual stream closing to a using statement. --- src/Generator.Rewrite/Program.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 11198144..13002edd 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -77,10 +77,12 @@ namespace OpenTK.Rewrite if (!String.IsNullOrEmpty(keyfile) && File.Exists(keyfile)) { keyfile = Path.GetFullPath(keyfile); - var fs = new FileStream(keyfile, FileMode.Open, FileAccess.Read); - var keypair = new System.Reflection.StrongNameKeyPair(fs); - fs.Close(); - write_params.StrongNameKeyPair = keypair; + + using (var fs = new FileStream(keyfile, FileMode.Open, FileAccess.Read)) + { + var keypair = new System.Reflection.StrongNameKeyPair(fs); + write_params.StrongNameKeyPair = keypair; + } } else { From bc981ceccf4c1def99022f35e04faf3e3e4c647c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:23:33 +0200 Subject: [PATCH 23/37] Better variable naming and line breaks. --- src/Generator.Rewrite/Program.cs | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 13002edd..43430b0f 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -573,7 +573,8 @@ namespace OpenTK.Rewrite // because we haven't yet emitted all necessary instructions here. } - static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringBuilderPointerIndex) + static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, + ParameterDefinition parameter, MethodBody body, ILProcessor il, int generatedPointerVarIndex) { var p = parameter.ParameterType; if (p.Name == "StringBuilder") @@ -595,21 +596,22 @@ namespace OpenTK.Rewrite var block = new ExceptionHandler(ExceptionHandlerType.Finally); block.TryStart = body.Instructions[0]; - il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Call, ptr_to_sb); block.TryEnd = body.Instructions.Last(); block.HandlerStart = body.Instructions.Last(); - il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); il.Emit(OpCodes.Call, free_hglobal); block.HandlerEnd = body.Instructions.Last(); } } - static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringPointerIndex) + static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il, out int generatedPointerVarIndex) { var p = parameter.ParameterType; @@ -621,27 +623,29 @@ namespace OpenTK.Rewrite // IntPtr ptr; body.Variables.Add(new VariableDefinition(TypeIntPtr)); - stringPointerIndex = body.Variables.Count - 1; + generatedPointerVarIndex = body.Variables.Count - 1; // ptr = Marshal.StringToHGlobalAnsi(str); il.Emit(OpCodes.Call, marshal_str_to_ptr); - il.Emit(OpCodes.Stloc, stringPointerIndex); - il.Emit(OpCodes.Ldloc, stringPointerIndex); + il.Emit(OpCodes.Stloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); // The finally block will be emitted in the function epilogue } - static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringPointerIndex) + static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il, int generatedPointerVarIndex) { var p = parameter.ParameterType; var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr")); // FreeStringPtr(ptr) - il.Emit(OpCodes.Ldloc, stringPointerIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); il.Emit(OpCodes.Call, free); } - static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringArrayPointerIndex) + static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il, out int generatedPointerVarIndex) { var p = parameter.ParameterType; @@ -653,17 +657,18 @@ namespace OpenTK.Rewrite // IntPtr ptr; body.Variables.Add(new VariableDefinition(TypeIntPtr)); - stringArrayPointerIndex = body.Variables.Count - 1; + generatedPointerVarIndex = body.Variables.Count - 1; // ptr = MarshalStringArrayToPtr(strings); il.Emit(OpCodes.Call, marshal_str_array_to_ptr); - il.Emit(OpCodes.Stloc, stringArrayPointerIndex); - il.Emit(OpCodes.Ldloc, stringArrayPointerIndex); + il.Emit(OpCodes.Stloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); // The finally block will be emitted in the function epilogue } - static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il, int stringArrayPointerIndex) + static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il, int generatedPointerVarIndex) { // Note: only works for string vectors (1d arrays). // We do not (and will probably never) support 2d or higher string arrays @@ -673,7 +678,7 @@ namespace OpenTK.Rewrite // FreeStringArrayPtr(string_array_ptr, string_array.Length) // load string_array_ptr - il.Emit(OpCodes.Ldloc, stringArrayPointerIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); // load string_array.Length il.Emit(OpCodes.Ldarg, parameter.Index); From 092ffb480c3aada5949d775eedd4400bc3f99bf6 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:31:39 +0200 Subject: [PATCH 24/37] Added a class that can identify a generated variable. --- src/Generator.Rewrite/GeneratedVariableIdentifier.cs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/Generator.Rewrite/GeneratedVariableIdentifier.cs diff --git a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs new file mode 100644 index 00000000..d5e380a8 --- /dev/null +++ b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs @@ -0,0 +1,7 @@ +namespace OpenTK.Rewrite +{ + public class GeneratedVariableIdentifier + { + + } +} \ No newline at end of file From 760e68ed4ea321fa673f3e663c991e87c674876d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:57:13 +0200 Subject: [PATCH 25/37] Removed uses of out variables and introduced a generated variable identifier class. --- .../GeneratedVariableIdentifier.cs | 36 +++++ .../Generator.Rewrite.csproj | 1 + src/Generator.Rewrite/Program.cs | 125 ++++++++++-------- 3 files changed, 106 insertions(+), 56 deletions(-) diff --git a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs index d5e380a8..d9cef063 100644 --- a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs +++ b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs @@ -1,7 +1,43 @@ +using System; + namespace OpenTK.Rewrite { + /// + /// Acts as a unique identifier for a generated named variable that can be passed between methods. Replaces uses of + /// variable names from Mono.Cecil. + /// public class GeneratedVariableIdentifier { + /// + /// The name of the generated variable. + /// + public string Name { get; } + /// + /// The index of the generated variable in its method. + /// + public int Index { get; } + + /// + /// Initializes a new instance of the class. + /// + /// The name of the generated variable. + /// The index of the generated variable in its method. + /// + public GeneratedVariableIdentifier(string name, int index) + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("The name argument cannot be null or empty", nameof(name)); + } + + if (index < 0) + { + throw new ArgumentException("The index must be greater than zero.", nameof(index)); + } + + this.Name = name; + this.Index = index; + } } } \ No newline at end of file diff --git a/src/Generator.Rewrite/Generator.Rewrite.csproj b/src/Generator.Rewrite/Generator.Rewrite.csproj index 9b50b9fa..5a3b11b9 100644 --- a/src/Generator.Rewrite/Generator.Rewrite.csproj +++ b/src/Generator.Rewrite/Generator.Rewrite.csproj @@ -52,6 +52,7 @@ + diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 43430b0f..91c7b118 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -266,17 +266,15 @@ namespace OpenTK.Rewrite } // Patch convenience wrappers - int stringBuilderPointerVarIndex = -1; - int stringPointerVarIndex = -1; - int stringArrayPointerVarIndex = -1; - if (wrapper.Parameters.Count == native.Parameters.Count) + List generatedVariables = new List(); + if (wrapper.Parameters.Count == native.Parameters.Count) { - EmitParameters(wrapper, native, body, il, out stringBuilderPointerVarIndex, out stringPointerVarIndex, out stringArrayPointerVarIndex); + generatedVariables = EmitParameters(wrapper, native, body, il); } else { int difference = native.Parameters.Count - wrapper.Parameters.Count; - EmitConvenienceWrapper(wrapper, native, difference, body, il); + generatedVariables = EmitConvenienceWrapper(wrapper, native, difference, body, il); } if (slot != -1) @@ -298,7 +296,7 @@ namespace OpenTK.Rewrite EmitReturnTypeWrapper(wrapper, native, body, il); } - EmitParameterEpilogues(wrapper, native, body, il, stringBuilderPointerVarIndex, stringPointerVarIndex, stringArrayPointerVarIndex); + EmitParameterEpilogues(wrapper, native, body, il, generatedVariables); if (options.Contains("-debug")) { @@ -519,29 +517,28 @@ namespace OpenTK.Rewrite } static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il, - int stringBuilderPointerVarIndex, int stringPointerVarIndex, int stringArrayPointerVarIndex) + List generatedVariables) { - foreach (var p in wrapper.Parameters) // TODO: Should not need to check for >= 0 here, but StringBuilder - // TODO: requires it for some reason. Find out why + foreach (var p in wrapper.Parameters) { - if (p.ParameterType.Name == "StringBuilder" && stringBuilderPointerVarIndex >= 0) + if (p.ParameterType.Name == "StringBuilder") { - EmitStringBuilderEpilogue(wrapper, native, p, body, il, stringBuilderPointerVarIndex); + EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_sb_ptr")); } - if (!p.ParameterType.IsArray && p.ParameterType.Name == "String" && stringPointerVarIndex >= 0) + if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") { - EmitStringEpilogue(wrapper, p, body, il, stringPointerVarIndex); + EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_string_ptr")); } - if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String" && stringArrayPointerVarIndex >= 0) + if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") { - EmitStringArrayEpilogue(wrapper, p, body, il, stringArrayPointerVarIndex); + EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_string_array_ptr")); } } } - static void EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il, out int stringBuilderPointerIndex) + static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il) { var p = parameter.ParameterType; @@ -561,21 +558,30 @@ namespace OpenTK.Rewrite // IntPtr ptr; body.Variables.Add(new VariableDefinition(TypeIntPtr)); - stringBuilderPointerIndex = body.Variables.Count - 1; + int stringBuilderPtrIndex = body.Variables.Count - 1; + + GeneratedVariableIdentifier stringBuilderPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_sb_ptr", stringBuilderPtrIndex); // ptr = Marshal.AllocHGlobal(sb.Capacity + 1); il.Emit(OpCodes.Callvirt, sb_get_capacity); il.Emit(OpCodes.Call, alloc_hglobal); - il.Emit(OpCodes.Stloc, stringBuilderPointerIndex); - il.Emit(OpCodes.Ldloc, stringBuilderPointerIndex); + il.Emit(OpCodes.Stloc, stringBuilderPtrVar.Index); + il.Emit(OpCodes.Ldloc, stringBuilderPtrVar.Index); // We'll emit the try-finally block in the epilogue implementation, // because we haven't yet emitted all necessary instructions here. + + return stringBuilderPtrVar; } static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, - ParameterDefinition parameter, MethodBody body, ILProcessor il, int generatedPointerVarIndex) + ParameterDefinition parameter, MethodBody body, ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) { + if (generatedPtrVar == null) + { + throw new ArgumentNullException(nameof(generatedPtrVar)); + } + var p = parameter.ParameterType; if (p.Name == "StringBuilder") { @@ -596,22 +602,22 @@ namespace OpenTK.Rewrite var block = new ExceptionHandler(ExceptionHandlerType.Finally); block.TryStart = body.Instructions[0]; - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Call, ptr_to_sb); block.TryEnd = body.Instructions.Last(); block.HandlerStart = body.Instructions.Last(); - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); il.Emit(OpCodes.Call, free_hglobal); block.HandlerEnd = body.Instructions.Last(); } } - static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, - ILProcessor il, out int generatedPointerVarIndex) + static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il) { var p = parameter.ParameterType; @@ -623,29 +629,32 @@ namespace OpenTK.Rewrite // IntPtr ptr; body.Variables.Add(new VariableDefinition(TypeIntPtr)); - generatedPointerVarIndex = body.Variables.Count - 1; + int generatedPointerVarIndex = body.Variables.Count - 1; + + GeneratedVariableIdentifier stringPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_string_ptr", generatedPointerVarIndex); // ptr = Marshal.StringToHGlobalAnsi(str); il.Emit(OpCodes.Call, marshal_str_to_ptr); - il.Emit(OpCodes.Stloc, generatedPointerVarIndex); - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Stloc, stringPtrVar.Index); + il.Emit(OpCodes.Ldloc, stringPtrVar.Index); // The finally block will be emitted in the function epilogue + return stringPtrVar; } static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, - ILProcessor il, int generatedPointerVarIndex) + ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) { var p = parameter.ParameterType; var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr")); // FreeStringPtr(ptr) - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); il.Emit(OpCodes.Call, free); } - static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, - ILProcessor il, out int generatedPointerVarIndex) + static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, + ILProcessor il) { var p = parameter.ParameterType; @@ -657,19 +666,28 @@ namespace OpenTK.Rewrite // IntPtr ptr; body.Variables.Add(new VariableDefinition(TypeIntPtr)); - generatedPointerVarIndex = body.Variables.Count - 1; + int generatedPointerVarIndex = body.Variables.Count - 1; + + GeneratedVariableIdentifier stringArrayPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_string_array_ptr", generatedPointerVarIndex); // ptr = MarshalStringArrayToPtr(strings); il.Emit(OpCodes.Call, marshal_str_array_to_ptr); - il.Emit(OpCodes.Stloc, generatedPointerVarIndex); - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Stloc, stringArrayPtrVar.Index); + il.Emit(OpCodes.Ldloc, stringArrayPtrVar.Index); // The finally block will be emitted in the function epilogue + + return stringArrayPtrVar; } static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, - ILProcessor il, int generatedPointerVarIndex) + ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) { + if (generatedPtrVar == null) + { + throw new ArgumentNullException(nameof(generatedPtrVar)); + } + // Note: only works for string vectors (1d arrays). // We do not (and will probably never) support 2d or higher string arrays var p = parameter.ParameterType; @@ -678,7 +696,7 @@ namespace OpenTK.Rewrite // FreeStringArrayPtr(string_array_ptr, string_array.Length) // load string_array_ptr - il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); // load string_array.Length il.Emit(OpCodes.Ldarg, parameter.Index); @@ -689,7 +707,7 @@ namespace OpenTK.Rewrite il.Emit(OpCodes.Call, free); } - static void EmitConvenienceWrapper(MethodDefinition wrapper, + static List EmitConvenienceWrapper(MethodDefinition wrapper, MethodDefinition native, int difference, MethodBody body, ILProcessor il) { if (wrapper.Parameters.Count > 2) @@ -698,6 +716,8 @@ namespace OpenTK.Rewrite throw new NotImplementedException(); } + + List generatedVariables = new List(); if (wrapper.ReturnType.Name != "Void") { if (difference == 2) @@ -724,12 +744,8 @@ namespace OpenTK.Rewrite // return result; // } body.Variables.Add(new VariableDefinition(wrapper.ReturnType)); - - int dummy1; - int dummy2; - int dummy3; - EmitParameters(wrapper, native, body, il, out dummy1, out dummy2, out dummy3); + generatedVariables = EmitParameters(wrapper, native, body, il); il.Emit(OpCodes.Ldloca, body.Variables.Count - 1); } else @@ -755,18 +771,14 @@ namespace OpenTK.Rewrite Console.Error.WriteLine("Unknown wrapper type for ({0})", native.Name); } } + + return generatedVariables; } - static int EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il, - out int stringBuilderPointerVarIndex, out int stringPointerVarIndex, out int stringArrayPointerVarIndex) + static List EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il) { - // Default outs - stringBuilderPointerVarIndex = -1; - stringPointerVarIndex = -1; - stringArrayPointerVarIndex = -1; - - int i; - for (i = 0; i < method.Parameters.Count; i++) + List generatedVariables = new List(); + for (int i = 0; i < method.Parameters.Count; i++) { var parameter = method.Parameters[i]; var p = method.Module.ImportReference(method.Parameters[i].ParameterType); @@ -780,11 +792,11 @@ namespace OpenTK.Rewrite } else if (p.Name == "StringBuilder") { - EmitStringBuilderParameter(method, parameter, body, il, out stringBuilderPointerVarIndex); + generatedVariables.Add(EmitStringBuilderParameter(method, parameter, body, il)); } else if (p.Name == "String" && !p.IsArray) { - EmitStringParameter(method, parameter, body, il, out stringPointerVarIndex); + generatedVariables.Add(EmitStringParameter(method, parameter, body, il)); } else if (p.IsByReference) { @@ -886,11 +898,12 @@ namespace OpenTK.Rewrite } else { - EmitStringArrayParameter(method, parameter, body, il, out stringArrayPointerVarIndex); + generatedVariables.Add(EmitStringArrayParameter(method, parameter, body, il)); } } } - return i; + + return generatedVariables; } static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot) From 71c900630f64d228f5161176deb56f5283db134c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 18:59:37 +0200 Subject: [PATCH 26/37] Added ordinal comparison to string index search. --- src/Generator.Rewrite/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 91c7b118..48e7a2fa 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -334,7 +334,7 @@ namespace OpenTK.Rewrite // something like "type namespace.class::method(type arg)" var module = il.Body.Method.FullName; module = module.Substring(module.IndexOf(' ') + 1); - module = module.Substring(0, module.IndexOf("::")); + module = module.Substring(0, module.IndexOf("::", StringComparison.Ordinal)); module = module.Substring(0, module.LastIndexOf('.')); // Only works for Graphics modules due to hardcoded use of From 19995fdc2e3aa724872240763f643726a0e1bc1b Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 19:00:12 +0200 Subject: [PATCH 27/37] Removed unused using statement. --- src/Generator.Rewrite/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 48e7a2fa..01fa54d3 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; From 879da06b29d39768e437cdac7980cd139f2f538d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 19:45:38 +0200 Subject: [PATCH 28/37] Added additional identifier constraints. --- src/Generator.Rewrite/Program.cs | 43 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 01fa54d3..8aab9bfd 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -266,7 +266,7 @@ namespace OpenTK.Rewrite // Patch convenience wrappers List generatedVariables = new List(); - if (wrapper.Parameters.Count == native.Parameters.Count) + if (wrapper.Parameters.Count == native.Parameters.Count) { generatedVariables = EmitParameters(wrapper, native, body, il); } @@ -522,17 +522,17 @@ namespace OpenTK.Rewrite { if (p.ParameterType.Name == "StringBuilder") { - EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_sb_ptr")); + EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_sb_ptr" && v.Body == body)); } if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") { - EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_string_ptr")); + EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_ptr" && v.Body == body)); } if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") { - EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(g => g.Name == p.Name + "_string_array_ptr")); + EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_array_ptr" && v.Body == body)); } } } @@ -556,16 +556,17 @@ namespace OpenTK.Rewrite var alloc_hglobal = method.Module.ImportReference(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal")); // IntPtr ptr; - body.Variables.Add(new VariableDefinition(TypeIntPtr)); + var variableDefinition = new VariableDefinition(TypeIntPtr); + body.Variables.Add(variableDefinition); int stringBuilderPtrIndex = body.Variables.Count - 1; - GeneratedVariableIdentifier stringBuilderPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_sb_ptr", stringBuilderPtrIndex); + GeneratedVariableIdentifier stringBuilderPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_sb_ptr"); // ptr = Marshal.AllocHGlobal(sb.Capacity + 1); il.Emit(OpCodes.Callvirt, sb_get_capacity); il.Emit(OpCodes.Call, alloc_hglobal); - il.Emit(OpCodes.Stloc, stringBuilderPtrVar.Index); - il.Emit(OpCodes.Ldloc, stringBuilderPtrVar.Index); + il.Emit(OpCodes.Stloc, stringBuilderPtrIndex); + il.Emit(OpCodes.Ldloc, stringBuilderPtrIndex); // We'll emit the try-finally block in the epilogue implementation, // because we haven't yet emitted all necessary instructions here. @@ -601,14 +602,14 @@ namespace OpenTK.Rewrite var block = new ExceptionHandler(ExceptionHandlerType.Finally); block.TryStart = body.Instructions[0]; - il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index); il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Call, ptr_to_sb); block.TryEnd = body.Instructions.Last(); block.HandlerStart = body.Instructions.Last(); - il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index); il.Emit(OpCodes.Call, free_hglobal); block.HandlerEnd = body.Instructions.Last(); @@ -627,15 +628,16 @@ namespace OpenTK.Rewrite var marshal_str_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringToPtr")); // IntPtr ptr; - body.Variables.Add(new VariableDefinition(TypeIntPtr)); + var variableDefinition = new VariableDefinition(TypeIntPtr); + body.Variables.Add(variableDefinition); int generatedPointerVarIndex = body.Variables.Count - 1; - GeneratedVariableIdentifier stringPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_string_ptr", generatedPointerVarIndex); + GeneratedVariableIdentifier stringPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_string_ptr"); // ptr = Marshal.StringToHGlobalAnsi(str); il.Emit(OpCodes.Call, marshal_str_to_ptr); - il.Emit(OpCodes.Stloc, stringPtrVar.Index); - il.Emit(OpCodes.Ldloc, stringPtrVar.Index); + il.Emit(OpCodes.Stloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); // The finally block will be emitted in the function epilogue return stringPtrVar; @@ -648,7 +650,7 @@ namespace OpenTK.Rewrite var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr")); // FreeStringPtr(ptr) - il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index); il.Emit(OpCodes.Call, free); } @@ -664,15 +666,16 @@ namespace OpenTK.Rewrite var marshal_str_array_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr")); // IntPtr ptr; - body.Variables.Add(new VariableDefinition(TypeIntPtr)); + var variableDefinition = new VariableDefinition(TypeIntPtr); + body.Variables.Add(variableDefinition); int generatedPointerVarIndex = body.Variables.Count - 1; - GeneratedVariableIdentifier stringArrayPtrVar = new GeneratedVariableIdentifier(parameter.Name + "_string_array_ptr", generatedPointerVarIndex); + GeneratedVariableIdentifier stringArrayPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_string_array_ptr"); // ptr = MarshalStringArrayToPtr(strings); il.Emit(OpCodes.Call, marshal_str_array_to_ptr); - il.Emit(OpCodes.Stloc, stringArrayPtrVar.Index); - il.Emit(OpCodes.Ldloc, stringArrayPtrVar.Index); + il.Emit(OpCodes.Stloc, generatedPointerVarIndex); + il.Emit(OpCodes.Ldloc, generatedPointerVarIndex); // The finally block will be emitted in the function epilogue @@ -695,7 +698,7 @@ namespace OpenTK.Rewrite // FreeStringArrayPtr(string_array_ptr, string_array.Length) // load string_array_ptr - il.Emit(OpCodes.Ldloc, generatedPtrVar.Index); + il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index); // load string_array.Length il.Emit(OpCodes.Ldarg, parameter.Index); From dd0de0a75bda6d6e8bae3a5c7f7dbab49865e6f9 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 19:47:00 +0200 Subject: [PATCH 29/37] Added additional identifier constraints. --- .../GeneratedVariableIdentifier.cs | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs index d9cef063..aa89acf3 100644 --- a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs +++ b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs @@ -1,4 +1,5 @@ using System; +using Mono.Cecil.Cil; namespace OpenTK.Rewrite { @@ -8,36 +9,48 @@ namespace OpenTK.Rewrite /// public class GeneratedVariableIdentifier { + /// + /// The which the variable is in. + /// + public MethodBody Body { get; } + + /// + /// The which the variable idetifier maps to. + /// + public VariableDefinition Definition { get; } + /// /// The name of the generated variable. /// public string Name { get; } - - /// - /// The index of the generated variable in its method. - /// - public int Index { get; } /// /// Initializes a new instance of the class. /// + /// The method body which the variable is in. /// The name of the generated variable. /// The index of the generated variable in its method. /// - public GeneratedVariableIdentifier(string name, int index) + public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name) { + if (body == null) + { + throw new ArgumentException("The body argument cannot be null.", nameof(body)); + } + + if (definition == null) + { + throw new ArgumentException("The definition argument cannot be null.", nameof(body)); + } + if (string.IsNullOrEmpty(name)) { throw new ArgumentException("The name argument cannot be null or empty", nameof(name)); } - if (index < 0) - { - throw new ArgumentException("The index must be greater than zero.", nameof(index)); - } - + this.Body = body; + this.Definition = definition; this.Name = name; - this.Index = index; } } } \ No newline at end of file From 57de60ba962b3ab4645209ca96a9f9a02e6c68a4 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 20:16:43 +0200 Subject: [PATCH 30/37] Tightened variable identifier picking even more. --- src/Generator.Rewrite/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 8aab9bfd..4dc46db1 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -522,17 +522,17 @@ namespace OpenTK.Rewrite { if (p.ParameterType.Name == "StringBuilder") { - EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_sb_ptr" && v.Body == body)); + EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_sb_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); } if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") { - EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_ptr" && v.Body == body)); + EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); } if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") { - EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_array_ptr" && v.Body == body)); + EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_array_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); } } } From 8514b5c78ef40ca643a54b9edc4b43a667f6480c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 20:19:17 +0200 Subject: [PATCH 31/37] Added static modifier to methods which could have it. --- src/Generator.Rewrite/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 4dc46db1..dd50760e 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -169,7 +169,7 @@ namespace OpenTK.Rewrite } } - int GetSlot(MethodDefinition signature) + static int GetSlot(MethodDefinition signature) { // Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS) if (dllimport) @@ -219,7 +219,7 @@ namespace OpenTK.Rewrite } } - void RemoveNativeSignatures(TypeDefinition type, List methods) + static void RemoveNativeSignatures(TypeDefinition type, List methods) { // Remove all DllImports for functions called through calli, since // their signatures are embedded directly into the calli callsite. @@ -230,7 +230,7 @@ namespace OpenTK.Rewrite } } - void RemoveSupportingAttributes(TypeDefinition type) + static void RemoveSupportingAttributes(TypeDefinition type) { foreach (var method in type.Methods) { From ff413b8a6cc0db2825aa6031989d151f08984052 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 20:55:09 +0200 Subject: [PATCH 32/37] Dropped project target back down to 3.5. --- src/Generator.Rewrite/Generator.Rewrite.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.Rewrite/Generator.Rewrite.csproj b/src/Generator.Rewrite/Generator.Rewrite.csproj index 5a3b11b9..aa12b84a 100644 --- a/src/Generator.Rewrite/Generator.Rewrite.csproj +++ b/src/Generator.Rewrite/Generator.Rewrite.csproj @@ -9,7 +9,7 @@ Properties OpenTK.Rewrite Rewrite - v4.0 + v3.5 512 12.0.0 2.0 From 86e0898811f2fe60a6e1cdcb28745b51950837e2 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 21:58:38 +0200 Subject: [PATCH 33/37] Restricted access to internal and sealed the class. --- src/Generator.Rewrite/GeneratedVariableIdentifier.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs index aa89acf3..ec3389e5 100644 --- a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs +++ b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs @@ -7,7 +7,7 @@ namespace OpenTK.Rewrite /// Acts as a unique identifier for a generated named variable that can be passed between methods. Replaces uses of /// variable names from Mono.Cecil. /// - public class GeneratedVariableIdentifier + internal sealed class GeneratedVariableIdentifier { /// /// The which the variable is in. From 7b65131fb52d3815c179c90f6d3a325872add654 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 22:05:07 +0200 Subject: [PATCH 34/37] Pulled repeated logic out into a helper method. --- src/Generator.Rewrite/Program.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index dd50760e..d1a7d983 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -140,7 +140,7 @@ namespace OpenTK.Rewrite } // Save rewritten assembly - assembly.Write(write_params); + assembly.Write(write_params); } } @@ -516,27 +516,40 @@ namespace OpenTK.Rewrite } static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il, - List generatedVariables) + IReadOnlyCollection generatedVariables) { foreach (var p in wrapper.Parameters) { if (p.ParameterType.Name == "StringBuilder") { - EmitStringBuilderEpilogue(wrapper, native, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_sb_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); + EmitStringBuilderEpilogue(wrapper, native, p, body, il, GetGeneratedVariable(generatedVariables, p.Name + "_sb_ptr", body)); } if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") { - EmitStringEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); + EmitStringEpilogue(wrapper, p, body, il,GetGeneratedVariable(generatedVariables, p.Name + "_string_ptr", body)); } if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") { - EmitStringArrayEpilogue(wrapper, p, body, il, generatedVariables.FirstOrDefault(v => v.Name == p.Name + "_string_array_ptr" && v.Body == body && body.Variables.Contains(v.Definition))); + EmitStringArrayEpilogue(wrapper, p, body, il, GetGeneratedVariable(generatedVariables, p.Name + "_string_array_ptr", body)); } } } + /// + /// Retrieves a generated variable by searching the given list by the variable's name and associated method body. + /// + /// + /// + /// + /// + static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable variableIdentifiers, string name, MethodBody body) + { + return variableIdentifiers.FirstOrDefault(v => v.Name == name && v.Body == body && + body.Variables.Contains(v.Definition)); + } + static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il) { var p = parameter.ParameterType; From b420ce8735509073b9c100d1000bd337210da0ff Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 22:08:48 +0200 Subject: [PATCH 35/37] Changed signature of RemoveNativeSignatures. --- src/Generator.Rewrite/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index d1a7d983..96be25cb 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -68,7 +68,7 @@ namespace OpenTK.Rewrite // We want to keep a valid symbols file (pdb or mdb) var read_params = new ReaderParameters(); var write_params = new WriterParameters(); - + read_params.ReadSymbols = true; read_params.ReadWrite = true; write_params.WriteSymbols = true; @@ -219,7 +219,7 @@ namespace OpenTK.Rewrite } } - static void RemoveNativeSignatures(TypeDefinition type, List methods) + static void RemoveNativeSignatures(TypeDefinition type, IEnumerable methods) { // Remove all DllImports for functions called through calli, since // their signatures are embedded directly into the calli callsite. @@ -516,7 +516,7 @@ namespace OpenTK.Rewrite } static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il, - IReadOnlyCollection generatedVariables) + List generatedVariables) { foreach (var p in wrapper.Parameters) { From 1cda816b97b1dfd2fcc1161ed920ee87c751c66b Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 29 May 2017 22:22:26 +0200 Subject: [PATCH 36/37] Changed signatures back to IEnumerable and added full enumeration to list where needed. --- src/Generator.Rewrite/Program.cs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index 96be25cb..dc8bfcf6 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -44,7 +44,7 @@ namespace OpenTK.Rewrite var file = args[0]; var key = args[1]; var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/")); - program.Rewrite(file, key, options.ToList()); + program.Rewrite(file, key, options); } // mscorlib types @@ -60,9 +60,10 @@ namespace OpenTK.Rewrite static bool dllimport; - void Rewrite(string file, string keyfile, List options) + void Rewrite(string file, string keyfile, IEnumerable options) { - dllimport = options.Contains("-dllimport"); + IEnumerable optionsEnumerated = options as IList ?? options.ToList(); + dllimport = optionsEnumerated.Contains("-dllimport"); // Specify assembly read and write parameters // We want to keep a valid symbols file (pdb or mdb) @@ -130,7 +131,7 @@ namespace OpenTK.Rewrite { foreach (var type in module.Types) { - Rewrite(type, options); + Rewrite(type, optionsEnumerated); } } } @@ -144,7 +145,7 @@ namespace OpenTK.Rewrite } } - void Rewrite(TypeDefinition type, List options) + void Rewrite(TypeDefinition type, IEnumerable options) { var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints"); if (entry_points != null) @@ -186,13 +187,14 @@ namespace OpenTK.Rewrite } void Rewrite(TypeDefinition type, FieldDefinition entry_points, - List entry_signatures, List options) + List entry_signatures, IEnumerable options) { // Rewrite all wrapper methods var wrapper_signatures = new List(); wrapper_signatures.AddRange(type.Methods .Where(m => m.IsPublic && m.CustomAttributes.Any(a => a.AttributeType.Name == "AutoGeneratedAttribute"))); + IEnumerable optionsEnumerated = options as IList ?? options.ToList(); foreach (var wrapper in wrapper_signatures) { var autogenerated = wrapper.CustomAttributes @@ -204,7 +206,7 @@ namespace OpenTK.Rewrite var signature = entry_signatures.FirstOrDefault(s => s.Name == signature_name); int slot = GetSlot(signature); - ProcessMethod(wrapper, signature, slot, entry_points, options); + ProcessMethod(wrapper, signature, slot, entry_points, optionsEnumerated); } } @@ -214,7 +216,7 @@ namespace OpenTK.Rewrite { foreach (var nested_type in type.NestedTypes) { - Rewrite(nested_type, entry_points, entry_signatures, options); + Rewrite(nested_type, entry_points, entry_signatures, optionsEnumerated); } } } @@ -248,7 +250,7 @@ namespace OpenTK.Rewrite // Create body for method static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot, - FieldDefinition entry_points, List options) + FieldDefinition entry_points, IEnumerable options) { var body = wrapper.Body; var il = body.GetILProcessor(); @@ -259,7 +261,8 @@ namespace OpenTK.Rewrite // and push each parameter on the stack DebugVariables vars = null; - if (options.Contains("-debug")) + IEnumerable optionsEnumerated = options as IList ?? options.ToList(); + if (optionsEnumerated.Contains("-debug")) { vars = EmitDebugPrologue(wrapper, il); } @@ -297,7 +300,7 @@ namespace OpenTK.Rewrite EmitParameterEpilogues(wrapper, native, body, il, generatedVariables); - if (options.Contains("-debug")) + if (optionsEnumerated.Contains("-debug")) { EmitDebugEpilogue(wrapper, il, vars); } From b8975c5626004e86f471aa23f292b1af8ec2b8d3 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 30 May 2017 18:16:45 +0200 Subject: [PATCH 37/37] Added catching of error thrown when the assembly has been rewritten but the debug symbols do not match. --- src/Generator.Rewrite/Program.cs | 79 +++++++++++++++++--------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index dc8bfcf6..4b6f2b8a 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -90,58 +90,65 @@ namespace OpenTK.Rewrite } // Load assembly and process all modules - using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(file, read_params)) + try { - var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute"); - if (rewritten == null) + using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(file, read_params)) { - foreach (var module in assembly.Modules) + var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute"); + if (rewritten == null) { - foreach (var reference in module.AssemblyReferences) + foreach (var module in assembly.Modules) { - try + foreach (var reference in module.AssemblyReferences) { - var resolved = module.AssemblyResolver.Resolve(reference); - if (reference.Name == "mscorlib") + try { - mscorlib = resolved; + var resolved = module.AssemblyResolver.Resolve(reference); + if (reference.Name == "mscorlib") + { + mscorlib = resolved; + } + } + catch (Exception e) + { + Console.Error.WriteLine(e.ToString()); } } - catch (Exception e) + } + + if (mscorlib == null) + { + Console.Error.WriteLine("Failed to locate mscorlib"); + return; + } + TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); + TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder"); + TypeVoid = mscorlib.MainModule.GetType("System.Void"); + TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); + TypeInt32 = mscorlib.MainModule.GetType("System.Int32"); + + TypeBindingsBase = assembly.Modules.Select(m => m.GetType("OpenTK.BindingsBase")).First(); + + foreach (var module in assembly.Modules) + { + foreach (var type in module.Types) { - Console.Error.WriteLine(e.ToString()); + Rewrite(type, optionsEnumerated); } } } - - if (mscorlib == null) + else { - Console.Error.WriteLine("Failed to locate mscorlib"); - return; + Console.Error.WriteLine("Error: assembly has already been rewritten"); } - TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); - TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder"); - TypeVoid = mscorlib.MainModule.GetType("System.Void"); - TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); - TypeInt32 = mscorlib.MainModule.GetType("System.Int32"); - TypeBindingsBase = assembly.Modules.Select(m => m.GetType("OpenTK.BindingsBase")).First(); - - foreach (var module in assembly.Modules) - { - foreach (var type in module.Types) - { - Rewrite(type, optionsEnumerated); - } - } + // Save rewritten assembly + assembly.Write(write_params); } - else - { - Console.Error.WriteLine("Error: assembly has already been rewritten"); - } - - // Save rewritten assembly - assembly.Write(write_params); + } + catch (InvalidOperationException inex) + { + Console.WriteLine("Failed to load the assembly. It may already have been rewritten, and the debug symbols no longer match."); } }