Browse Source

Merge pull request #4554 from AvaloniaUI/fixes/gpu-memory-spike-leak

potential fix for gpu texture leak.
release/0.10.0-preview4
danwalmsley 6 years ago
committed by GitHub
parent
commit
1b581cb3d7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      build/SkiaSharp.props
  2. 6
      src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs

4
build/SkiaSharp.props

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

6
src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs

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

Loading…
Cancel
Save