mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-28 09:02:20 +00:00
26 lines
776 B
C#
26 lines
776 B
C#
|
using Avalonia;
|
||
|
using Avalonia.Skia;
|
||
|
using Ryujinx.Ava.Ui.Vulkan;
|
||
|
using Ryujinx.Ava.Ui.Backend.Vulkan;
|
||
|
|
||
|
namespace Ryujinx.Ava.Ui.Backend
|
||
|
{
|
||
|
public static class SkiaGpuFactory
|
||
|
{
|
||
|
public static ISkiaGpu CreateVulkanGpu()
|
||
|
{
|
||
|
var skiaOptions = AvaloniaLocator.Current.GetService<SkiaOptions>() ?? new SkiaOptions();
|
||
|
var platformInterface = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||
|
|
||
|
if (platformInterface == null)
|
||
|
{
|
||
|
VulkanPlatformInterface.TryInitialize();
|
||
|
}
|
||
|
|
||
|
var gpu = new VulkanSkiaGpu(skiaOptions.MaxGpuResourceSizeBytes);
|
||
|
AvaloniaLocator.CurrentMutable.Bind<VulkanSkiaGpu>().ToConstant(gpu);
|
||
|
|
||
|
return gpu;
|
||
|
}
|
||
|
}
|
||
|
}
|