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; private GRContext _grContext;
public GlSkiaGpu(IWindowingPlatformGlFeature gl, long maxResourceBytes) public GlSkiaGpu(IWindowingPlatformGlFeature gl, long? maxResourceBytes)
{ {
var context = gl.MainContext; var context = gl.MainContext;
using (context.MakeCurrent()) using (context.MakeCurrent())
@ -19,8 +19,11 @@ namespace Avalonia.Skia
GRGlInterface.AssembleGlesInterface((_, proc) => context.GlInterface.GetProcAddress(proc))) GRGlInterface.AssembleGlesInterface((_, proc) => context.GlInterface.GetProcAddress(proc)))
{ {
_grContext = GRContext.Create(GRBackend.OpenGL, iface); _grContext = GRContext.Create(GRBackend.OpenGL, iface);
_grContext.GetResourceCacheLimits(out var maxResources, out _); if (maxResourceBytes.HasValue)
_grContext.SetResourceCacheLimits(maxResources, maxResourceBytes); {
_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; private readonly ISkiaGpu _skiaGpu;
public PlatformRenderInterface(ISkiaGpu skiaGpu, long maxResourceBytes) public PlatformRenderInterface(ISkiaGpu skiaGpu, long? maxResourceBytes = null)
{ {
if (skiaGpu != null) if (skiaGpu != null)
{ {

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

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

Loading…
Cancel
Save