Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update skia to Milestone 118 #3048

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ However, these are easy to install as they are found on the various websites. If

Here are some links to show the differences in our code as compared to Google's code.

What version are we on? [**m116**](https://github.com/google/skia/tree/chrome/m117)
Are we up-to-date with Google? [Compare](https://github.com/mono/skia/compare/skiasharp...google:chrome/m117)
What have we added? [Compare](https://github.com/google/skia/compare/chrome/m117...mono:skiasharp)
What version are we on? [**m118**](https://github.com/google/skia/tree/chrome/m118)
Are we up-to-date with Google? [Compare](https://github.com/mono/skia/compare/skiasharp...google:chrome/m118)
What have we added? [Compare](https://github.com/google/skia/compare/chrome/m118...mono:skiasharp)
6 changes: 4 additions & 2 deletions binding/SkiaSharp/EnumMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum GRBackend
Vulkan = 2,
Dawn = 3,
Direct3D = 4,
Unsupported = 5,
}

public static partial class SkiaExtensions
Expand All @@ -22,8 +23,9 @@ internal static GRBackendNative ToNative (this GRBackend backend) =>
GRBackend.Metal => GRBackendNative.Metal,
GRBackend.OpenGL => GRBackendNative.OpenGL,
GRBackend.Vulkan => GRBackendNative.Vulkan,
GRBackend.Dawn => GRBackendNative.Dawn,
GRBackend.Dawn => GRBackendNative.Unsupported,
GRBackend.Direct3D => GRBackendNative.Direct3D,
GRBackend.Unsupported => GRBackendNative.Unsupported,
_ => throw new ArgumentOutOfRangeException (nameof (backend), $"Unknown backend: '{backend}'"),
};

Expand All @@ -33,8 +35,8 @@ internal static GRBackend FromNative (this GRBackendNative backend) =>
GRBackendNative.Metal => GRBackend.Metal,
GRBackendNative.OpenGL => GRBackend.OpenGL,
GRBackendNative.Vulkan => GRBackend.Vulkan,
GRBackendNative.Dawn => GRBackend.Dawn,
GRBackendNative.Direct3D => GRBackend.Direct3D,
GRBackendNative.Unsupported => GRBackend.Unsupported,
_ => throw new ArgumentOutOfRangeException (nameof (backend), $"Unknown backend: '{backend}'"),
};

Expand Down
20 changes: 16 additions & 4 deletions binding/SkiaSharp/GRBackendRenderTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,31 @@ public GRBackendRenderTarget (int width, int height, int sampleCount, int stenci
CreateGl (width, height, sampleCount, stencilBits, glInfo);
}

[Obsolete ("Use GRBackendRenderTarget(int width, int height, GRVkImageInfo vkImageInfo) instead.")]
public GRBackendRenderTarget (int width, int height, int sampleCount, GRVkImageInfo vkImageInfo)
: this (width, height, vkImageInfo)
{
}

public GRBackendRenderTarget (int width, int height, GRVkImageInfo vkImageInfo)
: this (IntPtr.Zero, true)
{
CreateVulkan (width, height, sampleCount, vkImageInfo);
CreateVulkan (width, height, vkImageInfo);
}

#if __IOS__ || __MACOS__

[Obsolete ("Use GRBackendRenderTarget(int width, int height, GRMtlTextureInfo mtlInfo) instead.")]
public GRBackendRenderTarget (int width, int height, int sampleCount, GRMtlTextureInfo mtlInfo)
: this (width, height, mtlInfo)
{
}

public GRBackendRenderTarget (int width, int height, GRMtlTextureInfo mtlInfo)
: this (IntPtr.Zero, true)
{
var info = mtlInfo.ToNative ();
Handle = SkiaApi.gr_backendrendertarget_new_metal (width, height, sampleCount, &info);
Handle = SkiaApi.gr_backendrendertarget_new_metal (width, height, &info);

if (Handle == IntPtr.Zero) {
throw new InvalidOperationException ("Unable to create a new GRBackendRenderTarget instance.");
Expand All @@ -48,9 +60,9 @@ private void CreateGl (int width, int height, int sampleCount, int stencilBits,
}
}

private void CreateVulkan (int width, int height, int sampleCount, GRVkImageInfo vkImageInfo)
private void CreateVulkan (int width, int height, GRVkImageInfo vkImageInfo)
{
Handle = SkiaApi.gr_backendrendertarget_new_vulkan (width, height, sampleCount, &vkImageInfo);
Handle = SkiaApi.gr_backendrendertarget_new_vulkan (width, height, &vkImageInfo);

if (Handle == IntPtr.Zero) {
throw new InvalidOperationException ("Unable to create a new GRBackendRenderTarget instance.");
Expand Down
28 changes: 14 additions & 14 deletions binding/SkiaSharp/SkiaApi.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,42 +287,42 @@ internal static gr_backendrendertarget_t gr_backendrendertarget_new_gl (Int32 wi
(gr_backendrendertarget_new_gl_delegate ??= GetSymbol<Delegates.gr_backendrendertarget_new_gl> ("gr_backendrendertarget_new_gl")).Invoke (width, height, samples, stencils, glInfo);
#endif

// gr_backendrendertarget_t* gr_backendrendertarget_new_metal(int width, int height, int samples, const gr_mtl_textureinfo_t* mtlInfo)
// gr_backendrendertarget_t* gr_backendrendertarget_new_metal(int width, int height, const gr_mtl_textureinfo_t* mtlInfo)
#if !USE_DELEGATES
#if USE_LIBRARY_IMPORT
[LibraryImport (SKIA)]
internal static partial gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, Int32 samples, GRMtlTextureInfoNative* mtlInfo);
internal static partial gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, GRMtlTextureInfoNative* mtlInfo);
#else // !USE_LIBRARY_IMPORT
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, Int32 samples, GRMtlTextureInfoNative* mtlInfo);
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, GRMtlTextureInfoNative* mtlInfo);
#endif
#else
private partial class Delegates {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, Int32 samples, GRMtlTextureInfoNative* mtlInfo);
internal delegate gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, GRMtlTextureInfoNative* mtlInfo);
}
private static Delegates.gr_backendrendertarget_new_metal gr_backendrendertarget_new_metal_delegate;
internal static gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, Int32 samples, GRMtlTextureInfoNative* mtlInfo) =>
(gr_backendrendertarget_new_metal_delegate ??= GetSymbol<Delegates.gr_backendrendertarget_new_metal> ("gr_backendrendertarget_new_metal")).Invoke (width, height, samples, mtlInfo);
internal static gr_backendrendertarget_t gr_backendrendertarget_new_metal (Int32 width, Int32 height, GRMtlTextureInfoNative* mtlInfo) =>
(gr_backendrendertarget_new_metal_delegate ??= GetSymbol<Delegates.gr_backendrendertarget_new_metal> ("gr_backendrendertarget_new_metal")).Invoke (width, height, mtlInfo);
#endif

// gr_backendrendertarget_t* gr_backendrendertarget_new_vulkan(int width, int height, int samples, const gr_vk_imageinfo_t* vkImageInfo)
// gr_backendrendertarget_t* gr_backendrendertarget_new_vulkan(int width, int height, const gr_vk_imageinfo_t* vkImageInfo)
#if !USE_DELEGATES
#if USE_LIBRARY_IMPORT
[LibraryImport (SKIA)]
internal static partial gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, Int32 samples, GRVkImageInfo* vkImageInfo);
internal static partial gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, GRVkImageInfo* vkImageInfo);
#else // !USE_LIBRARY_IMPORT
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, Int32 samples, GRVkImageInfo* vkImageInfo);
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, GRVkImageInfo* vkImageInfo);
#endif
#else
private partial class Delegates {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, Int32 samples, GRVkImageInfo* vkImageInfo);
internal delegate gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, GRVkImageInfo* vkImageInfo);
}
private static Delegates.gr_backendrendertarget_new_vulkan gr_backendrendertarget_new_vulkan_delegate;
internal static gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, Int32 samples, GRVkImageInfo* vkImageInfo) =>
(gr_backendrendertarget_new_vulkan_delegate ??= GetSymbol<Delegates.gr_backendrendertarget_new_vulkan> ("gr_backendrendertarget_new_vulkan")).Invoke (width, height, samples, vkImageInfo);
internal static gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, GRVkImageInfo* vkImageInfo) =>
(gr_backendrendertarget_new_vulkan_delegate ??= GetSymbol<Delegates.gr_backendrendertarget_new_vulkan> ("gr_backendrendertarget_new_vulkan")).Invoke (width, height, vkImageInfo);
#endif

// void gr_backendtexture_delete(gr_backendtexture_t* texture)
Expand Down Expand Up @@ -19994,8 +19994,8 @@ internal enum GRBackendNative {
Metal = 2,
// DIRECT3D_GR_BACKEND = 3
Direct3D = 3,
// DAWN_GR_BACKEND = 4
Dawn = 4,
// UNSUPPORTED_GR_BACKEND = 5
Unsupported = 5,
}

// gr_surfaceorigin_t
Expand Down
2 changes: 1 addition & 1 deletion externals/skia
Submodule skia updated 2019 files
6 changes: 3 additions & 3 deletions scripts/VERSIONS.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# dependencies
mdoc release 5.8.9
harfbuzz release 8.3.0
skia release m117
skia release m118
xunit release 2.4.2
xunit.runner.console release 2.4.2
OpenTK release 3.1.0
Expand All @@ -23,12 +23,12 @@ ANGLE release chromium/6275
# this is related to the API versions, not the library versions
# - milestone: the skia milestone determined by Google/Chromium
# - increment: the C API version increment caused by new APIs (externals\skia\include\c\sk_types.h)
libSkiaSharp milestone 117
libSkiaSharp milestone 118
libSkiaSharp increment 0

# native sonames
# <milestone>.<increment>.0
libSkiaSharp soname 117.0.0
libSkiaSharp soname 118.0.0
# 0.<60000 + major*100 + minor*10 + micro>.0
HarfBuzz soname 0.60830.0

Expand Down
5 changes: 4 additions & 1 deletion tests/Tests/SkiaSharp/EnumMappingsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ public void GRBackendMappings()
{
foreach (GRBackend value in Enum.GetValues(typeof(GRBackend)))
{
Assert.Equal(value.ToString(), value.ToNative().ToString());
if (value == GRBackend.Dawn)
Assert.Equal("Unsupported", value.ToNative().ToString());
else
Assert.Equal(value.ToString(), value.ToNative().ToString());
}

foreach (GRBackendNative value in Enum.GetValues(typeof(GRBackendNative)))
Expand Down
Loading