egl_util.cc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.
  4. #include "ui/gl/egl_util.h"
  5. #include "build/build_config.h"
  6. #if BUILDFLAG(IS_ANDROID)
  7. #include <EGL/egl.h>
  8. #else
  9. #include "third_party/khronos/EGL/egl.h"
  10. #endif
  11. // This needs to be after the EGL includes
  12. #include "ui/gl/gl_bindings.h"
  13. namespace ui {
  14. const char* GetEGLErrorString(uint32_t error) {
  15. switch (error) {
  16. case EGL_SUCCESS:
  17. return "EGL_SUCCESS";
  18. case EGL_NOT_INITIALIZED:
  19. return "EGL_NOT_INITIALIZED";
  20. case EGL_BAD_ACCESS:
  21. return "EGL_BAD_ACCESS";
  22. case EGL_BAD_ALLOC:
  23. return "EGL_BAD_ALLOC";
  24. case EGL_BAD_ATTRIBUTE:
  25. return "EGL_BAD_ATTRIBUTE";
  26. case EGL_BAD_CONFIG:
  27. return "EGL_BAD_CONFIG";
  28. case EGL_BAD_CONTEXT:
  29. return "EGL_BAD_CONTEXT";
  30. case EGL_BAD_CURRENT_SURFACE:
  31. return "EGL_BAD_CURRENT_SURFACE";
  32. case EGL_BAD_DISPLAY:
  33. return "EGL_BAD_DISPLAY";
  34. case EGL_BAD_MATCH:
  35. return "EGL_BAD_MATCH";
  36. case EGL_BAD_NATIVE_PIXMAP:
  37. return "EGL_BAD_NATIVE_PIXMAP";
  38. case EGL_BAD_NATIVE_WINDOW:
  39. return "EGL_BAD_NATIVE_WINDOW";
  40. case EGL_BAD_PARAMETER:
  41. return "EGL_BAD_PARAMETER";
  42. case EGL_BAD_SURFACE:
  43. return "EGL_BAD_SURFACE";
  44. case EGL_CONTEXT_LOST:
  45. return "EGL_CONTEXT_LOST";
  46. default:
  47. return "UNKNOWN";
  48. }
  49. }
  50. // Returns the last EGL error as a string.
  51. const char* GetLastEGLErrorString() {
  52. return GetEGLErrorString(eglGetError());
  53. }
  54. } // namespace ui