mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-15 03:21:15 +01: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;
|
||
|
}
|
||
|
}
|
||
|
}
|