public sealed class NativeEglApiThe EGL entry points, out of the platform's libEGL.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Hand-loaded, because there is no binding to use. Silk.NET.EGL exists only for Silk.NET 1 — it stops at 1.9.0 — and Silk.NET 2's GLES windowing reaches EGL through GLFW or SDL rather than binding it. Nineteen entry points is a small enough surface that this is the cheaper answer, and it keeps the loading rules the same as every other native dependency in the engine's: NativeLibraries searches the application's own runtimes/<rid>/native/ layout before the machine's, and knows about the versioned soname that a runtime-only install actually has.
Two libraries, not one. libEGL has the context management and libGLESv2 has the GL functions, and the second is loaded here rather than by Silk.NET.OpenGLES so that GetClientProcAddress can answer out of its symbol table. That order matters on any driver older than EGL 1.5, where eglGetProcAddress is only required to resolve extension entry points and is allowed to return null for glDrawArrays — see GetClientProcAddress.
Function pointers rather than DllImport. The library's name is not known until it is found, which is the whole point of the search; a DllImport names it at compile time. It also means nothing here goes through Assembly.Location — the NativeAOT gate VulkanLoader and OpenALLoader both record.
The unmanaged calling convention is the platform default. EGL's headers say KHRONOS_APIENTRY, which is __stdcall on 32-bit Windows and nothing anywhere else — and 32-bit Windows is not a RID this engine ships.
Not exercised by the test suite, the same position SilkGlApi and SilkGlesApi take. What can be wrong here is a signature, which a driver finds immediately and a fake never would; what can be wrong about using EGL is in EglContext, and that is tested against IEglApi.
Fields and properties (2)
public static string? ResolvedEglPathWhere libEGL was found, for logging at boot.
public static string? ResolvedClientPathWhere libGLESv2 was found, or if it was not.
Methods (21)
public static bool TryLoad(out NativeEglApi? api, out string? reason)Loads EGL, reporting failure rather than throwing.
public nint GetDisplay(nint nativeDisplay)eglGetDisplay.
public bool Initialise(nint display, out int major, out int minor)eglInitialize.
public bool Terminate(nint display)eglTerminate.
public bool BindApi(uint api)eglBindAPI.
public string? QueryString(nint display, int name)eglQueryString.
public bool ChooseConfig(nint display, ReadOnlySpan<int> attributes, Span<nint> configs, out int count)eglChooseConfig.
public nint CreateContext(nint display, nint config, nint share, ReadOnlySpan<int> attributes)eglCreateContext.
public nint CreateWindowSurface(nint display, nint config, nint window, ReadOnlySpan<int> attributes)eglCreateWindowSurface.
public nint CreatePbufferSurface(nint display, nint config, ReadOnlySpan<int> attributes)eglCreatePbufferSurface, which is how a device renders with no window.
public bool DestroySurface(nint display, nint surface)eglDestroySurface.
public bool DestroyContext(nint display, nint context)eglDestroyContext.
public bool QuerySurface(nint display, nint surface, int attribute, out int value)eglQuerySurface.
public bool MakeCurrent(nint display, nint draw, nint read, nint context)eglMakeCurrent.
public nint GetCurrentContext()eglGetCurrentContext.
public bool SwapBuffers(nint display, nint surface)eglSwapBuffers.
public bool SwapInterval(nint display, int interval)eglSwapInterval.
public bool ReleaseThread()eglReleaseThread.
public nint GetProcAddress(string name)eglGetProcAddress.
public nint GetClientProcAddress(string name)The same symbol in the client library, when there is one to ask.
public uint GetError()eglGetError, which clears as it reads.