Flutter Impeller
impeller::egl Namespace Reference

Classes

class  Config
 An EGL config. These are returned by the display to indicate support for a specific config descriptor. More...
 
struct  ConfigDescriptor
 
class  Context
 An instance of an EGL context. More...
 
class  Display
 A connection to an EGL display. Only one connection per application instance is sufficient. More...
 
class  Surface
 An instance of an EGL surface. There is no ability to create surfaces directly. Instead, one must be created using a Display connection. More...
 

Enumerations

enum  API {
  API::kOpenGL,
  API::kOpenGLES2,
  API::kOpenGLES3
}
 
enum  Samples {
  Samples::kOne = 1,
  Samples::kTwo = 2,
  Samples::kFour = 4
}
 
enum  ColorFormat {
  ColorFormat::kRGBA8888,
  ColorFormat::kRGB565
}
 
enum  StencilBits {
  StencilBits::kZero = 0,
  StencilBits::kEight = 8
}
 
enum  DepthBits {
  DepthBits::kZero = 0,
  DepthBits::kEight = 8
}
 
enum  SurfaceType {
  SurfaceType::kWindow,
  SurfaceType::kPBuffer
}
 

Functions

static EGLBoolean EGLMakeCurrentIfNecessary (EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)
 
static const char * EGLErrorToString (EGLint error)
 
void LogEGLError (const char *file, int line)
 

Variables

std::function< void *(const char *)> CreateProcAddressResolver ()
 Creates a proc address resolver that resolves function pointers to EGL and OpenGL (ES) procs. More...
 

Enumeration Type Documentation

◆ API

enum impeller::egl::API
strong
Enumerator
kOpenGL 
kOpenGLES2 
kOpenGLES3 

Definition at line 13 of file config.h.

13  {
14  kOpenGL,
15  kOpenGLES2,
16  kOpenGLES3,
17 };

◆ ColorFormat

Enumerator
kRGBA8888 
kRGB565 

Definition at line 25 of file config.h.

25  {
26  kRGBA8888,
27  kRGB565,
28 };

◆ DepthBits

Enumerator
kZero 
kEight 

Definition at line 35 of file config.h.

35  {
36  kZero = 0,
37  kEight = 8,
38 };

◆ Samples

Enumerator
kOne 
kTwo 
kFour 

Definition at line 19 of file config.h.

19  {
20  kOne = 1,
21  kTwo = 2,
22  kFour = 4,
23 };

◆ StencilBits

Enumerator
kZero 
kEight 

Definition at line 30 of file config.h.

30  {
31  kZero = 0,
32  kEight = 8,
33 };

◆ SurfaceType

Enumerator
kWindow 
kPBuffer 

Definition at line 40 of file config.h.

40  {
41  kWindow,
42  kPBuffer,
43 };

Function Documentation

◆ EGLErrorToString()

static const char* impeller::egl::EGLErrorToString ( EGLint  error)
static

Definition at line 18 of file egl.cc.

18  {
19  switch (error) {
20  case EGL_SUCCESS:
21  return "Success";
22  case EGL_NOT_INITIALIZED:
23  return "Not Initialized";
24  case EGL_BAD_ACCESS:
25  return "Bad Access";
26  case EGL_BAD_ALLOC:
27  return "Bad Alloc";
28  case EGL_BAD_ATTRIBUTE:
29  return "Bad Attribute";
30  case EGL_BAD_CONTEXT:
31  return "Bad Context";
32  case EGL_BAD_CONFIG:
33  return "Bad Config";
34  case EGL_BAD_CURRENT_SURFACE:
35  return "Bad Current Surface";
36  case EGL_BAD_DISPLAY:
37  return "Bad Display";
38  case EGL_BAD_SURFACE:
39  return "Bad Surface";
40  case EGL_BAD_MATCH:
41  return "Bad Match";
42  case EGL_BAD_PARAMETER:
43  return "Bad Parameter";
44  case EGL_BAD_NATIVE_PIXMAP:
45  return "Bad Native Pixmap";
46  case EGL_BAD_NATIVE_WINDOW:
47  return "Bad Native Window";
48  case EGL_CONTEXT_LOST:
49  return "Context Lost";
50  }
51  return "Unknown";
52 }

Referenced by LogEGLError().

◆ EGLMakeCurrentIfNecessary()

static EGLBoolean impeller::egl::EGLMakeCurrentIfNecessary ( EGLDisplay  display,
EGLSurface  draw,
EGLSurface  read,
EGLContext  context 
)
static

Definition at line 31 of file context.cc.

34  {
35  if (display != ::eglGetCurrentDisplay() ||
36  draw != ::eglGetCurrentSurface(EGL_DRAW) ||
37  read != ::eglGetCurrentSurface(EGL_READ) ||
38  context != ::eglGetCurrentContext()) {
39  return ::eglMakeCurrent(display, draw, read, context);
40  }
41  // The specified context configuration is already current.
42  return EGL_TRUE;
43 }

Referenced by impeller::egl::Context::ClearCurrent(), and impeller::egl::Context::MakeCurrent().

◆ LogEGLError()

void impeller::egl::LogEGLError ( const char *  file,
int  line 
)

Definition at line 54 of file egl.cc.

54  {
55  const auto error = ::eglGetError();
56  FML_LOG(ERROR) << "EGL Error: " << EGLErrorToString(error) << " (" << error
57  << ") in " << file << ":" << line;
58 }

References EGLErrorToString().

Variable Documentation

◆ CreateProcAddressResolver

std::function< void *(const char *)> impeller::egl::CreateProcAddressResolver

Creates a proc address resolver that resolves function pointers to EGL and OpenGL (ES) procs.

Returns
The resolver if one can be created.

Definition at line 23 of file egl.h.

Referenced by impeller::glvk::Trampoline::Trampoline().

impeller::egl::StencilBits::kEight
@ kEight
impeller::egl::ColorFormat::kRGB565
@ kRGB565
impeller::egl::Samples::kTwo
@ kTwo
impeller::BlendFactor::kZero
@ kZero
impeller::egl::API::kOpenGLES2
@ kOpenGLES2
impeller::egl::EGLErrorToString
static const char * EGLErrorToString(EGLint error)
Definition: egl.cc:18
impeller::BlendFactor::kOne
@ kOne
impeller::egl::Samples::kFour
@ kFour
impeller::egl::API::kOpenGL
@ kOpenGL
impeller::egl::SurfaceType::kWindow
@ kWindow
impeller::egl::ColorFormat::kRGBA8888
@ kRGBA8888
impeller::egl::API::kOpenGLES3
@ kOpenGLES3
impeller::egl::SurfaceType::kPBuffer
@ kPBuffer