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

Function pointers and LibraryImport #2917

Merged
merged 30 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9313a30
Update generator to emit function pointers
maxkatz6 Jul 3, 2024
1977a7c
Regenerate interop files
maxkatz6 Jul 3, 2024
a35eaa4
Enable USE_LIBRARY_IMPORT in HarfBuzzSharp
maxkatz6 Jul 3, 2024
2b9c477
Enable USE_LIBRARY_IMPORT on SkiaSharp
maxkatz6 Jul 3, 2024
2af4504
Set DisableRuntimeMarshalling on HarfBuzzSharp
maxkatz6 Jul 3, 2024
d7223e9
Replace remaining DllImports with LibraryImport on SkiaSharp
maxkatz6 Jul 3, 2024
c83cf08
Set DisableRuntimeMarshalling on SkiaSharp as well
maxkatz6 Jul 3, 2024
fdd2782
Fix missed proxy definition
maxkatz6 Jul 3, 2024
f2736d0
Regenerate skia api with a correct submodule version
maxkatz6 Jul 3, 2024
ffb5057
Collections literals are not supported on the CI .NET SDK
maxkatz6 Jul 3, 2024
9c7c6b0
An attempt to fix Tizen build
maxkatz6 Jul 3, 2024
d5035b3
Forgot about partial
maxkatz6 Jul 3, 2024
38ee2ca
Set UnmanagedType.LPStr on evas_gl_proc_address_get instead
maxkatz6 Jul 3, 2024
a054db9
Set USE_LIBRARY_IMPORT on remaining projects too
maxkatz6 Jul 3, 2024
78c3880
Merge branch 'main' into function-pointers-and-library-import
maxkatz6 Jul 4, 2024
112af64
Merge branch 'main' into function-pointers-and-library-import
maxkatz6 Jul 17, 2024
26b4961
Update generator tool to generate DelegateProxy as well
maxkatz6 Jul 19, 2024
c13089b
Regenerate HarfBuzz and SkiaSharp with new DelegateProxy source gen
maxkatz6 Jul 19, 2024
1810c0a
Regenerate other projects as well
maxkatz6 Jul 19, 2024
b2d998b
Merge branch 'main' into function-pointers-and-library-import
maxkatz6 Jul 19, 2024
ffd76e2
Merge branch 'main' into function-pointers-and-library-import
maxkatz6 Jul 26, 2024
ac124fe
Add `protected internal` to test classes too, since this project has …
maxkatz6 Aug 15, 2024
544a3f7
Disable DelegateTypesAreValid and DelegateTypesHaveAttributes tests o…
maxkatz6 Aug 15, 2024
53e445e
Reduce warnings noise
maxkatz6 Aug 15, 2024
7c13e28
Merge branch 'main' into function-pointers-and-library-import
mattleibow Aug 17, 2024
65b6a54
Merge branch 'main' into function-pointers-and-library-import
mattleibow Aug 20, 2024
ca37c82
Update binding/SkiaSharp/GRGlInterface.cs
maxkatz6 Aug 20, 2024
03a3b40
Add missing USE_LIBRARY_IMPORT defines
maxkatz6 Aug 20, 2024
b36ad1a
Update binding/SkiaSharp/GRGlInterface.cs
mattleibow Aug 21, 2024
f62498a
Also needs USE_LIBRARY_IMPORT
mattleibow Aug 21, 2024
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
Prev Previous commit
Next Next commit
An attempt to fix Tizen build
maxkatz6 committed Jul 3, 2024
commit 9c7c6b092331b743fd17d3c5f5f4de7e90374f5b
17 changes: 9 additions & 8 deletions binding/SkiaSharp/GRGlInterface.cs
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

#if __TIZEN__
using System.Reflection;
using System.Runtime.CompilerServices;
#endif

namespace SkiaSharp
@@ -192,7 +193,7 @@ public static IntPtr GetProc (string name)
}

#if __TIZEN__
private class EvasGlLoader
private partial class EvasGlLoader
{
private const string libevas = "libevas.so.1";

@@ -203,17 +204,17 @@ private class EvasGlLoader
private readonly IntPtr glEvas;
private readonly EvasGlApi api;

[DllImport (libevas)]
[LibraryImport (libevas)]
internal static extern IntPtr evas_gl_api_get (IntPtr evas_gl);

[DllImport (libevas)]
[LibraryImport (libevas)]
internal static extern IntPtr evas_gl_context_api_get (IntPtr evas_gl, IntPtr ctx);

[DllImport (libevas)]
[LibraryImport (libevas)]
internal static extern IntPtr evas_gl_current_context_get (IntPtr evas_gl);

[DllImport (libevas)]
internal static extern IntPtr evas_gl_proc_address_get (IntPtr evas_gl, string name);
[LibraryImport(libevas, StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr evas_gl_proc_address_get (IntPtr evas_gl, string name);

static EvasGlLoader ()
{
@@ -222,7 +223,7 @@ static EvasGlLoader ()
apiFields = EvasGlApiType.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
}

public EvasGlLoader (IntPtr evas)
public unsafe EvasGlLoader (IntPtr evas)
{
glEvas = evas;
var glContext = evas_gl_current_context_get (glEvas);
@@ -231,7 +232,7 @@ public EvasGlLoader (IntPtr evas)
? evas_gl_context_api_get (glEvas, glContext)
: evas_gl_api_get (glEvas);

api = Marshal.PtrToStructure<EvasGlApi> (apiPtr);
api = *(EvasGlApi*)apiPtr;
}

public IntPtr GetFunctionPointer (string name)