We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2037

Summary: Common EGL code [patch]
Product: SDL Reporter: Gabriel Jacobo <gabomdq>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: egl v1
egl v2
egl v3

Description Gabriel Jacobo 2013-08-14 10:28:41 UTC
Created attachment 1286 [details]
egl v1

The attached patch abstracts the EGL functionality from X11 and Android into a common base. I've tried to test as many combinations of common Android pitfalls as I could (rotating, pausing while in landscape, going away via home or task switch button, etc) and it seems to hold up. 

Once this lands, I'll update the Raspberry patch to be based on this.

Ideally, the PSP and Pandora video backends should be updated too.
Comment 1 Gabriel Jacobo 2013-08-15 13:19:55 UTC
Created attachment 1287 [details]
egl v2

The attached patch improves the X11 OpenGL backend. It will check if the GLX_EXT_create_context_es2_profile extension is present (as is the case with Nvidia binaries), and use GLX to create a ES/ES2 context instead of EGL which provides a software implementation when using these drivers.

It also separates the GL ES/ES2 logic from the EGL logic a bit (more work is needed though, see bug ). Currently the X11 backend mostly assumes EGL=OpenGL ES, when this is not always the case (for example, in the case of Nvidia binaries mentioned above).

Ideally, I think the SDL_GL_CONTEXT_EGL setting should be removed, and the decision on which context type to create should be done solely based on the SDL_GL_CONTEXT_PROFILE_MASK. The problem of course is that this breaks the contract with the user, though it's something we can work around internally until we eventually deprecate SDL_GL_CONTEXT_EGL.
Comment 2 Gabriel Jacobo 2013-08-16 14:00:06 UTC
Created attachment 1290 [details]
egl v3

Fixes weird crash in the Android emulator.
Improves the pause/resume process on Android.
Comment 3 Gabriel Jacobo 2013-08-19 19:49:38 UTC
Fixed in http://hg.libsdl.org/SDL/rev/ac4ce59c40e7