Vixen
02b45cc4
csharp
public interface IEglApi

Every EGL entry point EglContext calls.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The same seam as IGlApi, one layer out. What can be wrong about bringing up a context is not the calls — those are transcription — but the sequence: which attribute list is built for a window and which for a pbuffer, what happens when a driver refuses GLES 3.2, whether a half-built context is torn down in the reverse of the order it was built. All of that is decidable from the call stream, and none of it is decidable on a machine with no EGL — which is every machine this repository is developed on except an Android device.

So the calls go through an interface, the loading lives behind NativeEglApi, and the tests drive a recorder.

Booleans rather than EGLBoolean, and nint for every handle. EGL's handle types are opaque pointers and its boolean is an int; carrying either as its own type here would put the binding in the interface. Failure is reported the way EGL reports it — a false return or a null handle, with GetError holding the reason — rather than by throwing, because the caller's response to EGL_BAD_MATCH from eglCreateContext is to ask for less rather than to give up.

Methods (20)

  • nint GetDisplay(nint nativeDisplay)

    eglGetDisplay.

  • bool Initialise(nint display, out int major, out int minor)

    eglInitialize.

  • bool Terminate(nint display)

    eglTerminate.

  • bool BindApi(uint api)

    eglBindAPI.

  • string? QueryString(nint display, int name)

    eglQueryString.

  • bool ChooseConfig(nint display, ReadOnlySpan<int> attributes, Span<nint> configs, out int count)

    eglChooseConfig.

  • nint CreateContext(nint display, nint config, nint share, ReadOnlySpan<int> attributes)

    eglCreateContext.

  • nint CreateWindowSurface(nint display, nint config, nint window, ReadOnlySpan<int> attributes)

    eglCreateWindowSurface.

  • nint CreatePbufferSurface(nint display, nint config, ReadOnlySpan<int> attributes)

    eglCreatePbufferSurface, which is how a device renders with no window.

  • bool DestroySurface(nint display, nint surface)

    eglDestroySurface.

  • bool DestroyContext(nint display, nint context)

    eglDestroyContext.

  • bool QuerySurface(nint display, nint surface, int attribute, out int value)

    eglQuerySurface.

  • bool MakeCurrent(nint display, nint draw, nint read, nint context)

    eglMakeCurrent.

  • nint GetCurrentContext()

    eglGetCurrentContext.

  • bool SwapBuffers(nint display, nint surface)

    eglSwapBuffers.

  • bool SwapInterval(nint display, int interval)

    eglSwapInterval.

  • bool ReleaseThread()

    eglReleaseThread.

  • nint GetProcAddress(string name)

    eglGetProcAddress.

  • nint GetClientProcAddress(string name)

    The same symbol in the client library, when there is one to ask.

  • uint GetError()

    eglGetError, which clears as it reads.

Used by (3)

  • EglContextVixen.Graphics.OpenGL
  • NativeEglApiVixen.Graphics.OpenGL
  • RecordingEglApiVixen.Graphics.OpenGL.Tests