Flutter Impeller
impeller::egl Namespace Reference

Classes

struct  ConfigDescriptor
 
class  Config
 An EGL config. These are returned by the display to indicate support for a specific config descriptor. More...
 
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 class  API {
  kOpenGL ,
  kOpenGLES2 ,
  kOpenGLES3
}
 
enum class  Samples {
  kOne = 1 ,
  kTwo = 2 ,
  kFour = 4
}
 
enum class  ColorFormat {
  kRGBA8888 ,
  kRGB565
}
 
enum class  StencilBits {
  kZero = 0 ,
  kEight = 8
}
 
enum class  DepthBits {
  kZero = 0 ,
  kEight = 8 ,
  kTwentyFour = 24
}
 
enum class  SurfaceType {
  kWindow ,
  kPBuffer
}
 

Functions

static EGLBoolean EGLMakeCurrentIfNecessary (EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)
 
std::function< void *(const char *)> CreateProcAddressResolver ()
 Creates a proc address resolver that resolves function pointers to EGL and OpenGL (ES) procs. More...
 
static const char * EGLErrorToString (EGLint error)
 
void LogEGLError (const char *file, int line)
 

Enumeration Type Documentation

◆ API

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

Definition at line 13 of file config.h.

◆ ColorFormat

Enumerator
kRGBA8888 
kRGB565 

Definition at line 25 of file config.h.

◆ DepthBits

Enumerator
kZero 
kEight 
kTwentyFour 

Definition at line 35 of file config.h.

◆ 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 41 of file config.h.

Function 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 12 of file egl.cc.

12  {
13  return [](const char* name) -> void* {
14  return reinterpret_cast<void*>(::eglGetProcAddress(name));
15  };
16 }

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

◆ 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 }
static const char * EGLErrorToString(EGLint error)
Definition: egl.cc:18

References EGLErrorToString().