Updates for master

This commit is contained in:
Nikita Tsukanov
2020-05-11 23:21:45 +03:00
parent d0fdce3b60
commit d9c5bbb106
3 changed files with 8 additions and 9 deletions
@@ -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);
}
}
}
}
@@ -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)
{
+1 -5
View File
@@ -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; }
}
}