Skip to content

Add support for WinUI 3 - #1458

Closed
mattleibow wants to merge 13 commits into
mainfrom
dev/winui
Closed

Add support for WinUI 3#1458
mattleibow wants to merge 13 commits into
mainfrom
dev/winui

Conversation

@mattleibow

@mattleibow mattleibow commented Aug 11, 2020

Copy link
Copy Markdown
Contributor

Description of Change

  • Add support for WinUI 3 views
  • Add WinUI 3 samples for Desktop and UWP

Bugs Fixed

Known Issues

API Changes

Behavioral Changes

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azchohfi is there an easier way to multi-target this project with the 'UWP' WinUI file above?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just multi-target, but the whole structure for SkiaSharp is already like this for every single other target, so I believe it makes sense to keep it this way.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, now I noticed what happened. @mattleibow, version 2.1.2 of MSBuild.Sdk.Extras added support for net5.0 TFMs, so you could, if you want to, merge the SkiaSharp.Views.WinUI.csproj and SkiaSharp.Views.WinUI.UWP.csproj .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yay! I'll do that. I didn't see the shiny new update!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I am still getting errors on the restore, but this is MSBuild/NuGet issues because I don't think the restore process supports the conditionals. In my case, I had the WinUI project that depends on either SkiaSharp.UWP and SkiaSharp projects depending on which TFM was selected.

I need to actually do a full multi-targeting setup here. The reason I didn't before was due to VSMac having issues and VSWin not working properly - but this is most likely fixed since I started this when multi-targeting was hot off the press.

I'm going to keep it 2 projects for now, and then start some research into multi-targeting in a new PR. This time with new build tools and IDEs.

@DierkDroth

Copy link
Copy Markdown

@mattleibow I was educated by my team that this issue prevents switching our Platform UNO solution to WinUI 3 (we're using SkiaSharp rendering massively).

Is there any ETA yet?

@jeromelaban FYI

@jeromelaban

Copy link
Copy Markdown
Contributor

@DierkDroth thanks. As mentioned in the Uno issue, WinUI 3.0 is not required yet. WinUI 2.x can be used at this point.

@DierkDroth

Copy link
Copy Markdown

@jeromelaban sorry, I'm still lost.

Let me ask you this: how would a WinUI 3 TabView host a SkiaSharp chart?

@jeromelaban

Copy link
Copy Markdown
Contributor

@jeromelaban sorry, I'm still lost.

Let me ask you this: how would a WinUI 3 TabView host a SkiaSharp chart?

The TabView control is available in WinUI 2.x and is available starting in Uno 3.1, there is no need for WinUI 3.0 at this point.

@DierkDroth

Copy link
Copy Markdown

Thanks @jeromelaban. This seems to be a viable work around

@gmurray81

Copy link
Copy Markdown
Contributor

@mattleibow might some preview of this ship soon? Have been extracting stuff from this PR to try but that seems like it would be a bit more painful for the GL surfaces.

@gmurray81

Copy link
Copy Markdown
Contributor

@mattleibow btw, the IBufferByteAccess binding doesn't work in WinUI preview 3, I was able to make it work again by comparing against the wincsrt codebase for IBufferByteAccess, maybe they could add an easier way to grab that interface? Or maybe they did already, didn't search too long.

@rick-palmsens

Copy link
Copy Markdown

@gmurray81 I seem to be running into the same error:

Invalid cast from 'WinRT.IInspectable' to 'SkiaSharp.Views.Interop.IBufferByteAccess'.

Could you tell me what you changed to make it work again?

Base automatically changed from master to main February 5, 2021 08:30
@mattleibow

Copy link
Copy Markdown
Contributor Author

I have updated a few things. The WinUI sample is running again. The implementation for Win32 is a tad bit different due to some UWP APIs not existing/implemented.

The GPU views might take longer because ANGLE does not support WinUI and there appears to be know immediate plans to add it: microsoft/microsoft-ui-xaml#2558

Once things are building, I can release a preview package on the preview feed for people to try out.

@michael-hawker

Copy link
Copy Markdown

🦙 Seems like the Angle work has moved to Google and their discussion was placed here. (Though still that it's not in plans, but that was 8 months ago.) FYI @stmoy

@rick-palmsens

Copy link
Copy Markdown

Is ANGLE necessary for the Win32 version of WinUI? In theory you should be able to call OpenGL directly when not confined to the UWP sandbox.

@mnikonov

mnikonov commented Feb 17, 2021

Copy link
Copy Markdown

@mattleibow thanks for your work!!!! Is there is any guess when pre release package with WinUI support would be possible to download? Also question would be package with name SkiaSharp.Views.Uno.WinUI ? :)

# Conflicts:
#	binding/SkiaSharp/SkiaSharp.csproj
#	samples/Basic/WinUI/Desktop/SkiaSharpSample.Package/Package.appxmanifest
#	samples/Basic/WinUI/Desktop/SkiaSharpSample.Package/SkiaSharpSample.Package.wapproj
#	samples/Basic/WinUI/Desktop/SkiaSharpSample.sln
#	samples/Basic/WinUI/Desktop/SkiaSharpSample/App.xaml.cs
#	samples/Basic/WinUI/Desktop/SkiaSharpSample/MainWindow.xaml
#	samples/Basic/WinUI/Desktop/SkiaSharpSample/MainWindow.xaml.cs
#	samples/Basic/WinUI/Desktop/SkiaSharpSample/SkiaSharpSample.csproj
#	scripts/azure-pipelines.yml
#	scripts/azure-templates-bootstrapper.yml
#	source/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI/SkiaSharp.Views.WinUI.csproj
#	source/SkiaSharp.Views/SkiaSharp.Views.Shared/Extensions.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.Shared/GlesInterop/Gles.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/AngleSwapChainPanel.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/GlesInterop/GlesContext.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/Interop/IBufferByteAccess.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/Interop/PropertySetExtensions.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/SKSwapChainPanel.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/SKXamlCanvas.cs
#	source/SkiaSharp.Views/SkiaSharp.Views.UWP/UWPExtensions.cs
#	source/SkiaSharpSource.Windows.sln
#	source/SkiaSharpSource.sln
@mattleibow

Copy link
Copy Markdown
Contributor Author

I pushed out a preview package (SkiaSharp.Views.WinUI) to https://aka.ms/skiasharp-eap/index.json

This is just the SKXamlCanvas for now as I try and get the ANGLE builds working with the new views.

@gmurray81

Copy link
Copy Markdown
Contributor

Awesome! Thanks :)

@MaksimNikonovOrioninc

Copy link
Copy Markdown

@mattleibow is there is any plans to have compatible version of SkiaSharp.Views.WinUI with UWP and UNO?

@jeromelaban

Copy link
Copy Markdown
Contributor

@MaksimNikonovOrioninc yes there are plans to make this support work for the Uno.WinUI packages. I will be in a separate PR, though.

@mattleibow

Copy link
Copy Markdown
Contributor Author

Closing this as we got WinUI support for Desktop/Win32 a few releases back, but now stable.

Additional things

  • Uno will be in a separate PR
  • UWP will be in a separate PR

@mattleibow mattleibow closed this Jul 12, 2021
@mattleibow
mattleibow deleted the dev/winui branch July 12, 2021 01:44
@gmurray81

Copy link
Copy Markdown
Contributor

@mattleibow what about the GPU support for WinUI3? Separate task? Giving up on it due to the lack of Angle support?

Is he implying here that it should be supportable with the current stuff in Angle? https://groups.google.com/g/angleproject/c/oq7JU0StLCs/m/IoaPPVapBAAJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] WinUI 3 support

9 participants