egl_manager.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. /**************************************************************************/
  2. /* egl_manager.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "egl_manager.h"
  31. #include "drivers/gles3/rasterizer_gles3.h"
  32. #ifdef EGL_ENABLED
  33. #if defined(EGL_STATIC)
  34. #define GLAD_EGL_VERSION_1_5 true
  35. #ifdef EGL_EXT_platform_base
  36. #define GLAD_EGL_EXT_platform_base 1
  37. #endif
  38. #define KHRONOS_STATIC 1
  39. extern "C" EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
  40. extern "C" EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
  41. #undef KHRONOS_STATIC
  42. #endif // defined(EGL_STATIC)
  43. #ifndef EGL_EXT_platform_base
  44. #define GLAD_EGL_EXT_platform_base 0
  45. #endif
  46. #ifdef WINDOWS_ENABLED
  47. // Unofficial ANGLE extension: EGL_ANGLE_surface_orientation
  48. #ifndef EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE
  49. #define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
  50. #define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
  51. #define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
  52. #define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
  53. #endif
  54. #endif
  55. // Creates and caches a GLDisplay. Returns -1 on error.
  56. int EGLManager::_get_gldisplay_id(void *p_display) {
  57. // Look for a cached GLDisplay.
  58. for (unsigned int i = 0; i < displays.size(); i++) {
  59. if (displays[i].display == p_display) {
  60. return i;
  61. }
  62. }
  63. // We didn't find any, so we'll have to create one, along with its own
  64. // EGLDisplay and EGLContext.
  65. GLDisplay new_gldisplay;
  66. new_gldisplay.display = p_display;
  67. if (GLAD_EGL_VERSION_1_5) {
  68. Vector<EGLAttrib> attribs = _get_platform_display_attributes();
  69. new_gldisplay.egl_display = eglGetPlatformDisplay(_get_platform_extension_enum(), new_gldisplay.display, (attribs.size() > 0) ? attribs.ptr() : nullptr);
  70. } else if (GLAD_EGL_EXT_platform_base) {
  71. #ifdef EGL_EXT_platform_base
  72. // eglGetPlatformDisplayEXT wants its attributes as EGLint, so we'll truncate
  73. // what we already have. It's a bit naughty but I'm really not sure what else
  74. // we could do here.
  75. Vector<EGLint> attribs;
  76. for (const EGLAttrib &attrib : _get_platform_display_attributes()) {
  77. attribs.push_back((EGLint)attrib);
  78. }
  79. new_gldisplay.egl_display = eglGetPlatformDisplayEXT(_get_platform_extension_enum(), new_gldisplay.display, (attribs.size() > 0) ? attribs.ptr() : nullptr);
  80. #endif // EGL_EXT_platform_base
  81. } else {
  82. NativeDisplayType *native_display_type = (NativeDisplayType *)new_gldisplay.display;
  83. new_gldisplay.egl_display = eglGetDisplay(*native_display_type);
  84. }
  85. ERR_FAIL_COND_V(eglGetError() != EGL_SUCCESS, -1);
  86. ERR_FAIL_COND_V_MSG(new_gldisplay.egl_display == EGL_NO_DISPLAY, -1, "Can't create an EGL display.");
  87. if (!eglInitialize(new_gldisplay.egl_display, nullptr, nullptr)) {
  88. ERR_FAIL_V_MSG(-1, "Can't initialize an EGL display.");
  89. }
  90. if (!eglBindAPI(_get_platform_api_enum())) {
  91. ERR_FAIL_V_MSG(-1, "OpenGL not supported.");
  92. }
  93. Error err = _gldisplay_create_context(new_gldisplay);
  94. if (err != OK) {
  95. eglTerminate(new_gldisplay.egl_display);
  96. ERR_FAIL_V(-1);
  97. }
  98. #ifdef EGL_ANDROID_blob_cache
  99. #if defined(EGL_STATIC)
  100. bool has_blob_cache = true;
  101. #else
  102. bool has_blob_cache = (eglSetBlobCacheFuncsANDROID != nullptr);
  103. #endif
  104. if (has_blob_cache && !shader_cache_dir.is_empty()) {
  105. eglSetBlobCacheFuncsANDROID(new_gldisplay.egl_display, &EGLManager::_set_cache, &EGLManager::_get_cache);
  106. }
  107. #endif
  108. #ifdef WINDOWS_ENABLED
  109. String client_extensions_string = eglQueryString(new_gldisplay.egl_display, EGL_EXTENSIONS);
  110. if (eglGetError() == EGL_SUCCESS) {
  111. Vector<String> egl_extensions = client_extensions_string.split(" ");
  112. if (egl_extensions.has("EGL_ANGLE_surface_orientation")) {
  113. new_gldisplay.has_EGL_ANGLE_surface_orientation = true;
  114. print_verbose("EGL: EGL_ANGLE_surface_orientation is supported.");
  115. }
  116. }
  117. #endif
  118. displays.push_back(new_gldisplay);
  119. // Return the new GLDisplay's ID.
  120. return displays.size() - 1;
  121. }
  122. #ifdef EGL_ANDROID_blob_cache
  123. String EGLManager::shader_cache_dir;
  124. void EGLManager::_set_cache(const void *p_key, EGLsizeiANDROID p_key_size, const void *p_value, EGLsizeiANDROID p_value_size) {
  125. String name = CryptoCore::b64_encode_str((const uint8_t *)p_key, p_key_size).replace("/", "_");
  126. String path = shader_cache_dir.path_join(name) + ".cache";
  127. Error err = OK;
  128. Ref<FileAccess> file = FileAccess::open(path, FileAccess::WRITE, &err);
  129. if (err != OK) {
  130. return;
  131. }
  132. file->store_buffer((const uint8_t *)p_value, p_value_size);
  133. }
  134. EGLsizeiANDROID EGLManager::_get_cache(const void *p_key, EGLsizeiANDROID p_key_size, void *p_value, EGLsizeiANDROID p_value_size) {
  135. String name = CryptoCore::b64_encode_str((const uint8_t *)p_key, p_key_size).replace("/", "_");
  136. String path = shader_cache_dir.path_join(name) + ".cache";
  137. Error err = OK;
  138. Ref<FileAccess> file = FileAccess::open(path, FileAccess::READ, &err);
  139. if (err != OK) {
  140. return 0;
  141. }
  142. EGLsizeiANDROID len = file->get_length();
  143. if (len <= p_value_size) {
  144. file->get_buffer((uint8_t *)p_value, len);
  145. }
  146. return len;
  147. }
  148. #endif
  149. Error EGLManager::_gldisplay_create_context(GLDisplay &p_gldisplay) {
  150. EGLint attribs[] = {
  151. EGL_RED_SIZE,
  152. 1,
  153. EGL_BLUE_SIZE,
  154. 1,
  155. EGL_GREEN_SIZE,
  156. 1,
  157. EGL_DEPTH_SIZE,
  158. 24,
  159. EGL_NONE,
  160. };
  161. EGLint attribs_layered[] = {
  162. EGL_RED_SIZE,
  163. 8,
  164. EGL_GREEN_SIZE,
  165. 8,
  166. EGL_GREEN_SIZE,
  167. 8,
  168. EGL_ALPHA_SIZE,
  169. 8,
  170. EGL_DEPTH_SIZE,
  171. 24,
  172. EGL_NONE,
  173. };
  174. EGLint config_count = 0;
  175. if (OS::get_singleton()->is_layered_allowed()) {
  176. eglChooseConfig(p_gldisplay.egl_display, attribs_layered, &p_gldisplay.egl_config, 1, &config_count);
  177. } else {
  178. eglChooseConfig(p_gldisplay.egl_display, attribs, &p_gldisplay.egl_config, 1, &config_count);
  179. }
  180. ERR_FAIL_COND_V(eglGetError() != EGL_SUCCESS, ERR_BUG);
  181. ERR_FAIL_COND_V(config_count == 0, ERR_UNCONFIGURED);
  182. Vector<EGLint> context_attribs = _get_platform_context_attribs();
  183. p_gldisplay.egl_context = eglCreateContext(p_gldisplay.egl_display, p_gldisplay.egl_config, EGL_NO_CONTEXT, (context_attribs.size() > 0) ? context_attribs.ptr() : nullptr);
  184. ERR_FAIL_COND_V_MSG(p_gldisplay.egl_context == EGL_NO_CONTEXT, ERR_CANT_CREATE, vformat("Can't create an EGL context. Error code: %d", eglGetError()));
  185. return OK;
  186. }
  187. Error EGLManager::open_display(void *p_display) {
  188. int gldisplay_id = _get_gldisplay_id(p_display);
  189. if (gldisplay_id < 0) {
  190. return ERR_CANT_CREATE;
  191. } else {
  192. return OK;
  193. }
  194. }
  195. int EGLManager::display_get_native_visual_id(void *p_display) {
  196. int gldisplay_id = _get_gldisplay_id(p_display);
  197. ERR_FAIL_COND_V(gldisplay_id < 0, ERR_CANT_CREATE);
  198. GLDisplay gldisplay = displays[gldisplay_id];
  199. EGLint native_visual_id = -1;
  200. if (!eglGetConfigAttrib(gldisplay.egl_display, gldisplay.egl_config, EGL_NATIVE_VISUAL_ID, &native_visual_id)) {
  201. ERR_FAIL_V(-1);
  202. }
  203. return native_visual_id;
  204. }
  205. Error EGLManager::window_create(DisplayServer::WindowID p_window_id, void *p_display, void *p_native_window, int p_width, int p_height) {
  206. int gldisplay_id = _get_gldisplay_id(p_display);
  207. ERR_FAIL_COND_V(gldisplay_id < 0, ERR_CANT_CREATE);
  208. GLDisplay &gldisplay = displays[gldisplay_id];
  209. // In order to ensure a fast lookup, make sure we got enough elements in the
  210. // windows local vector to use the window id as an index.
  211. if (p_window_id >= (int)windows.size()) {
  212. windows.resize(p_window_id + 1);
  213. }
  214. GLWindow &glwindow = windows[p_window_id];
  215. glwindow.gldisplay_id = gldisplay_id;
  216. Vector<EGLAttrib> egl_attribs;
  217. #ifdef WINDOWS_ENABLED
  218. if (gldisplay.has_EGL_ANGLE_surface_orientation) {
  219. EGLint optimal_orientation;
  220. if (eglGetConfigAttrib(gldisplay.egl_display, gldisplay.egl_config, EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &optimal_orientation)) {
  221. // We only need to support inverting Y for optimizing ANGLE on D3D11.
  222. if (optimal_orientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE && !(optimal_orientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE)) {
  223. egl_attribs.push_back(EGL_SURFACE_ORIENTATION_ANGLE);
  224. egl_attribs.push_back(EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE);
  225. }
  226. } else {
  227. ERR_PRINT(vformat("Failed to get EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, error: 0x%08X", eglGetError()));
  228. }
  229. }
  230. if (!egl_attribs.is_empty()) {
  231. egl_attribs.push_back(EGL_NONE);
  232. }
  233. #endif
  234. if (GLAD_EGL_VERSION_1_5) {
  235. glwindow.egl_surface = eglCreatePlatformWindowSurface(gldisplay.egl_display, gldisplay.egl_config, p_native_window, egl_attribs.ptr());
  236. } else {
  237. EGLNativeWindowType *native_window_type = (EGLNativeWindowType *)p_native_window;
  238. glwindow.egl_surface = eglCreateWindowSurface(gldisplay.egl_display, gldisplay.egl_config, *native_window_type, nullptr);
  239. }
  240. if (glwindow.egl_surface == EGL_NO_SURFACE) {
  241. return ERR_CANT_CREATE;
  242. }
  243. glwindow.initialized = true;
  244. #ifdef WINDOWS_ENABLED
  245. if (gldisplay.has_EGL_ANGLE_surface_orientation) {
  246. EGLint orientation;
  247. if (eglQuerySurface(gldisplay.egl_display, glwindow.egl_surface, EGL_SURFACE_ORIENTATION_ANGLE, &orientation)) {
  248. if (orientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE && !(orientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE)) {
  249. glwindow.flipped_y = true;
  250. print_verbose("EGL: Using optimal surface orientation: Invert Y");
  251. }
  252. } else {
  253. ERR_PRINT(vformat("Failed to get EGL_SURFACE_ORIENTATION_ANGLE, error: 0x%08X", eglGetError()));
  254. }
  255. }
  256. #endif
  257. window_make_current(p_window_id);
  258. return OK;
  259. }
  260. void EGLManager::window_destroy(DisplayServer::WindowID p_window_id) {
  261. ERR_FAIL_INDEX(p_window_id, (int)windows.size());
  262. GLWindow &glwindow = windows[p_window_id];
  263. if (!glwindow.initialized) {
  264. return;
  265. }
  266. glwindow.initialized = false;
  267. ERR_FAIL_INDEX(glwindow.gldisplay_id, (int)displays.size());
  268. GLDisplay &gldisplay = displays[glwindow.gldisplay_id];
  269. if (glwindow.egl_surface != EGL_NO_SURFACE) {
  270. eglDestroySurface(gldisplay.egl_display, glwindow.egl_surface);
  271. glwindow.egl_surface = nullptr;
  272. }
  273. }
  274. void EGLManager::release_current() {
  275. if (!current_window) {
  276. return;
  277. }
  278. GLDisplay &current_display = displays[current_window->gldisplay_id];
  279. eglMakeCurrent(current_display.egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
  280. }
  281. void EGLManager::swap_buffers() {
  282. if (!current_window) {
  283. return;
  284. }
  285. if (!current_window->initialized) {
  286. WARN_PRINT("Current OpenGL window is uninitialized!");
  287. return;
  288. }
  289. GLDisplay &current_display = displays[current_window->gldisplay_id];
  290. eglSwapBuffers(current_display.egl_display, current_window->egl_surface);
  291. }
  292. void EGLManager::window_make_current(DisplayServer::WindowID p_window_id) {
  293. if (p_window_id == DisplayServer::INVALID_WINDOW_ID) {
  294. return;
  295. }
  296. GLWindow &glwindow = windows[p_window_id];
  297. if (&glwindow == current_window || !glwindow.initialized) {
  298. return;
  299. }
  300. current_window = &glwindow;
  301. GLDisplay &current_display = displays[current_window->gldisplay_id];
  302. eglMakeCurrent(current_display.egl_display, current_window->egl_surface, current_window->egl_surface, current_display.egl_context);
  303. #ifdef WINDOWS_ENABLED
  304. RasterizerGLES3::set_screen_flipped_y(glwindow.flipped_y);
  305. #endif
  306. }
  307. void EGLManager::set_use_vsync(bool p_use) {
  308. // We need an active window to get a display to set the vsync.
  309. if (!current_window) {
  310. return;
  311. }
  312. GLDisplay &disp = displays[current_window->gldisplay_id];
  313. int swap_interval = p_use ? 1 : 0;
  314. if (!eglSwapInterval(disp.egl_display, swap_interval)) {
  315. WARN_PRINT("Could not set V-Sync mode.");
  316. }
  317. use_vsync = p_use;
  318. }
  319. bool EGLManager::is_using_vsync() const {
  320. return use_vsync;
  321. }
  322. EGLContext EGLManager::get_context(DisplayServer::WindowID p_window_id) {
  323. GLWindow &glwindow = windows[p_window_id];
  324. if (!glwindow.initialized) {
  325. return EGL_NO_CONTEXT;
  326. }
  327. GLDisplay &display = displays[glwindow.gldisplay_id];
  328. return display.egl_context;
  329. }
  330. EGLDisplay EGLManager::get_display(DisplayServer::WindowID p_window_id) {
  331. GLWindow &glwindow = windows[p_window_id];
  332. if (!glwindow.initialized) {
  333. return EGL_NO_CONTEXT;
  334. }
  335. GLDisplay &display = displays[glwindow.gldisplay_id];
  336. return display.egl_display;
  337. }
  338. EGLConfig EGLManager::get_config(DisplayServer::WindowID p_window_id) {
  339. GLWindow &glwindow = windows[p_window_id];
  340. if (!glwindow.initialized) {
  341. return nullptr;
  342. }
  343. GLDisplay &display = displays[glwindow.gldisplay_id];
  344. return display.egl_config;
  345. }
  346. Error EGLManager::initialize(void *p_native_display) {
  347. #if defined(GLAD_ENABLED) && !defined(EGL_STATIC)
  348. // Loading EGL with a new display gets us just the bare minimum API. We'll then
  349. // have to temporarily get a proper display and reload EGL once again to
  350. // initialize everything else.
  351. if (!gladLoaderLoadEGL(EGL_NO_DISPLAY)) {
  352. ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL dynamic library.");
  353. }
  354. EGLDisplay tmp_display = EGL_NO_DISPLAY;
  355. if (GLAD_EGL_EXT_platform_base) {
  356. #ifdef EGL_EXT_platform_base
  357. // eglGetPlatformDisplayEXT wants its attributes as EGLint.
  358. Vector<EGLint> attribs;
  359. for (const EGLAttrib &attrib : _get_platform_display_attributes()) {
  360. attribs.push_back((EGLint)attrib);
  361. }
  362. tmp_display = eglGetPlatformDisplayEXT(_get_platform_extension_enum(), p_native_display, attribs.ptr());
  363. #endif // EGL_EXT_platform_base
  364. } else {
  365. WARN_PRINT("EGL: EGL_EXT_platform_base not found during init, using default platform.");
  366. EGLNativeDisplayType *native_display_type = (EGLNativeDisplayType *)p_native_display;
  367. tmp_display = eglGetDisplay(*native_display_type);
  368. }
  369. if (tmp_display == EGL_NO_DISPLAY) {
  370. eglTerminate(tmp_display);
  371. ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't get a valid initial EGL display.");
  372. }
  373. eglInitialize(tmp_display, nullptr, nullptr);
  374. int version = gladLoaderLoadEGL(tmp_display);
  375. if (!version) {
  376. eglTerminate(tmp_display);
  377. ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL dynamic library.");
  378. }
  379. int major = GLAD_VERSION_MAJOR(version);
  380. int minor = GLAD_VERSION_MINOR(version);
  381. print_verbose(vformat("Loaded EGL %d.%d", major, minor));
  382. ERR_FAIL_COND_V_MSG(!GLAD_EGL_VERSION_1_4, ERR_UNAVAILABLE, vformat("EGL version is too old! %d.%d < 1.4", major, minor));
  383. eglTerminate(tmp_display);
  384. #endif
  385. #ifdef EGL_ANDROID_blob_cache
  386. shader_cache_dir = Engine::get_singleton()->get_shader_cache_path();
  387. if (shader_cache_dir.is_empty()) {
  388. shader_cache_dir = "user://";
  389. }
  390. Error err = OK;
  391. Ref<DirAccess> da = DirAccess::open(shader_cache_dir);
  392. if (da.is_null()) {
  393. ERR_PRINT("EGL: Can't create shader cache folder, no shader caching will happen: " + shader_cache_dir);
  394. shader_cache_dir = String();
  395. } else {
  396. err = da->change_dir(String("shader_cache").path_join("EGL"));
  397. if (err != OK) {
  398. err = da->make_dir_recursive(String("shader_cache").path_join("EGL"));
  399. }
  400. if (err != OK) {
  401. ERR_PRINT("EGL: Can't create shader cache folder, no shader caching will happen: " + shader_cache_dir);
  402. shader_cache_dir = String();
  403. } else {
  404. shader_cache_dir = shader_cache_dir.path_join(String("shader_cache").path_join("EGL"));
  405. }
  406. }
  407. #endif
  408. String client_extensions_string = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
  409. // If the above method fails, we don't support client extensions, so there's nothing to check.
  410. if (eglGetError() == EGL_SUCCESS) {
  411. const char *platform = _get_platform_extension_name();
  412. if (!client_extensions_string.split(" ").has(platform)) {
  413. ERR_FAIL_V_MSG(ERR_UNAVAILABLE, vformat("EGL platform extension \"%s\" not found.", platform));
  414. }
  415. }
  416. return OK;
  417. }
  418. EGLManager::EGLManager() {
  419. }
  420. EGLManager::~EGLManager() {
  421. for (unsigned int i = 0; i < displays.size(); i++) {
  422. eglTerminate(displays[i].egl_display);
  423. }
  424. }
  425. #endif // EGL_ENABLED