Skip to content

Commit e8fa522

Browse files
emmaussmaxkatz6
authored andcommitted
add ISkiaGpuWithPlatformGraphicsContext interface to vulkan skia gpu (#17895)
1 parent 3e24242 commit e8fa522

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaGpu.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Avalonia.Skia.Vulkan;
99

10-
internal class VulkanSkiaGpu : ISkiaGpu
10+
internal class VulkanSkiaGpu : ISkiaGpuWithPlatformGraphicsContext
1111
{
1212
private readonly VulkanSkiaExternalObjectsFeature? _externalObjects;
1313
public IVulkanPlatformGraphicsContext Vulkan { get; private set; }
@@ -72,6 +72,9 @@ public void Dispose()
7272
}
7373

7474
public bool IsLost => Vulkan.IsLost;
75+
76+
public IPlatformGraphicsContext? PlatformGraphicsContext => Vulkan;
77+
7578
public IDisposable EnsureCurrent() => Vulkan.EnsureCurrent();
7679

7780

@@ -83,4 +86,7 @@ public ISkiaGpuRenderTarget TryCreateRenderTarget(IEnumerable<object> surfaces)
8386

8487

8588
public ISkiaSurface? TryCreateSurface(PixelSize size, ISkiaGpuRenderSession? session) => null;
86-
}
89+
90+
public IScopedResource<GRContext> TryGetGrContext() =>
91+
ScopedResource<GRContext>.Create(GrContext, EnsureCurrent().Dispose);
92+
}

0 commit comments

Comments
 (0)