This is a continuation of my previous post located in the GPU Tools forum. There was two interesting bugs within the initialization that should have not been allowed.
Interesting Note1: egl bind appears to always returns true.
This is a key bug to get fixed because when eglBind fails, it is a clear sign that the desired API is completely unavailable. This is where on mobile devices when you attempt to bind OpenGL, the interface should always fail. For this example, Please look at lines 244 to 272 of the sample file. This sample is a slight modification of the OpenGL ES sample included with the OpenGL ES developers kit found on this website. This section of code has a high chance of being used in multiple locations, but the main use is to initialize a variable to make sure that the api is supported.
interesting note 2: eglCreateContext Ignores EGL_CONTEXT_CLIENT_VERSION parameter.
This is another key bug. This provides basic sanity tests to the video contexts by allowing the program to easily define a specific version of the api. Lines 351 to 367 in the attached sample uses a clearly invalid client version. The client version is requesting major version 99,999,999 and minor version 0. This is bad behavior because the context creation should have failed already. Lines 369 to 380 show a minor change to go ahead and try to create an OpenGL ES 2.0 context. Either way, there should have been one failed context and a properly working context.
Note 3: Egl error mapper.
Lines 200 to 238 show how the various EGL error codes wrap. This is useful for determining where the bug in a program occurs.