Flutter Windows Embedder
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 
6 
7 #include <EGL/egl.h>
8 
9 #include "flutter/fml/logging.h"
10 
11 namespace flutter {
12 namespace egl {
13 
14 namespace {
15 
16 const char* EGLErrorToString(EGLint error) {
17  switch (error) {
18  case EGL_SUCCESS:
19  return "Success";
20  case EGL_NOT_INITIALIZED:
21  return "Not Initialized";
22  case EGL_BAD_ACCESS:
23  return "Bad Access";
24  case EGL_BAD_ALLOC:
25  return "Bad Alloc";
26  case EGL_BAD_ATTRIBUTE:
27  return "Bad Attribute";
28  case EGL_BAD_CONTEXT:
29  return "Bad Context";
30  case EGL_BAD_CONFIG:
31  return "Bad Config";
32  case EGL_BAD_CURRENT_SURFACE:
33  return "Bad Current Surface";
34  case EGL_BAD_DISPLAY:
35  return "Bad Display";
36  case EGL_BAD_SURFACE:
37  return "Bad Surface";
38  case EGL_BAD_MATCH:
39  return "Bad Match";
40  case EGL_BAD_PARAMETER:
41  return "Bad Parameter";
42  case EGL_BAD_NATIVE_PIXMAP:
43  return "Bad Native Pixmap";
44  case EGL_BAD_NATIVE_WINDOW:
45  return "Bad Native Window";
46  case EGL_CONTEXT_LOST:
47  return "Context Lost";
48  }
49  FML_UNREACHABLE();
50  return "Unknown";
51 }
52 
53 } // namespace
54 
55 void LogEGLError(std::string_view message) {
56  const EGLint error = ::eglGetError();
57  return FML_LOG(ERROR) << "EGL Error: " << EGLErrorToString(error) << " ("
58  << error << ") " << message;
59 }
60 
61 void LogEGLError(std::string_view file, int line) {
62  std::stringstream stream;
63  stream << "in " << file << ":" << line;
64  LogEGLError(stream.str());
65 }
66 
67 } // namespace egl
68 } // namespace flutter
egl.h
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::egl::LogEGLError
void LogEGLError(std::string_view message)
Log the last EGL error with an error message.
Definition: egl.cc:55
message
Win32Message message
Definition: keyboard_unittests.cc:137