Consider the case where an attribute is set to EGL_DONT_CARE in eglChooseConfig

SDL doesn't currently use EGL_DONT_CARE, but it doesn' hurt to future proof.
This commit is contained in:
Gabriel Jacobo 2013-07-26 12:37:36 -03:00
parent c73a37ac6f
commit 7c9692c8c5

View file

@ -343,12 +343,12 @@ public class SDLActivity extends Activity {
if (attribs[j] == EGL10.EGL_NONE) if (attribs[j] == EGL10.EGL_NONE)
break; break;
if (attribs[j] == EGL10.EGL_RED_SIZE || if (attribs[j+1] != EGL10.EGL_DONT_CARE && (attribs[j] == EGL10.EGL_RED_SIZE ||
attribs[j] == EGL10.EGL_GREEN_SIZE || attribs[j] == EGL10.EGL_GREEN_SIZE ||
attribs[j] == EGL10.EGL_BLUE_SIZE || attribs[j] == EGL10.EGL_BLUE_SIZE ||
attribs[j] == EGL10.EGL_ALPHA_SIZE || attribs[j] == EGL10.EGL_ALPHA_SIZE ||
attribs[j] == EGL10.EGL_DEPTH_SIZE || attribs[j] == EGL10.EGL_DEPTH_SIZE ||
attribs[j] == EGL10.EGL_STENCIL_SIZE) { attribs[j] == EGL10.EGL_STENCIL_SIZE)) {
egl.eglGetConfigAttrib(dpy, configs[i], attribs[j], value); egl.eglGetConfigAttrib(dpy, configs[i], attribs[j], value);
bitdiff += value[0] - attribs[j + 1]; // value is always >= attrib bitdiff += value[0] - attribs[j + 1]; // value is always >= attrib
} }