Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ui / gl / egl_util.cc
blob17d91d1fdd2107dc7800689944cc5880c0f2818e
1 // Copyright (c) 2012 The Chromium 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.
5 #include "ui/gl/egl_util.h"
7 #if defined(OS_ANDROID)
8 #include <EGL/egl.h>
9 #else
10 #include "third_party/khronos/EGL/egl.h"
11 #endif
13 // This needs to be after the EGL includes
14 #include "ui/gl/gl_bindings.h"
16 namespace ui {
18 const char* GetEGLErrorString(uint32_t error) {
19 switch (error) {
20 case EGL_SUCCESS:
21 return "EGL_SUCCESS";
22 case EGL_NOT_INITIALIZED:
23 return "EGL_NOT_INITIALIZED";
24 case EGL_BAD_ACCESS:
25 return "EGL_BAD_ACCESS";
26 case EGL_BAD_ALLOC:
27 return "EGL_BAD_ALLOC";
28 case EGL_BAD_ATTRIBUTE:
29 return "EGL_BAD_ATTRIBUTE";
30 case EGL_BAD_CONFIG:
31 return "EGL_BAD_CONFIG";
32 case EGL_BAD_CONTEXT:
33 return "EGL_BAD_CONTEXT";
34 case EGL_BAD_CURRENT_SURFACE:
35 return "EGL_BAD_CURRENT_SURFACE";
36 case EGL_BAD_DISPLAY:
37 return "EGL_BAD_DISPLAY";
38 case EGL_BAD_MATCH:
39 return "EGL_BAD_MATCH";
40 case EGL_BAD_NATIVE_PIXMAP:
41 return "EGL_BAD_NATIVE_PIXMAP";
42 case EGL_BAD_NATIVE_WINDOW:
43 return "EGL_BAD_NATIVE_WINDOW";
44 case EGL_BAD_PARAMETER:
45 return "EGL_BAD_PARAMETER";
46 case EGL_BAD_SURFACE:
47 return "EGL_BAD_SURFACE";
48 case EGL_CONTEXT_LOST:
49 return "EGL_CONTEXT_LOST";
50 default:
51 return "UNKNOWN";
55 // Returns the last EGL error as a string.
56 const char* GetLastEGLErrorString() {
57 return GetEGLErrorString(eglGetError());
60 } // namespace ui