SDL/include
Sam Lantinga 4b585e75d9 Fixed bug 4833 - Use EGL for X11?
Martin Fiedler

To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above.

To shine some light on why this is needed:
In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.)
Some example code:
https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e
Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation.

The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX.

I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL.


[1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
2020-02-03 08:06:52 -08:00
..
SDL.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_assert.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_atomic.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_audio.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_bits.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_blendmode.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_clipboard.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config.h.cmake Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config.h.in Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_android.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_iphoneos.h Added support for the Steam Controller on mobile devices 2020-01-29 20:09:11 -08:00
SDL_config_macosx.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_minimal.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_os2.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_pandora.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_psp.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_windows.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_winrt.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_config_wiz.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_copying.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_cpuinfo.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_egl.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_endian.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_error.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_events.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_filesystem.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_gamecontroller.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_gesture.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_haptic.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_hints.h Fixed bug 4833 - Use EGL for X11? 2020-02-03 08:06:52 -08:00
SDL_joystick.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_keyboard.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_keycode.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_loadso.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_log.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_main.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_messagebox.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_metal.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_mouse.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_mutex.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_name.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_opengl.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_opengl_glext.h Don't have Windows headers define min/max, in case they're defined by application code 2019-09-11 15:08:37 -07:00
SDL_opengles.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_opengles2.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_opengles2_gl2.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_gl2ext.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_gl2platform.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_khrplatform.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_pixels.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_platform.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_power.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_quit.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_rect.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_render.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_revision.h revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
SDL_rwops.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_scancode.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_sensor.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_shape.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_stdinc.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_surface.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_system.h Export SDL functions for iOS application delegates 2020-01-30 14:51:33 -08:00
SDL_syswm.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_assert.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_common.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_compare.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_crc32.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_font.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_fuzzer.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_harness.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_images.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_log.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_md5.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_memory.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_test_random.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_thread.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_timer.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_touch.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_types.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_version.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_video.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
SDL_vulkan.h Fixed bug 4570 - Support Vulkan Portability rather than MoltenVK specifically 2019-06-11 18:13:46 -07:00
begin_code.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
close_code.h Updated copyright date for 2020 2020-01-16 20:49:25 -08:00