rive-app / rive-sharp

C# runtime for Rive
71 stars 6 forks source link

.NET MAUI #7

Open Dan-Banfield opened 1 year ago

Dan-Banfield commented 1 year ago

Would love a .NET MAUI implementation!

hansmbakker commented 5 months ago

There is work in progress at https://github.com/jsuarezruiz/rive-maui

hansmbakker commented 5 months ago

@csmartdalton could you say something about MAUI (including iOS and Android) being or not being on the roadmap for Rive?

csmartdalton commented 4 months ago

@hansmbakker thank you for the request. We have not had the staff for this work yet. We are just now wrapping up a round of hiring on the runtime team, so I hope things can change soon, but for now it isn't explicitly on the roadmap. Until that time, we will gladly accept contributions from the community to the existing C# project!

hansmbakker commented 4 months ago

@csmartdalton thank you for the feedback! While probably following the C++ approach is better performing, getting it to compile properly turned out a blocker (I documented my attempts in https://github.com/jsuarezruiz/rive-maui/issues/1). Since Rive "owns" the build process of rive-native, I expect that somebody at Rive could solve this.

At least for the time that there is no official Rive MAUI library, I helped @matmork build a library using the Android and iOS packages - see https://github.com/matmork/rive-maui.

csmartdalton commented 4 months ago

That work looks awesome @hansmbakker! It's fun to see Rive running on a MAUI app.

Our current top focus is to get the Rive renderer enabled by default on iOS & Android, and that should have some significant impacts on size and speed for you as well, since you're using those packages.

Longer term it would be very cool to have more native support on MAUI. Which graphics APIs does MAUI use? Is it Metal & Vulkan? Does it also target desktops with DX?

hansmbakker commented 4 months ago

Longer term it would be very cool to have more native support on MAUI. Which graphics APIs does MAUI use? Is it Metal & Vulkan? Does it also target desktops with DX?

@csmartdalton that sounds good!

Regarding the graphics APIs - I understand you want to use a native acceleration layer rather than something like Skia?

MAUI is just .NET abstraction layer over the underlying platforms so I would say it should be possible (you can create native views and pass data to/from them).

csmartdalton commented 4 months ago

I understand you want to use a native acceleration layer rather than something like Skia?

This is correct. We have developed our own renderer that is custom made for optimal performance and memory usage with Rive content. Once we finish deploying the renderer everywhere, we will begin releasing features that don't exist on other renderers. So long term, you will want to get on the Rive renderer.

This is all open source and currently supports Metal, OpenGL, and DX11, with Vulkan coming soon. iOS is the closest to completion, with a full switch to the Rive renderer expected in the next month or two. If you have time to experiment, you may want to try compiling in rive-app/rive-renderer to your iOS and Android backends instead of pulling in the high level runtimes. On the Desktop side, the rive renderer will also allow us to drop the dependencies on SkiaSharp and ANGLE, which will lower the package size from about 15MB down to about 1MB.

hansmbakker commented 4 months ago

@csmartdalton those benefits sound really good. In https://github.com/jsuarezruiz/rive-maui, there is work already to adapt your own https://github.com/rive-app/rive-sharp to MAUI but that only covers Windows.

That work could be a good basis to move to your Rive renderer, and you could possibly merge the code of the two repositories. Support for the other platforms will require some more work, and I think especially the premake5 / c++ ecosystem requires some specific experience to get it to work.

Given that I could not get the toolchain to work (as shared in https://github.com/jsuarezruiz/rive-maui/issues/1) needed to compile the native library, I focused on working with @matmork to reuse the prebuilt Android/iOS libraries.