| Flutter Impeller |

egl.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/toolkit/egl/egl.h"
6
7 #include "flutter/fml/logging.h"
8
9 namespace impeller {
10 namespace egl {
11
12 std::function<void*(const char*)> CreateProcAddressResolver() {
13 return [](const char* name) -> void* {
14 return reinterpret_cast<void*>(::eglGetProcAddress(name));
15 };
16 }
17
18 static const char* EGLErrorToString(EGLint error) {
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 }
53
54 void LogEGLError(const char* file, int line) {
55 const auto error = ::eglGetError();
56 FML_LOG(ERROR) << "EGL Error: " << EGLErrorToString(error) << " (" << error
57 << ") in " << file << ":" << line;
58 }
59
60 } // namespace egl
61 } // namespace impeller
impeller::egl::CreateProcAddressResolver
std::function< void *(const char *)> CreateProcAddressResolver()
Definition: egl.h:17
egl.h
impeller::egl::EGLErrorToString
static const char * EGLErrorToString(EGLint error)
Definition: egl.cc:18
impeller::egl::LogEGLError
void LogEGLError(const char *file, int line)
Definition: egl.cc:54
impeller
Definition: aiks_context.cc:10