diff --git a/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs b/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs
index 6121e11af0..de188f42bd 100644
--- a/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs
+++ b/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);
+ }
}
}
}
diff --git a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
index 3a1af9fdc0..2fee282860 100644
--- a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
+++ b/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)
{
diff --git a/src/Skia/Avalonia.Skia/SkiaOptions.cs b/src/Skia/Avalonia.Skia/SkiaOptions.cs
index ce818bf69d..cbe0b5ef42 100644
--- a/src/Skia/Avalonia.Skia/SkiaOptions.cs
+++ b/src/Skia/Avalonia.Skia/SkiaOptions.cs
@@ -8,10 +8,6 @@ namespace Avalonia
///
public class SkiaOptions
{
- public SkiaOptions()
- {
- MaxGpuResourceSizeBytes = 100663296; // Value taken from skia.
- }
///
/// Custom gpu factory to use. Can be used to customize behavior of Skia renderer.
///
@@ -20,6 +16,6 @@ namespace Avalonia
///
/// The maximum number of bytes for video memory to store textures and resources.
///
- public long MaxGpuResourceSizeBytes { get; set; }
+ public long? MaxGpuResourceSizeBytes { get; set; }
}
}