Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Vulkan Backend

Open emmauss opened this issue 2 years ago • 83 comments

What does the pull request do?

Adds vulkan backend for skia

What is the updated/expected behavior with this PR?

The backend can be enabled with UseVulkan property in Win32PlatformOption or X11PlatformOptions.

How was the solution implemented (if it's not obvious)?

The backend uses Silk.Net as the vulkan bindings

Checklist

  • [x] Add render control
  • [ ] Added unit tests (if possible)?
  • [ ] Added XML documentation to any related classes?
  • [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Documentation with user documentation

Breaking changes

None

Obsoletions / Deprecations

Fixed issues

Fixes #4274

emmauss avatar Mar 05 '22 10:03 emmauss

You can test this PR using the following package version. 0.10.999-cibuild0019019-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 10:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019019-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 10:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019021-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 11:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019021-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 11:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019022-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 13:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019022-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 05 '22 13:03 avaloniaui-team

Not exactly acquainted with .NET/Nuget/etc, how do I use this in my own project while it's not merged?

s5bug avatar Mar 08 '22 18:03 s5bug

@s5bug You can follow the guide from https://github.com/AvaloniaUI/Avalonia/wiki/Using-nightly-build-feed and instead of nightly feed url use the one provided by the PR bot above. And then simply update avalonia package version to the one from the bot as well.

MarchingCube avatar Mar 08 '22 18:03 MarchingCube

The bot doesn't post a message every commit, is that still fine?

s5bug avatar Mar 08 '22 18:03 s5bug

You can test this PR using the following package version. 0.10.999-cibuild0019159-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 10 '22 11:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019192-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 10 '22 17:03 avaloniaui-team

Ok, using https://nuget.avaloniaui.net/repository/avalonia-all/index.json didn't work, but https://pkgs.dev.azure.com/AvaloniaUI/aa84306f-2981-47b9-8206-edb3bed6250d/_packaging/64388c94-6632-79aa-93af-ab6362308af7/nuget/v3/index.json did. Unfortunately I don't currently have the time to actually write and test Vulkan code.

s5bug avatar Mar 11 '22 01:03 s5bug

You can test this PR using the following package version. 0.10.999-cibuild0019270-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 12 '22 20:03 avaloniaui-team

Open for review

emmauss avatar Mar 13 '22 09:03 emmauss

You can test this PR using the following package version. 0.10.999-cibuild0019274-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 13 '22 12:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019275-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 13 '22 13:03 avaloniaui-team

imo we need to at least cover those types with our own. Never a good idea to expose 3rd party types on the core library's API.

jmacato avatar Mar 14 '22 01:03 jmacato

I'm seeing both Avalonia.Skia and Avalonia.Vulkan having public API members exposing raw Silk.NET types.

I understand that replacing Silk.NET for Avalonia.Vulkan might be problematic, and I won't be strictly against of it. Especially if it's only an optional package as an opengl replacement. But can we avoid it in the Avalonia.Skia?

maxkatz6 avatar Mar 14 '22 01:03 maxkatz6

Silk.Net objects can simply be replaced by only exposing their handles, which are just ulong fields. Those can be used by the user on their own vulkan binding, or if using Silk.Net, just passing it to the respective constructors.

emmauss avatar Mar 14 '22 07:03 emmauss

@emmauss Perhaps you can add original shader code there with a readme about how to compile it to spirv. In case somebody wants to modify it later.

MarchingCube avatar Mar 14 '22 09:03 MarchingCube

Silk.Net objects can simply be replaced by only exposing their handles, which are just ulong fields

this is acceptable for me :)

jmacato avatar Mar 14 '22 12:03 jmacato

@emmauss Perhaps you can add original shader code there with a readme about how to compile it to spirv. In case somebody wants to modify it later.

I've added the glsl files

emmauss avatar Mar 14 '22 20:03 emmauss

You can test this PR using the following package version. 0.10.999-cibuild0019290-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 14 '22 20:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019297-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 15 '22 08:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019341-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 16 '22 21:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019354-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 18 '22 10:03 avaloniaui-team

~Blocked by #7841~

emmauss avatar Mar 21 '22 13:03 emmauss

You can test this PR using the following package version. 0.10.999-cibuild0019437-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 22 '22 20:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019489-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 24 '22 20:03 avaloniaui-team

You can test this PR using the following package version. 0.10.999-cibuild0019495-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

avaloniaui-team avatar Mar 25 '22 12:03 avaloniaui-team