Browse Source

Updates for master

pull/3386/head
Nikita Tsukanov 6 years ago
parent
commit
d9c5bbb106
  1. 9
      src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs
  2. 2
      src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
  3. 6
      src/Skia/Avalonia.Skia/SkiaOptions.cs

9
src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs

@ -9,7 +9,7 @@ namespace Avalonia.Skia
{
private GRContext _grContext;
public GlSkiaGpu(IWindowingPlatformGlFeature gl, long maxResourceBytes)
public GlSkiaGpu(IWindowingPlatformGlFeature gl, long? maxResourceBytes)
{
var context = gl.MainContext;
using (context.MakeCurrent())
@ -19,8 +19,11 @@ namespace Avalonia.Skia
GRGlInterface.AssembleGlesInterface((_, proc) => context.GlInterface.GetProcAddress(proc)))
{
_grContext = GRContext.Create(GRBackend.OpenGL, iface);
_grContext.GetResourceCacheLimits(out var maxResources, out _);
_grContext.SetResourceCacheLimits(maxResources, maxResourceBytes);
if (maxResourceBytes.HasValue)
{
_grContext.GetResourceCacheLimits(out var maxResources, out _);
_grContext.SetResourceCacheLimits(maxResources, maxResourceBytes.Value);
}
}
}
}

2
src/Skia/Avalonia.Skia/PlatformRenderInterface.cs

@ -19,7 +19,7 @@ namespace Avalonia.Skia
{
private readonly ISkiaGpu _skiaGpu;
public PlatformRenderInterface(ISkiaGpu skiaGpu, long maxResourceBytes)
public PlatformRenderInterface(ISkiaGpu skiaGpu, long? maxResourceBytes = null)
{
if (skiaGpu != null)
{

6
src/Skia/Avalonia.Skia/SkiaOptions.cs

@ -8,10 +8,6 @@ namespace Avalonia
/// </summary>
public class SkiaOptions
{
public SkiaOptions()
{
MaxGpuResourceSizeBytes = 100663296; // Value taken from skia.
}
/// <summary>
/// Custom gpu factory to use. Can be used to customize behavior of Skia renderer.
/// </summary>
@ -20,6 +16,6 @@ namespace Avalonia
/// <summary>
/// The maximum number of bytes for video memory to store textures and resources.
/// </summary>
public long MaxGpuResourceSizeBytes { get; set; }
public long? MaxGpuResourceSizeBytes { get; set; }
}
}

Loading…
Cancel
Save