mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 10:05:25 +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;
|
||
|
}
|
||
|
}
|
||
|
}
|