Updates for master
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user