Bram
Bram

Reputation: 8263

eglCreateFramebuffer() causes EGL_BAD_CONFIG (Invalid EGL frame buffer configuration)

My app on Google Play is causing this error on customer devices (but not on my test devices, nor on Google's prelaunch report devices.)

EGL_BAD_CONFIG (Invalid EGL frame buffer configuration)

When doing this call: eglCreateContext( display, config, NULL, contextAttribs );

The attributes I pass:

const EGLint contextAttribs[] =
{
  EGL_CONTEXT_CLIENT_VERSION, 3,
  EGL_NONE
};

The display is successfully retrieved like this:

EGLDisplay display = eglGetDisplay( EGL_DEFAULT_DISPLAY );

The config was successfully retrieved with: eglChooseConfig() using these attributes...

        const EGLint attribs[] = {
                EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
                EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
                EGL_DEPTH_SIZE, withDepthBuffer ? 16 : 0,
                EGL_BLUE_SIZE, 8,
                EGL_GREEN_SIZE, 8,
                EGL_RED_SIZE, 8,
                EGL_NONE
        };

...and these fallback attributes if none match:

        const EGLint attribs_fallback[] = {
                EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
                EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
                EGL_DEPTH_SIZE, 16,
                EGL_BLUE_SIZE, 5,
                EGL_GREEN_SIZE, 6,
                EGL_RED_SIZE, 5,
                EGL_NONE
        };

After the eglChooseConfig() of preferred or fallback config, the numConfigs that matches is at least 1.

Also, the preceding call to eglCreateWindowSurface() succeeds as well.

This is with:

EGL VENDOR:Android

EGL VERSION:1.4 Android META-EGL

What is causing some devices to fail on the eglCreateContext() call?

And if it is invalid, why is eglChooseConfig returning the offending config?

Upvotes: 1

Views: 1459

Answers (2)

Zeitt
Zeitt

Reputation: 11

Most likely no longer relevant for you, but I had same problem and posting my fix here in case someone else also will encounter this problem in future:

Like stonesthrow said & you suspected config is ES2 and not ES3, causing incompatibility. Changing EGL_RENDERABLE_TYPE from EGL_OPENGL_ES2_BIT to EGL_OPENGL_ES3_BIT helped for me.

Upvotes: 1

stonesthrow
stonesthrow

Reputation: 41

Need more info. Query all the attributes of the config you are choosing - print out, see if something funny there.

I'm with Bram, you might be selecting a ES2 config and then requiring ES3 context.

Upvotes: 1

Related Questions