Browse Source

potential fix for gpu texture leak.

Dan Walmsley 5 years ago
parent
commit
faf9beb02d
2 changed files with 5 additions and 3 deletions
  1. 1 1
      build/SkiaSharp.props
  2. 4 2
      src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs

+ 1 - 1
build/SkiaSharp.props

@@ -1,6 +1,6 @@
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
-    <PackageReference Include="SkiaSharp" Version="2.80.1" />
+    <PackageReference Include="SkiaSharp" Version="2.80.2-pr.1478.3" />
     <PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.80.0" />
   </ItemGroup>
 </Project>

+ 4 - 2
src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs

@@ -31,10 +31,11 @@ namespace Avalonia.Skia
 
             public GlGpuSession(GRContext grContext,
                 GRBackendRenderTarget backendRenderTarget,
-                SKSurface surface, 
+                SKSurface surface,
                 IGlPlatformSurfaceRenderingSession glSession)
             {
                 GrContext = grContext;
+                GrContext.PurgeResources();
                 _backendRenderTarget = backendRenderTarget;
                 _surface = surface;
                 _glSession = glSession;
@@ -45,6 +46,7 @@ namespace Avalonia.Skia
                 _surface.Dispose();
                 _backendRenderTarget.Dispose();
                 GrContext.Flush();
+                GrContext.PurgeResources();
                 _glSession.Dispose();
             }
 
@@ -93,7 +95,7 @@ namespace Avalonia.Skia
             }
             finally
             {
-                if(!success)
+                if (!success)
                     glSession.Dispose();
             }
         }