| Summary: | Unsupported Multisampling breaks context/window creation | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Mike Kasprzak <mike> |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
|
Description
Mike Kasprzak
2013-11-16 07:18:04 UTC
When you create the "window" on Android (which actually already exists), SDL creates the EGL surface for it, which uses the GL config parameters. If you request unsupported parameters for it, it's the expected behaviour that it'll fail. A fix to let you change the EGL config every time you create a window (theoretically, there may be other factors preventing you from actually recreating the window) is here: https://hg.libsdl.org/SDL/rev/afd62b3fda31 Regarding querying SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_GetAttribute needs to evolve to take into consideration what type of context is active (see: https://bugzilla.libsdl.org/show_bug.cgi?id=2060 for a similar case where it also fails depending on the context version). In the meantime, I guess you can use EGL in your app directly to poll for that value. Thanks Gabriel. I have tested the changes and they work.
Like you suggested, I had to recreate the "Window" using SDL_CreateWindow for changes to take effect (SDL_GL_SetAttribute before SDL_GL_CreateContext doesn't work).
Of note, on an failing device (1st gen Nexus 7) the Window creation succeeds, and the "automatic" EGL context creation fails. When you delete the Window, it attempts to destroy the bad EGL context. Here's what's popping up in my logcat:
E/libEGL ( 4105): eglDestroySurface:570 error 300d (EGL_BAD_SURFACE)
I did some checking myself, and it looks like the SDL_EGL_CreateSurface is returning -1 when it should be returning EGL_NO_SURFACE (0). The check in SDL_EGL_DestroySurface expects EGL_NO_SURFACE.
Simple fix:
@@ -452,7 +452,7 @@
SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
{
if (SDL_EGL_ChooseConfig(_this) != 0) {
- return -1;
+ return EGL_NO_SURFACE;
}
return _this->egl_data->eglCreateWindowSurface(
Oh whoops, that in src/video/SDL_egl.c Simple fix pushed, thanks! https://hg.libsdl.org/SDL/rev/3c2694255705 |