From b238cc64d85af7fe81d61ac2e13c708effc578df Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 9 Feb 2022 01:04:21 -0500 Subject: [PATCH 01/47] Move iOS projects to a new sdk --- .../ControlCatalog.iOS.csproj | 185 +----------------- samples/ControlCatalog.iOS/Main.cs | 4 +- .../Properties/AssemblyInfo.cs | 36 ---- src/iOS/Avalonia.iOS/Avalonia.iOS.csproj | 14 +- src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs | 4 +- .../Avalonia.iOS/Boilerplate/AppBuilder.cs | 14 -- src/iOS/Avalonia.iOS/EaglDisplay.cs | 1 - src/iOS/Avalonia.iOS/Platform.cs | 15 ++ 8 files changed, 28 insertions(+), 245 deletions(-) delete mode 100644 samples/ControlCatalog.iOS/Properties/AssemblyInfo.cs delete mode 100644 src/iOS/Avalonia.iOS/Boilerplate/AppBuilder.cs diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj index db1e16166a..409223fa81 100644 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj +++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj @@ -1,186 +1,11 @@ - - + - Debug - iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe - ControlCatalog.iOS - Resources - ControlCatalogiOS - true - NSUrlSessionHandler - PackageReference - automatic + net6.0-ios + 14.2 - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG - prompt - 4 - false - x86_64 - None - True - 9.1 - False - False - False - False - False - False - False - False - True - Default - HttpClientHandler - False - - - none - true - bin\iPhoneSimulator\Release - prompt - 4 - None - x86_64 - false - - - true - full - false - bin\iPhone\Debug - DEBUG - prompt - 4 - false - ARMv7, ARM64 - Entitlements.plist - iPhone Developer - true - - - none - true - bin\iPhone\Release - prompt - 4 - Entitlements.plist - ARMv7, ARM64 - false - iPhone Developer - - - none - True - bin\iPhone\Ad-Hoc - prompt - 4 - False - ARMv7, ARM64 - Entitlements.plist - True - Automatic:AdHoc - iPhone Distribution - - - none - True - bin\iPhone\AppStore - prompt - 4 - False - ARMv7, ARM64 - Entitlements.plist - Automatic:AppStore - iPhone Distribution - - - - - - - - - - - - - - - - - {4488AD85-1495-4809-9AA4-DDFE0A48527E} - Avalonia.iOS - false - false - - - {3E53A01A-B331-47F3-B828-4A5717E77A24} - Avalonia.Markup.Xaml - - - {6417E941-21BC-467B-A771-0DE389353CE6} - Avalonia.Markup - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {D2221C82-4A25-4583-9B43-D791E3F6820C} - Avalonia.Controls - - - {7062AE20-5DCC-4442-9645-8195BDECE63E} - Avalonia.Diagnostics - - - {62024B2D-53EB-4638-B26B-85EEAA54866E} - Avalonia.Input - - - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Avalonia.Interactivity - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Avalonia.Styling - - - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F} - Avalonia.Themes.Default - - - {7d2d3083-71dd-4cc9-8907-39a0d86fb322} - Avalonia.Skia - - - {d0a739b9-3c68-4ba6-a328-41606954b6bd} - ControlCatalog - - + + - - - - diff --git a/samples/ControlCatalog.iOS/Main.cs b/samples/ControlCatalog.iOS/Main.cs index fe039ba69e..2400115041 100644 --- a/samples/ControlCatalog.iOS/Main.cs +++ b/samples/ControlCatalog.iOS/Main.cs @@ -9,7 +9,7 @@ namespace ControlCatalog.iOS { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. - UIApplication.Main(args, null, "AppDelegate"); + UIApplication.Main(args, null, typeof(AppDelegate)); } } -} \ No newline at end of file +} diff --git a/samples/ControlCatalog.iOS/Properties/AssemblyInfo.cs b/samples/ControlCatalog.iOS/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a5a598651..0000000000 --- a/samples/ControlCatalog.iOS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ControlCatalog.iOS")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ControlCatalog.iOS")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("57e0455d-d565-44bb-b069-ee1aa20f8337")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj index e9015d857c..f1fef8fd14 100644 --- a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj +++ b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj @@ -1,17 +1,11 @@ - + - xamarin.ios10 + net6.0-ios true - latest + 10.0 - - - - - - TargetFramework=netstandard2.0 - + diff --git a/src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs b/src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs index b75aad17cf..65a6743f9d 100644 --- a/src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs +++ b/src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs @@ -8,7 +8,7 @@ namespace Avalonia.iOS public class AvaloniaAppDelegate : UIResponder, IUIApplicationDelegate where TApp : Application, new() { - protected virtual AppBuilder CustomizeAppBuilder(AppBuilder builder) => builder; + protected virtual AppBuilder CustomizeAppBuilder(AppBuilder builder) => builder.UseiOS(); [Export("window")] public UIWindow Window { get; set; } @@ -46,4 +46,4 @@ namespace Avalonia.iOS } } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/Boilerplate/AppBuilder.cs b/src/iOS/Avalonia.iOS/Boilerplate/AppBuilder.cs deleted file mode 100644 index d5830510f6..0000000000 --- a/src/iOS/Avalonia.iOS/Boilerplate/AppBuilder.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Avalonia.Controls; -using Avalonia.PlatformSupport; - -namespace Avalonia -{ - public class AppBuilder : AppBuilderBase - { - public AppBuilder() : base(new StandardRuntimePlatform(), - b => StandardRuntimePlatformServices.Register(b.ApplicationType.Assembly)) - { - this.UseSkia().UseWindowingSubsystem(iOS.Platform.Register); - } - } -} diff --git a/src/iOS/Avalonia.iOS/EaglDisplay.cs b/src/iOS/Avalonia.iOS/EaglDisplay.cs index f9c787b6a8..f1d46fcb92 100644 --- a/src/iOS/Avalonia.iOS/EaglDisplay.cs +++ b/src/iOS/Avalonia.iOS/EaglDisplay.cs @@ -2,7 +2,6 @@ using System; using System.Reactive.Disposables; using Avalonia.OpenGL; using OpenGLES; -using OpenTK.Graphics.ES30; namespace Avalonia.iOS { diff --git a/src/iOS/Avalonia.iOS/Platform.cs b/src/iOS/Avalonia.iOS/Platform.cs index 88f60ace1f..57a86cbfd8 100644 --- a/src/iOS/Avalonia.iOS/Platform.cs +++ b/src/iOS/Avalonia.iOS/Platform.cs @@ -1,10 +1,25 @@ using System; + +using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.OpenGL; using Avalonia.Platform; using Avalonia.Rendering; +namespace Avalonia +{ + public static class IOSApplicationExtensions + { + public static T UseiOS(this T builder) where T : AppBuilderBase, new() + { + return builder + .UseWindowingSubsystem(iOS.Platform.Register, "iOS") + .UseSkia(); + } + } +} + namespace Avalonia.iOS { static class Platform From b045393df3931e33d4fbefc8ff3ea28068386014 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 22 Feb 2022 22:07:16 -0500 Subject: [PATCH 02/47] Do not reference DevTools from shared control catalog --- .../ControlCatalog.NetCore/ControlCatalog.NetCore.csproj | 1 + samples/ControlCatalog.NetCore/Program.cs | 7 +++++++ samples/ControlCatalog/App.xaml.cs | 5 ----- samples/ControlCatalog/ControlCatalog.csproj | 1 - .../interop/WindowsInteropTest/WindowsInteropTest.csproj | 1 + 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index 5968a11b05..d1b657722c 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -13,6 +13,7 @@ + diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 0c8fd9465c..4b81935452 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -118,6 +118,13 @@ namespace ControlCatalog.NetCore }) .UseSkia() .UseManagedSystemDialogs() + .AfterSetup(builder => + { + builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() + { + StartupScreenIndex = 1, + }); + }) .LogToTrace(); static void SilenceConsole() diff --git a/samples/ControlCatalog/App.xaml.cs b/samples/ControlCatalog/App.xaml.cs index f6d382f99d..866fb8632a 100644 --- a/samples/ControlCatalog/App.xaml.cs +++ b/samples/ControlCatalog/App.xaml.cs @@ -78,11 +78,6 @@ namespace ControlCatalog if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) { desktopLifetime.MainWindow = new MainWindow(); - - this.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() - { - StartupScreenIndex = 1, - }); } else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime) { diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 7864459e77..c0e24357ca 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -23,7 +23,6 @@ - diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 0c18a1f58b..223a53d8c5 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -8,6 +8,7 @@ + {d0a739b9-3c68-4ba6-a328-41606954b6bd} From 4756a0a769de4b3ddbba5fda42a8ebb7b78ee69f Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 23 Feb 2022 22:56:39 -0500 Subject: [PATCH 03/47] Fix iOS OpenGL rendering with newer Skia --- .../Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs | 13 +++++++++---- src/iOS/Avalonia.iOS/EaglDisplay.cs | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs b/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs index b4c5619c85..809f50ab8b 100644 --- a/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs @@ -69,6 +69,7 @@ namespace Avalonia.Skia gl.GetIntegerv(GL_FRAMEBUFFER_BINDING, out var fb); var size = glSession.Size; + var colorType = SKColorType.Rgba8888; var scaling = glSession.Scaling; if (size.Width <= 0 || size.Height <= 0 || scaling < 0) { @@ -81,12 +82,16 @@ namespace Avalonia.Skia { _grContext.ResetContext(); - var renderTarget = - new GRBackendRenderTarget(size.Width, size.Height, disp.SampleCount, disp.StencilSize, - new GRGlFramebufferInfo((uint)fb, SKColorType.Rgba8888.ToGlSizedFormat())); + var samples = disp.SampleCount; + var maxSamples = _grContext.GetMaxSurfaceSampleCount(colorType); + if (samples > maxSamples) + samples = maxSamples; + + var glInfo = new GRGlFramebufferInfo((uint)fb, colorType.ToGlSizedFormat()); + var renderTarget = new GRBackendRenderTarget(size.Width, size.Height, samples, disp.StencilSize, glInfo); var surface = SKSurface.Create(_grContext, renderTarget, glSession.IsYFlipped ? GRSurfaceOrigin.TopLeft : GRSurfaceOrigin.BottomLeft, - SKColorType.Rgba8888); + colorType); success = true; diff --git a/src/iOS/Avalonia.iOS/EaglDisplay.cs b/src/iOS/Avalonia.iOS/EaglDisplay.cs index f1d46fcb92..bd1969081d 100644 --- a/src/iOS/Avalonia.iOS/EaglDisplay.cs +++ b/src/iOS/Avalonia.iOS/EaglDisplay.cs @@ -74,7 +74,21 @@ namespace Avalonia.iOS public GlVersion Version { get; } = new GlVersion(GlProfileType.OpenGLES, 3, 0); public GlInterface GlInterface { get; } - public int SampleCount { get; } = 0; - public int StencilSize { get; } = 9; + public int SampleCount + { + get + { + GlInterface.GetIntegerv(GlConsts.GL_SAMPLES, out var samples); + return samples; + } + } + public int StencilSize + { + get + { + GlInterface.GetIntegerv(GlConsts.GL_STENCIL_BITS, out var stencil); + return stencil; + } + } } } From 138d65556bdff43e14d6ceef1b26275fa36984d1 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 23 Feb 2022 23:01:00 -0500 Subject: [PATCH 04/47] Use out own opengl interface wrapper --- src/iOS/Avalonia.iOS/EaglLayerSurface.cs | 5 +- src/iOS/Avalonia.iOS/Extensions.cs | 3 +- src/iOS/Avalonia.iOS/LayerFbo.cs | 79 +++++++++++++----------- 3 files changed, 48 insertions(+), 39 deletions(-) diff --git a/src/iOS/Avalonia.iOS/EaglLayerSurface.cs b/src/iOS/Avalonia.iOS/EaglLayerSurface.cs index 5e5e1da949..0e8945d921 100644 --- a/src/iOS/Avalonia.iOS/EaglLayerSurface.cs +++ b/src/iOS/Avalonia.iOS/EaglLayerSurface.cs @@ -4,7 +4,6 @@ using System.Threading; using Avalonia.OpenGL; using Avalonia.OpenGL.Surfaces; using CoreAnimation; -using OpenTK.Graphics.ES30; namespace Avalonia.iOS { @@ -35,7 +34,7 @@ namespace Avalonia.iOS public void Dispose() { - GL.Finish(); + _ctx.GlInterface.Finish(); _fbo.Present(); _restoreContext.Dispose(); } @@ -85,7 +84,7 @@ namespace Avalonia.iOS var ctx = Platform.GlFeature.Context; using (ctx.MakeCurrent()) { - var fbo = new SizeSynchronizedLayerFbo(ctx.Context, _layer); + var fbo = new SizeSynchronizedLayerFbo(ctx.Context, ctx.GlInterface, _layer); if (!fbo.Sync()) throw new InvalidOperationException("Unable to create render target"); return new RenderTarget(ctx, fbo); diff --git a/src/iOS/Avalonia.iOS/Extensions.cs b/src/iOS/Avalonia.iOS/Extensions.cs index bf6262e5c5..819a1386e8 100644 --- a/src/iOS/Avalonia.iOS/Extensions.cs +++ b/src/iOS/Avalonia.iOS/Extensions.cs @@ -1,6 +1,7 @@ using System; using Avalonia.Media; using CoreGraphics; +using ObjCRuntime; using UIKit; namespace Avalonia.iOS @@ -20,4 +21,4 @@ namespace Avalonia.iOS ColorComponent(color.B), ColorComponent(color.A)); } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/LayerFbo.cs b/src/iOS/Avalonia.iOS/LayerFbo.cs index 907af58c7e..bd05f3b852 100644 --- a/src/iOS/Avalonia.iOS/LayerFbo.cs +++ b/src/iOS/Avalonia.iOS/LayerFbo.cs @@ -1,64 +1,72 @@ using System; +using Avalonia.OpenGL; using CoreAnimation; +using ObjCRuntime; using OpenGLES; -using OpenTK.Graphics.ES20; namespace Avalonia.iOS { public class LayerFbo { private readonly EAGLContext _context; + private readonly GlInterface _gl; private readonly CAEAGLLayer _layer; - private int _framebuffer; - private int _renderbuffer; - private int _depthBuffer; + private int[] _framebuffer; + private int[] _renderbuffer; + private int[] _depthBuffer; private bool _disposed; - private LayerFbo(EAGLContext context, CAEAGLLayer layer, in int framebuffer, in int renderbuffer, in int depthBuffer) + private LayerFbo(EAGLContext context, GlInterface gl, CAEAGLLayer layer, int[] framebuffer, int[] renderbuffer, int[] depthBuffer) { _context = context; + _gl = gl; _layer = layer; _framebuffer = framebuffer; _renderbuffer = renderbuffer; _depthBuffer = depthBuffer; } - public static LayerFbo TryCreate(EAGLContext context, CAEAGLLayer layer) + public static LayerFbo TryCreate(EAGLContext context, GlInterface gl, CAEAGLLayer layer) { if (context != EAGLContext.CurrentContext) return null; - GL.GenFramebuffers(1, out int fb); - GL.GenRenderbuffers(1, out int rb); - GL.BindFramebuffer(FramebufferTarget.Framebuffer, fb); - GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, rb); - context.RenderBufferStorage((uint) All.Renderbuffer, layer); + + var fb = new int[2]; + var rb = new int[2]; + var db = new int[2]; - GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0, RenderbufferTarget.Renderbuffer, rb); + gl.GenRenderbuffers(1, rb); + gl.BindRenderbuffer(GlConsts.GL_RENDERBUFFER, rb[0]); + context.RenderBufferStorage(GlConsts.GL_RENDERBUFFER, layer); + + gl.GenFramebuffers(1, fb); + gl.BindFramebuffer(GlConsts.GL_FRAMEBUFFER, fb[0]); + gl.FramebufferRenderbuffer(GlConsts.GL_FRAMEBUFFER, GlConsts.GL_COLOR_ATTACHMENT0, GlConsts.GL_RENDERBUFFER, rb[0]); - int w; - int h; - GL.GetRenderbufferParameter(RenderbufferTarget.Renderbuffer, RenderbufferParameterName.RenderbufferWidth, out w); - GL.GetRenderbufferParameter(RenderbufferTarget.Renderbuffer, RenderbufferParameterName.RenderbufferHeight, out h); + int[] w = new int[1]; + int[] h = new int[1]; + gl.GetRenderbufferParameteriv(GlConsts.GL_RENDERBUFFER, GlConsts.GL_RENDERBUFFER_WIDTH, w); + gl.GetRenderbufferParameteriv(GlConsts.GL_RENDERBUFFER, GlConsts.GL_RENDERBUFFER_HEIGHT, h); - GL.GenRenderbuffers(1, out int depthBuffer); + gl.GenRenderbuffers(1, db); //GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, depthBuffer); //GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferInternalFormat.DepthComponent16, w, h); - GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferSlot.DepthAttachment, RenderbufferTarget.Renderbuffer, depthBuffer); + gl.FramebufferRenderbuffer(GlConsts.GL_FRAMEBUFFER, GlConsts.GL_DEPTH_ATTACHMENT, GlConsts.GL_RENDERBUFFER, db[0]); - var frameBufferError = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer); - if(frameBufferError != FramebufferErrorCode.FramebufferComplete) + var frameBufferError = gl.CheckFramebufferStatus(GlConsts.GL_FRAMEBUFFER); + if(frameBufferError != GlConsts.GL_FRAMEBUFFER_COMPLETE) { - GL.DeleteFramebuffers(1, ref fb); - GL.DeleteRenderbuffers(1, ref depthBuffer); - GL.DeleteRenderbuffers(1, ref rb); + gl.DeleteFramebuffers(1, fb); + gl.DeleteRenderbuffers(1, db); + gl.DeleteRenderbuffers(1, rb); return null; } - return new LayerFbo(context, layer, fb, rb, depthBuffer) + return new LayerFbo(context, gl, layer, fb, rb, db) { - Width = w, - Height = h + Width = w[0], + Height = h[0] }; } @@ -67,13 +75,13 @@ namespace Avalonia.iOS public void Bind() { - GL.BindFramebuffer(FramebufferTarget.Framebuffer, _framebuffer); + _gl.BindFramebuffer(GlConsts.GL_FRAMEBUFFER, _framebuffer[0]); } public void Present() { Bind(); - var success = _context.PresentRenderBuffer((uint) All.Renderbuffer); + var success = _context.PresentRenderBuffer(GlConsts.GL_RENDERBUFFER); } public void Dispose() @@ -81,9 +89,9 @@ namespace Avalonia.iOS if(_disposed) return; _disposed = true; - GL.DeleteFramebuffers(1, ref _framebuffer); - GL.DeleteRenderbuffers(1, ref _depthBuffer); - GL.DeleteRenderbuffers(1, ref _renderbuffer); + _gl.DeleteFramebuffers(1, _framebuffer); + _gl.DeleteRenderbuffers(1, _depthBuffer); + _gl.DeleteRenderbuffers(1, _renderbuffer); if (_context != EAGLContext.CurrentContext) throw new InvalidOperationException("Associated EAGLContext is not current"); } @@ -92,15 +100,16 @@ namespace Avalonia.iOS class SizeSynchronizedLayerFbo : IDisposable { private readonly EAGLContext _context; + private readonly GlInterface _gl; private readonly CAEAGLLayer _layer; private LayerFbo _fbo; private nfloat _oldLayerWidth, _oldLayerHeight, _oldLayerScale; - public SizeSynchronizedLayerFbo(EAGLContext context, CAEAGLLayer layer) + public SizeSynchronizedLayerFbo(EAGLContext context, GlInterface gl, CAEAGLLayer layer) { _context = context; + _gl = gl; _layer = layer; - } public bool Sync() @@ -112,7 +121,7 @@ namespace Avalonia.iOS return true; _fbo?.Dispose(); _fbo = null; - _fbo = LayerFbo.TryCreate(_context, _layer); + _fbo = LayerFbo.TryCreate(_context, _gl, _layer); _oldLayerWidth = _layer.Bounds.Width; _oldLayerHeight = _layer.Bounds.Height; _oldLayerScale = _layer.ContentsScale; @@ -140,4 +149,4 @@ namespace Avalonia.iOS public int Height => _fbo?.Height ?? 0; public double Scaling => _oldLayerScale; } -} \ No newline at end of file +} From bc1d950a9bc91a131cb337879668f13253701d4a Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 23 Feb 2022 23:04:09 -0500 Subject: [PATCH 05/47] Update legacy projects targets --- src/Android/Avalonia.Android/Avalonia.Android.csproj | 3 ++- src/iOS/Avalonia.iOS/Avalonia.iOS.csproj | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Android/Avalonia.Android/Avalonia.Android.csproj b/src/Android/Avalonia.Android/Avalonia.Android.csproj index 6393ef3405..4fac2fcf21 100644 --- a/src/Android/Avalonia.Android/Avalonia.Android.csproj +++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj @@ -1,6 +1,7 @@  - net6.0-android;monoandroid11.0 + net6.0-android + net6.0-ios;monoandroid11.0 21 true true diff --git a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj index f1fef8fd14..1b3a952e8f 100644 --- a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj +++ b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj @@ -1,8 +1,9 @@ - + - net6.0-ios - true + net6.0-ios + $(TargetFrameworks);xamarin.ios10 10.0 + true From 9bc881e4a707872b024aabe314769fe8e192ed3a Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 23 Feb 2022 23:12:25 -0500 Subject: [PATCH 06/47] Update iOS control catalog projects --- .gitignore | 1 - Avalonia.sln | 78 ++++++++---- azure-pipelines.yml | 2 +- dirs.proj | 9 +- .../ControlCatalog.iOS.Legacy/AppDelegate.cs | 15 +++ .../AppIcon.appiconset/Contents.json | 117 ++++++++++++++++++ .../ControlCatalog.iOS.Legacy.csproj | 99 +++++++++++++++ .../Entitlements.plist | 6 + samples/ControlCatalog.iOS.Legacy/Info.plist | 43 +++++++ samples/ControlCatalog.iOS.Legacy/Main.cs | 15 +++ .../Resources/LaunchScreen.xib | 43 +++++++ .../ControlCatalog.iOS.csproj | 15 ++- samples/ControlCatalog.iOS/Info.plist | 3 +- 13 files changed, 412 insertions(+), 34 deletions(-) create mode 100644 samples/ControlCatalog.iOS.Legacy/AppDelegate.cs create mode 100644 samples/ControlCatalog.iOS.Legacy/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 samples/ControlCatalog.iOS.Legacy/ControlCatalog.iOS.Legacy.csproj create mode 100644 samples/ControlCatalog.iOS.Legacy/Entitlements.plist create mode 100644 samples/ControlCatalog.iOS.Legacy/Info.plist create mode 100644 samples/ControlCatalog.iOS.Legacy/Main.cs create mode 100644 samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib diff --git a/.gitignore b/.gitignore index 9b15011929..d7c4cdefde 100644 --- a/.gitignore +++ b/.gitignore @@ -198,7 +198,6 @@ Index/ Logs/ ModuleCache.noindex/ Build/Intermediates.noindex/ -info.plist build-intermediate obj-Direct2D1/ obj-Skia/ diff --git a/Avalonia.sln b/Avalonia.sln index 104245118a..e0b3eaed71 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -95,8 +95,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog", "samples\C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Desktop", "samples\ControlCatalog.Desktop\ControlCatalog.Desktop.csproj", "{2B888490-D14A-4BCA-AB4B-48676FA93C9B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{57E0455D-D565-44BB-B069-EE1AA20F8337}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesignerSupport.Tests", "tests\Avalonia.DesignerSupport.Tests\Avalonia.DesignerSupport.Tests.csproj", "{52F55355-D120-42AC-8116-8410A7D602FA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesignerSupport.TestApp", "tests\Avalonia.DesignerSupport.TestApp\Avalonia.DesignerSupport.TestApp.csproj", "{F1381F98-4D24-409A-A6C5-1C5B1E08BB08}" @@ -121,7 +119,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Props", "Props", "{F3AC8BC1 build\CoreLibraries.props = build\CoreLibraries.props build\EmbedXaml.props = build\EmbedXaml.props build\HarfBuzzSharp.props = build\HarfBuzzSharp.props - build\iOSWorkarounds.props = build\iOSWorkarounds.props build\JetBrains.Annotations.props = build\JetBrains.Annotations.props build\JetBrains.dotMemoryUnit.props = build\JetBrains.dotMemoryUnit.props build\Magick.NET-Q16-AnyCPU.props = build\Magick.NET-Q16-AnyCPU.props @@ -231,6 +228,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlSamples", "samples\S EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.PlatformSupport", "src\Avalonia.PlatformSupport\Avalonia.PlatformSupport.csproj", "{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.iOS.Legacy", "samples\ControlCatalog.iOS.Legacy\ControlCatalog.iOS.Legacy.csproj", "{3AF75F00-B497-4517-9491-922173DE216E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -1093,26 +1094,6 @@ Global {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhone.Build.0 = Release|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.AppStore|iPhone.Build.0 = AppStore|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Debug|iPhone.ActiveCfg = Debug|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Debug|iPhone.Build.0 = Debug|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|Any CPU.ActiveCfg = Release|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|iPhone.ActiveCfg = Release|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|iPhone.Build.0 = Release|iPhone - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -2157,6 +2138,54 @@ Global {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhone.Build.0 = Release|Any CPU {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhone.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhone.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|Any CPU.Build.0 = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhone.ActiveCfg = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhone.Build.0 = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|iPhone.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|iPhone.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|Any CPU.Build.0 = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|iPhone.ActiveCfg = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|iPhone.Build.0 = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {3AF75F00-B497-4517-9491-922173DE216E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2186,7 +2215,6 @@ Global {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {D0A739B9-3C68-4BA6-A328-41606954B6BD} = {9B9E3891-2366-4253-A952-D08BCEB71098} {2B888490-D14A-4BCA-AB4B-48676FA93C9B} = {9B9E3891-2366-4253-A952-D08BCEB71098} - {57E0455D-D565-44BB-B069-EE1AA20F8337} = {9B9E3891-2366-4253-A952-D08BCEB71098} {52F55355-D120-42AC-8116-8410A7D602FA} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {F1381F98-4D24-409A-A6C5-1C5B1E08BB08} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {FBCAF3D0-2808-4934-8E96-3F607594517B} = {9B9E3891-2366-4253-A952-D08BCEB71098} @@ -2218,6 +2246,8 @@ Global {C08E9894-AA92-426E-BF56-033E262CAD3E} = {9B9E3891-2366-4253-A952-D08BCEB71098} {26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9} {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270} = {9B9E3891-2366-4253-A952-D08BCEB71098} + {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B} = {9B9E3891-2366-4253-A952-D08BCEB71098} + {3AF75F00-B497-4517-9491-922173DE216E} = {9B9E3891-2366-4253-A952-D08BCEB71098} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ede5aec0e8..ddb47c67db 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -147,7 +147,7 @@ jobs: displayName: 'Install Workloads' inputs: script: | - dotnet workload install android + dotnet workload install android ios - task: CmdLine@2 displayName: 'Install Nuke' diff --git a/dirs.proj b/dirs.proj index 74d7b482cc..396e0c915c 100644 --- a/dirs.proj +++ b/dirs.proj @@ -10,21 +10,20 @@ + + - - - - - + + diff --git a/samples/ControlCatalog.iOS.Legacy/AppDelegate.cs b/samples/ControlCatalog.iOS.Legacy/AppDelegate.cs new file mode 100644 index 0000000000..a67de98259 --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/AppDelegate.cs @@ -0,0 +1,15 @@ +using Avalonia.iOS; +using Foundation; +using UIKit; + +namespace ControlCatalog.iOS.Legacy +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("AppDelegate")] + public partial class AppDelegate : AvaloniaAppDelegate + { + + } +} diff --git a/samples/ControlCatalog.iOS.Legacy/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/ControlCatalog.iOS.Legacy/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..98f4d035c8 --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,117 @@ +{ + "images": [ + { + "scale": "2x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon40.png" + }, + { + "scale": "3x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon60.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon58.png" + }, + { + "scale": "3x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon87.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon80.png" + }, + { + "scale": "3x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "2x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "3x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon180.png" + }, + { + "scale": "1x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon20.png" + }, + { + "scale": "2x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "1x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon29.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon58.png" + }, + { + "scale": "1x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon80.png" + }, + { + "scale": "1x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon76.png" + }, + { + "scale": "2x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon152.png" + }, + { + "scale": "2x", + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon167.png" + }, + { + "scale": "1x", + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon1024.png" + } + ], + "properties": {}, + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/samples/ControlCatalog.iOS.Legacy/ControlCatalog.iOS.Legacy.csproj b/samples/ControlCatalog.iOS.Legacy/ControlCatalog.iOS.Legacy.csproj new file mode 100644 index 0000000000..045114ff5a --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/ControlCatalog.iOS.Legacy.csproj @@ -0,0 +1,99 @@ + + + xamarin.ios10 + 15.0 + true + Debug + iPhoneSimulator + {3AF75F00-B497-4517-9491-922173DE216E} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + ControlCatalog.iOS.Legacy + Resources + ControlCatalog.iOS.Legacy + NSUrlSessionHandler + manual + -all + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + false + x86_64 + None + true + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + false + ARM64 + Entitlements.plist + true + + + none + true + bin\iPhone\Release + prompt + 4 + Entitlements.plist + ARM64 + false + + + + + + + + + + + + + + false + + + + + + + + {d2221c82-4a25-4583-9b43-d791e3f6820c} + Avalonia.Controls + + + {4488ad85-1495-4809-9aa4-ddfe0a48527e} + Avalonia.iOS + + + {d0a739b9-3c68-4ba6-a328-41606954b6bd} + ControlCatalog + + + + + + diff --git a/samples/ControlCatalog.iOS.Legacy/Entitlements.plist b/samples/ControlCatalog.iOS.Legacy/Entitlements.plist new file mode 100644 index 0000000000..36a8706706 --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/ControlCatalog.iOS.Legacy/Info.plist b/samples/ControlCatalog.iOS.Legacy/Info.plist new file mode 100644 index 0000000000..45dbd05726 --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDisplayName + ControlCatalog + CFBundleIdentifier + com.companyname.ControlCatalog.iOS + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 15.0 + UIDeviceFamily + + 12 + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset + + diff --git a/samples/ControlCatalog.iOS.Legacy/Main.cs b/samples/ControlCatalog.iOS.Legacy/Main.cs new file mode 100644 index 0000000000..08b3831d73 --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/Main.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace ControlCatalog.iOS.Legacy +{ + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, "AppDelegate"); + } + } +} diff --git a/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib b/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib new file mode 100644 index 0000000000..35c3013b0e --- /dev/null +++ b/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj index 409223fa81..ec3d304c34 100644 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj +++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj @@ -1,11 +1,22 @@ - + + Exe + manual net6.0-ios - 14.2 + 10.0 + + True + iossimulator-x64 + + + + + + diff --git a/samples/ControlCatalog.iOS/Info.plist b/samples/ControlCatalog.iOS/Info.plist index 216fd9c333..144cb165ab 100644 --- a/samples/ControlCatalog.iOS/Info.plist +++ b/samples/ControlCatalog.iOS/Info.plist @@ -13,7 +13,7 @@ LSRequiresIPhoneOS MinimumOSVersion - 8.0 + 10.0 UIDeviceFamily 1 @@ -28,6 +28,7 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight From 6d506a65b6c70e32317011812c5fb1adf78b382d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 23 Feb 2022 23:52:34 -0500 Subject: [PATCH 07/47] Add UnmanagedFunctionPointer --- src/Avalonia.OpenGL/Egl/EglInterface.cs | 46 +++++++-- src/Avalonia.OpenGL/GlBasicInfoInterface.cs | 5 +- src/Avalonia.OpenGL/GlInterface.cs | 105 +++++++++++++++----- 3 files changed, 120 insertions(+), 36 deletions(-) diff --git a/src/Avalonia.OpenGL/Egl/EglInterface.cs b/src/Avalonia.OpenGL/Egl/EglInterface.cs index cadd7cc1f2..6148e58440 100644 --- a/src/Avalonia.OpenGL/Egl/EglInterface.cs +++ b/src/Avalonia.OpenGL/Egl/EglInterface.cs @@ -46,93 +46,114 @@ namespace Avalonia.OpenGL.Egl } // ReSharper disable UnassignedGetOnlyAutoProperty + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int EglGetError(); [GlEntryPoint("eglGetError")] public EglGetError GetError { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetDisplay(IntPtr nativeDisplay); [GlEntryPoint("eglGetDisplay")] public EglGetDisplay GetDisplay { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetPlatformDisplayEXT(int platform, IntPtr nativeDisplay, int[] attrs); [GlEntryPoint("eglGetPlatformDisplayEXT")] [GlOptionalEntryPoint] public EglGetPlatformDisplayEXT GetPlatformDisplayEXT { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglInitialize(IntPtr display, out int major, out int minor); [GlEntryPoint("eglInitialize")] - public EglInitialize Initialize { get; } - + public EglInitialize Initialize { get; } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetProcAddress(Utf8Buffer proc); [GlEntryPoint("eglGetProcAddress")] public EglGetProcAddress GetProcAddress { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglBindApi(int api); [GlEntryPoint("eglBindAPI")] public EglBindApi BindApi { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglChooseConfig(IntPtr display, int[] attribs, out IntPtr surfaceConfig, int numConfigs, out int choosenConfig); [GlEntryPoint("eglChooseConfig")] public EglChooseConfig ChooseConfig { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreateContext(IntPtr display, IntPtr config, IntPtr share, int[] attrs); [GlEntryPoint("eglCreateContext")] public EglCreateContext CreateContext { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglDestroyContext(IntPtr display, IntPtr context); [GlEntryPoint("eglDestroyContext")] public EglDestroyContext DestroyContext { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreatePBufferSurface(IntPtr display, IntPtr config, int[] attrs); [GlEntryPoint("eglCreatePbufferSurface")] public EglCreatePBufferSurface CreatePBufferSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglMakeCurrent(IntPtr display, IntPtr draw, IntPtr read, IntPtr context); [GlEntryPoint("eglMakeCurrent")] public EglMakeCurrent MakeCurrent { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentContext(); [GlEntryPoint("eglGetCurrentContext")] public EglGetCurrentContext GetCurrentContext { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentDisplay(); [GlEntryPoint("eglGetCurrentDisplay")] public EglGetCurrentContext GetCurrentDisplay { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentSurface(int readDraw); [GlEntryPoint("eglGetCurrentSurface")] public EglGetCurrentSurface GetCurrentSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void EglDisplaySurfaceVoidDelegate(IntPtr display, IntPtr surface); [GlEntryPoint("eglDestroySurface")] public EglDisplaySurfaceVoidDelegate DestroySurface { get; } [GlEntryPoint("eglSwapBuffers")] public EglDisplaySurfaceVoidDelegate SwapBuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreateWindowSurface(IntPtr display, IntPtr config, IntPtr window, int[] attrs); [GlEntryPoint("eglCreateWindowSurface")] public EglCreateWindowSurface CreateWindowSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglGetConfigAttrib(IntPtr display, IntPtr config, int attr, out int rv); [GlEntryPoint("eglGetConfigAttrib")] public EglGetConfigAttrib GetConfigAttrib { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitGL(); [GlEntryPoint("eglWaitGL")] public EglWaitGL WaitGL { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitClient(); [GlEntryPoint("eglWaitClient")] public EglWaitGL WaitClient { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitNative(int engine); [GlEntryPoint("eglWaitNative")] public EglWaitNative WaitNative { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglQueryString(IntPtr display, int i); [GlEntryPoint("eglQueryString")] @@ -145,17 +166,20 @@ namespace Avalonia.OpenGL.Egl return null; return Marshal.PtrToStringAnsi(rv); } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreatePbufferFromClientBuffer(IntPtr display, int buftype, IntPtr buffer, IntPtr config, int[] attrib_list); [GlEntryPoint("eglCreatePbufferFromClientBuffer")] public EglCreatePbufferFromClientBuffer CreatePbufferFromClientBuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglQueryDisplayAttribEXT(IntPtr display, int attr, out IntPtr res); [GlEntryPoint("eglQueryDisplayAttribEXT"), GlOptionalEntryPoint] public EglQueryDisplayAttribEXT QueryDisplayAttribExt { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglQueryDeviceAttribEXT(IntPtr display, int attr, out IntPtr res); [GlEntryPoint("eglQueryDeviceAttribEXT"), GlOptionalEntryPoint] diff --git a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs index a3383ac5ae..aaba2ec09c 100644 --- a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs +++ b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs @@ -15,9 +15,12 @@ namespace Avalonia.OpenGL public GlBasicInfoInterface(Func nativeGetProcAddress) : base(nativeGetProcAddress, null) { } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetIntegerv(int name, out int rv); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr GlGetString(int v); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr GlGetStringi(int v, int v1); } diff --git a/src/Avalonia.OpenGL/GlInterface.cs b/src/Avalonia.OpenGL/GlInterface.cs index cae245732f..3d947998af 100644 --- a/src/Avalonia.OpenGL/GlInterface.cs +++ b/src/Avalonia.OpenGL/GlInterface.cs @@ -60,22 +60,27 @@ namespace Avalonia.OpenGL public T GetProcAddress(string proc) => Marshal.GetDelegateForFunctionPointer(GetProcAddress(proc)); // ReSharper disable UnassignedGetOnlyAutoProperty + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlGetError(); [GlEntryPoint("glGetError")] public GlGetError GetError { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClearStencil(int s); [GlEntryPoint("glClearStencil")] public GlClearStencil ClearStencil { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClearColor(float r, float g, float b, float a); [GlEntryPoint("glClearColor")] public GlClearColor ClearColor { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClear(int bits); [GlEntryPoint("glClear")] public GlClear Clear { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlViewport(int x, int y, int width, int height); [GlEntryPoint("glViewport")] public GlViewport Viewport { get; } @@ -86,6 +91,7 @@ namespace Avalonia.OpenGL [GlEntryPoint("glFinish")] public Action Finish { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr GlGetString(int v); [GlEntryPoint("glGetString")] public GlGetString GetStringNative { get; } @@ -98,26 +104,32 @@ namespace Avalonia.OpenGL return null; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetIntegerv(int name, out int rv); [GlEntryPoint("glGetIntegerv")] public GlGetIntegerv GetIntegerv { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGenFramebuffers(int count, int[] res); [GlEntryPoint("glGenFramebuffers")] public GlGenFramebuffers GenFramebuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteFramebuffers(int count, int[] framebuffers); [GlEntryPoint("glDeleteFramebuffers")] public GlDeleteFramebuffers DeleteFramebuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBindFramebuffer(int target, int fb); [GlEntryPoint("glBindFramebuffer")] public GlBindFramebuffer BindFramebuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlCheckFramebufferStatus(int target); [GlEntryPoint("glCheckFramebufferStatus")] public GlCheckFramebufferStatus CheckFramebufferStatus { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBlitFramebuffer(int srcX0, int srcY0, int srcX1, @@ -130,69 +142,84 @@ namespace Avalonia.OpenGL int filter); [GlMinVersionEntryPoint("glBlitFramebuffer", 3, 0), GlOptionalEntryPoint] public GlBlitFramebuffer BlitFramebuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGenRenderbuffers(int count, int[] res); [GlEntryPoint("glGenRenderbuffers")] public GlGenRenderbuffers GenRenderbuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteRenderbuffers(int count, int[] renderbuffers); [GlEntryPoint("glDeleteRenderbuffers")] public GlDeleteTextures DeleteRenderbuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBindRenderbuffer(int target, int fb); [GlEntryPoint("glBindRenderbuffer")] public GlBindRenderbuffer BindRenderbuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlRenderbufferStorage(int target, int internalFormat, int width, int height); [GlEntryPoint("glRenderbufferStorage")] public GlRenderbufferStorage RenderbufferStorage { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlFramebufferRenderbuffer(int target, int attachment, int renderbufferTarget, int renderbuffer); [GlEntryPoint("glFramebufferRenderbuffer")] public GlFramebufferRenderbuffer FramebufferRenderbuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGenTextures(int count, int[] res); [GlEntryPoint("glGenTextures")] public GlGenTextures GenTextures { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBindTexture(int target, int fb); [GlEntryPoint("glBindTexture")] public GlBindTexture BindTexture { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlActiveTexture(int texture); [GlEntryPoint("glActiveTexture")] public GlActiveTexture ActiveTexture { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteTextures(int count, int[] textures); [GlEntryPoint("glDeleteTextures")] public GlDeleteTextures DeleteTextures { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, IntPtr data); [GlEntryPoint("glTexImage2D")] public GlTexImage2D TexImage2D { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height); [GlEntryPoint("glCopyTexSubImage2D")] public GlCopyTexSubImage2D CopyTexSubImage2D { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlTexParameteri(int target, int name, int value); [GlEntryPoint("glTexParameteri")] public GlTexParameteri TexParameteri { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlFramebufferTexture2D(int target, int attachment, int texTarget, int texture, int level); [GlEntryPoint("glFramebufferTexture2D")] public GlFramebufferTexture2D FramebufferTexture2D { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlCreateShader(int shaderType); [GlEntryPoint("glCreateShader")] public GlCreateShader CreateShader { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlShaderSource(int shader, int count, IntPtr strings, IntPtr lengths); [GlEntryPoint("glShaderSource")] public GlShaderSource ShaderSource { get; } @@ -207,14 +234,17 @@ namespace Avalonia.OpenGL } } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlCompileShader(int shader); [GlEntryPoint("glCompileShader")] public GlCompileShader CompileShader { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetShaderiv(int shader, int name, int* parameters); [GlEntryPoint("glGetShaderiv")] public GlGetShaderiv GetShaderiv { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetShaderInfoLog(int shader, int maxLength, out int length, void*infoLog); [GlEntryPoint("glGetShaderInfoLog")] public GlGetShaderInfoLog GetShaderInfoLog { get; } @@ -237,23 +267,28 @@ namespace Avalonia.OpenGL GetShaderInfoLog(shader, logLength, out len, ptr); return Encoding.UTF8.GetString(logData,0, len); } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlCreateProgram(); [GlEntryPoint("glCreateProgram")] public GlCreateProgram CreateProgram { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlAttachShader(int program, int shader); [GlEntryPoint("glAttachShader")] public GlAttachShader AttachShader { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlLinkProgram(int program); [GlEntryPoint("glLinkProgram")] public GlLinkProgram LinkProgram { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetProgramiv(int program, int name, int* parameters); [GlEntryPoint("glGetProgramiv")] public GlGetProgramiv GetProgramiv { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetProgramInfoLog(int program, int maxLength, out int len, void* infoLog); [GlEntryPoint("glGetProgramInfoLog")] public GlGetProgramInfoLog GetProgramInfoLog { get; } @@ -274,6 +309,7 @@ namespace Avalonia.OpenGL return Encoding.UTF8.GetString(logData,0, len); } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBindAttribLocation(int program, int index, IntPtr name); [GlEntryPoint("glBindAttribLocation")] public GlBindAttribLocation BindAttribLocation { get; } @@ -283,7 +319,8 @@ namespace Avalonia.OpenGL using (var b = new Utf8Buffer(name)) BindAttribLocation(program, index, b.DangerousGetHandle()); } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGenBuffers(int len, int[] rv); [GlEntryPoint("glGenBuffers")] public GlGenBuffers GenBuffers { get; } @@ -294,15 +331,18 @@ namespace Avalonia.OpenGL GenBuffers(1, rv); return rv[0]; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBindBuffer(int target, int buffer); [GlEntryPoint("glBindBuffer")] public GlBindBuffer BindBuffer { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlBufferData(int target, IntPtr size, IntPtr data, int usage); [GlEntryPoint("glBufferData")] public GlBufferData BufferData { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlGetAttribLocation(int program, IntPtr name); [GlEntryPoint("glGetAttribLocation")] public GlGetAttribLocation GetAttribLocation { get; } @@ -313,27 +353,33 @@ namespace Avalonia.OpenGL return GetAttribLocation(program, b.DangerousGetHandle()); } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlVertexAttribPointer(int index, int size, int type, int normalized, int stride, IntPtr pointer); [GlEntryPoint("glVertexAttribPointer")] public GlVertexAttribPointer VertexAttribPointer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlEnableVertexAttribArray(int index); [GlEntryPoint("glEnableVertexAttribArray")] public GlEnableVertexAttribArray EnableVertexAttribArray { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlUseProgram(int program); [GlEntryPoint("glUseProgram")] public GlUseProgram UseProgram { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDrawArrays(int mode, int first, IntPtr count); [GlEntryPoint("glDrawArrays")] public GlDrawArrays DrawArrays { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDrawElements(int mode, int count, int type, IntPtr indices); [GlEntryPoint("glDrawElements")] public GlDrawElements DrawElements { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlGetUniformLocation(int program, IntPtr name); [GlEntryPoint("glGetUniformLocation")] public GlGetUniformLocation GetUniformLocation { get; } @@ -343,31 +389,42 @@ namespace Avalonia.OpenGL using (var b = new Utf8Buffer(name)) return GetUniformLocation(program, b.DangerousGetHandle()); } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlUniform1f(int location, float falue); [GlEntryPoint("glUniform1f")] public GlUniform1f Uniform1f { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlUniformMatrix4fv(int location, int count, bool transpose, void* value); [GlEntryPoint("glUniformMatrix4fv")] public GlUniformMatrix4fv UniformMatrix4fv { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlEnable(int what); [GlEntryPoint("glEnable")] public GlEnable Enable { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteBuffers(int count, int[] buffers); [GlEntryPoint("glDeleteBuffers")] public GlDeleteBuffers DeleteBuffers { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteProgram(int program); [GlEntryPoint("glDeleteProgram")] public GlDeleteProgram DeleteProgram { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlDeleteShader(int shader); [GlEntryPoint("glDeleteShader")] public GlDeleteShader DeleteShader { get; } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void GLGetRenderbufferParameteriv(int target, int name, int[] value); + [GlEntryPoint("glGetRenderbufferParameteriv")] + public GLGetRenderbufferParameteriv GetRenderbufferParameteriv { get; } // ReSharper restore UnassignedGetOnlyAutoProperty } } From 1a7a70f801c41329f9a436e3db10acf188274fb1 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Feb 2022 00:11:57 -0500 Subject: [PATCH 08/47] Fix android build --- src/Android/Avalonia.Android/Avalonia.Android.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Android/Avalonia.Android/Avalonia.Android.csproj b/src/Android/Avalonia.Android/Avalonia.Android.csproj index 4fac2fcf21..203c3accd6 100644 --- a/src/Android/Avalonia.Android/Avalonia.Android.csproj +++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj @@ -1,7 +1,7 @@  net6.0-android - net6.0-ios;monoandroid11.0 + $(TargetFrameworks);monoandroid11.0 21 true true From 4e703efbc5574cb375bc241d6cf5ae027f0736a6 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Feb 2022 00:59:32 -0500 Subject: [PATCH 09/47] Update SDK --- azure-pipelines.yml | 6 +++--- global.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ddb47c67db..f64bffde51 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,7 +38,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.100 + version: 6.0.200 - task: CmdLine@2 displayName: 'Run Build' @@ -69,7 +69,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.100 + version: 6.0.200 - task: CmdLine@2 displayName: 'Install Mono 5.18' @@ -141,7 +141,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.100 + version: 6.0.200 - task: CmdLine@2 displayName: 'Install Workloads' diff --git a/global.json b/global.json index 1f93ed27c3..f136d6911b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100" + "version": "6.0.200" }, "msbuild-sdks": { "Microsoft.Build.Traversal": "1.0.43", From 09e088d4e84f73199f2cc736cd737391a24f40f2 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Feb 2022 20:48:33 -0500 Subject: [PATCH 10/47] iOS project nuget packaging workaround --- src/iOS/Avalonia.iOS/Avalonia.iOS.csproj | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj index 1b3a952e8f..39a0305b1e 100644 --- a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj +++ b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj @@ -1,4 +1,5 @@ - + + net6.0-ios $(TargetFrameworks);xamarin.ios10 @@ -9,4 +10,13 @@ + + + + + + <_BuiltProjectOutputGroupOutputIntermediate Remove="$(OutDir)$(_DeploymentTargetApplicationManifestFileName)" /> + + + From df0a04b311926f25151167535043b15992899d48 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Feb 2022 22:15:03 -0500 Subject: [PATCH 11/47] Revert SDK changes, but allow latestFeature --- azure-pipelines.yml | 6 +++--- global.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f64bffde51..ddb47c67db 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,7 +38,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.200 + version: 6.0.100 - task: CmdLine@2 displayName: 'Run Build' @@ -69,7 +69,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.200 + version: 6.0.100 - task: CmdLine@2 displayName: 'Install Mono 5.18' @@ -141,7 +141,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.100' inputs: - version: 6.0.200 + version: 6.0.100 - task: CmdLine@2 displayName: 'Install Workloads' diff --git a/global.json b/global.json index f136d6911b..fbb4a272bf 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "sdk": { - "version": "6.0.200" + "version": "6.0.100", + "rollForward": "latestFeature" }, "msbuild-sdks": { "Microsoft.Build.Traversal": "1.0.43", From c643782a217b385d3b7dfed42fa31e858571b437 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Feb 2022 23:45:18 -0500 Subject: [PATCH 12/47] Update Copyright year --- samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib | 2 +- samples/ControlCatalog.iOS/Resources/LaunchScreen.xib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib b/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib index 35c3013b0e..3a3df8b38e 100644 --- a/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib +++ b/samples/ControlCatalog.iOS.Legacy/Resources/LaunchScreen.xib @@ -11,7 +11,7 @@ -