Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan backend #12737

Merged
merged 10 commits into from
Apr 29, 2024
Merged

Vulkan backend #12737

merged 10 commits into from
Apr 29, 2024

Conversation

kekekeks
Copy link
Member

Adds Vulkan backend.

Note that importing DXGI handles for interop purposes isn't supported yet, only opaque vulkan handles are supported

@avaloniaui-team
Copy link
Contributor

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

return new ImportedImage(_context, _pool, handle, properties);
}

[DllImport("/home/kekekeks/Projects/pinvokewtf/cmake-build-debug/libpinvokewtf.so")]
Copy link

Choose a reason for hiding this comment

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

debug code

# Conflicts:
#	samples/GpuInterop/VulkanDemo/VulkanImage.cs
#	src/Avalonia.X11/X11Platform.cs
#	src/Windows/Avalonia.Win32/Win32GlManager.cs
@kekekeks kekekeks enabled auto-merge April 29, 2024 07:25
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047851-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks kekekeks added this pull request to the merge queue Apr 29, 2024
Merged via the queue into master with commit 3a1a69b Apr 29, 2024
12 checks passed
@kekekeks kekekeks deleted the feature/vulkan-11 branch April 29, 2024 10:56
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

Need to update target frameworks here as we did in other projects.


namespace Avalonia.Vulkan;

[Unstable]
Copy link
Member

Choose a reason for hiding this comment

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

We should start marking Unstable attribute with a specific reason why. Here and in other places.

FreeUsedCommandBuffers();

if (_handle.Handle != 0)
_context.DeviceApi.DestroyCommandPool(_context.DeviceHandle, _handle, IntPtr.Zero);
Copy link
Member

Choose a reason for hiding this comment

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

I assume it's expected to skip ThrowOnError here

.Information,
_ => LogEventLevel.Information
};
if (Logger.TryGet(level, "Vulkan", out var logger))
Copy link
Member

Choose a reason for hiding this comment

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

Would be better to move "Vulkan" to a LogArea enum-class, so we have a self-documenting logger class.

: SKColorType.Bgra8888, SKColorSpace.CreateSrgb());
var image = surface.Snapshot();
_gpu.GrContext.Flush();
//surface.Canvas.Flush();
Copy link
Member

Choose a reason for hiding this comment

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

I assume it's a debug code, and surface disposal will flush canvas as well.

Comment on lines +68 to +73
if (renderingMode == Win32RenderingMode.Vulkan)
{
var vulkan = VulkanSupport.TryInitialize(AvaloniaLocator.Current.GetService<VulkanOptions>() ?? new());
if (vulkan != null)
return vulkan;
}
Copy link
Member

Choose a reason for hiding this comment

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

So, no compositor support for now?

@maxkatz6 maxkatz6 added the backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch label May 8, 2024
maxkatz6 pushed a commit that referenced this pull request May 8, 2024
* Ported the old Vulkan PR

* chop-chop

* Support for external objects in vulkan backend

* Fixed structure type

* Removed debug code

* sln fix

* Don't force vulkan on windows
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels May 8, 2024
@maxkatz6 maxkatz6 mentioned this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants