diff --git a/src/Avalonia.OpenGL/Egl/EglInterface.cs b/src/Avalonia.OpenGL/Egl/EglInterface.cs index cadd7cc1f22..6148e58440a 100644 --- a/src/Avalonia.OpenGL/Egl/EglInterface.cs +++ b/src/Avalonia.OpenGL/Egl/EglInterface.cs @@ -46,93 +46,114 @@ static Func Load(string library) } // ReSharper disable UnassignedGetOnlyAutoProperty + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int EglGetError(); [GlEntryPoint("eglGetError")] public EglGetError GetError { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetDisplay(IntPtr nativeDisplay); [GlEntryPoint("eglGetDisplay")] public EglGetDisplay GetDisplay { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetPlatformDisplayEXT(int platform, IntPtr nativeDisplay, int[] attrs); [GlEntryPoint("eglGetPlatformDisplayEXT")] [GlOptionalEntryPoint] public EglGetPlatformDisplayEXT GetPlatformDisplayEXT { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglInitialize(IntPtr display, out int major, out int minor); [GlEntryPoint("eglInitialize")] - public EglInitialize Initialize { get; } - + public EglInitialize Initialize { get; } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetProcAddress(Utf8Buffer proc); [GlEntryPoint("eglGetProcAddress")] public EglGetProcAddress GetProcAddress { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglBindApi(int api); [GlEntryPoint("eglBindAPI")] public EglBindApi BindApi { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglChooseConfig(IntPtr display, int[] attribs, out IntPtr surfaceConfig, int numConfigs, out int choosenConfig); [GlEntryPoint("eglChooseConfig")] public EglChooseConfig ChooseConfig { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreateContext(IntPtr display, IntPtr config, IntPtr share, int[] attrs); [GlEntryPoint("eglCreateContext")] public EglCreateContext CreateContext { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglDestroyContext(IntPtr display, IntPtr context); [GlEntryPoint("eglDestroyContext")] public EglDestroyContext DestroyContext { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreatePBufferSurface(IntPtr display, IntPtr config, int[] attrs); [GlEntryPoint("eglCreatePbufferSurface")] public EglCreatePBufferSurface CreatePBufferSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglMakeCurrent(IntPtr display, IntPtr draw, IntPtr read, IntPtr context); [GlEntryPoint("eglMakeCurrent")] public EglMakeCurrent MakeCurrent { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentContext(); [GlEntryPoint("eglGetCurrentContext")] public EglGetCurrentContext GetCurrentContext { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentDisplay(); [GlEntryPoint("eglGetCurrentDisplay")] public EglGetCurrentContext GetCurrentDisplay { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglGetCurrentSurface(int readDraw); [GlEntryPoint("eglGetCurrentSurface")] public EglGetCurrentSurface GetCurrentSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void EglDisplaySurfaceVoidDelegate(IntPtr display, IntPtr surface); [GlEntryPoint("eglDestroySurface")] public EglDisplaySurfaceVoidDelegate DestroySurface { get; } [GlEntryPoint("eglSwapBuffers")] public EglDisplaySurfaceVoidDelegate SwapBuffers { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreateWindowSurface(IntPtr display, IntPtr config, IntPtr window, int[] attrs); [GlEntryPoint("eglCreateWindowSurface")] public EglCreateWindowSurface CreateWindowSurface { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglGetConfigAttrib(IntPtr display, IntPtr config, int attr, out int rv); [GlEntryPoint("eglGetConfigAttrib")] public EglGetConfigAttrib GetConfigAttrib { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitGL(); [GlEntryPoint("eglWaitGL")] public EglWaitGL WaitGL { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitClient(); [GlEntryPoint("eglWaitClient")] public EglWaitGL WaitClient { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglWaitNative(int engine); [GlEntryPoint("eglWaitNative")] public EglWaitNative WaitNative { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglQueryString(IntPtr display, int i); [GlEntryPoint("eglQueryString")] @@ -145,17 +166,20 @@ public string QueryString(IntPtr display, int i) return null; return Marshal.PtrToStringAnsi(rv); } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr EglCreatePbufferFromClientBuffer(IntPtr display, int buftype, IntPtr buffer, IntPtr config, int[] attrib_list); [GlEntryPoint("eglCreatePbufferFromClientBuffer")] public EglCreatePbufferFromClientBuffer CreatePbufferFromClientBuffer { get; } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglQueryDisplayAttribEXT(IntPtr display, int attr, out IntPtr res); [GlEntryPoint("eglQueryDisplayAttribEXT"), GlOptionalEntryPoint] public EglQueryDisplayAttribEXT QueryDisplayAttribExt { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate bool EglQueryDeviceAttribEXT(IntPtr display, int attr, out IntPtr res); [GlEntryPoint("eglQueryDeviceAttribEXT"), GlOptionalEntryPoint] diff --git a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs index a3383ac5ae3..aaba2ec09ca 100644 --- a/src/Avalonia.OpenGL/GlBasicInfoInterface.cs +++ b/src/Avalonia.OpenGL/GlBasicInfoInterface.cs @@ -15,9 +15,12 @@ public GlBasicInfoInterface(Func getProcAddress) : base(getProcA public GlBasicInfoInterface(Func nativeGetProcAddress) : base(nativeGetProcAddress, null) { } - + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlGetIntegerv(int name, out int rv); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr GlGetString(int v); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr GlGetStringi(int v, int v1); } diff --git a/src/Avalonia.OpenGL/GlInterface.cs b/src/Avalonia.OpenGL/GlInterface.cs index cae245732f0..3d947998af9 100644 --- a/src/Avalonia.OpenGL/GlInterface.cs +++ b/src/Avalonia.OpenGL/GlInterface.cs @@ -60,22 +60,27 @@ public static GlInterface FromNativeUtf8GetProcAddress(GlVersion version, Func(string proc) => Marshal.GetDelegateForFunctionPointer(GetProcAddress(proc)); // ReSharper disable UnassignedGetOnlyAutoProperty + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate int GlGetError(); [GlEntryPoint("glGetError")] public GlGetError GetError { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClearStencil(int s); [GlEntryPoint("glClearStencil")] public GlClearStencil ClearStencil { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClearColor(float r, float g, float b, float a); [GlEntryPoint("glClearColor")] public GlClearColor ClearColor { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlClear(int bits); [GlEntryPoint("glClear")] public GlClear Clear { get; } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void GlViewport(int x, int y, int width, int height); [GlEntryPoint("glViewport")] public GlViewport Viewport { get; } @@ -86,6 +91,7 @@ public static GlInterface FromNativeUtf8GetProcAddress(GlVersion version, Func