Q:

can't compile gles 30 on nexus 6 (and similar devices)

I am running into an issue that does not make too much sense to me. I am testing some simple GLES30 code on a Nexus 6 device an HTC. I am setting the code to API 23 and OS lollipop 5.0. According to the wiki it uses Adreno 420 which supports full gles 3.1 profile
https://en.wikipedia.org/wiki/Nexus_6
Yet, a simple shader fails the compilation as below:
Shader code:
#version 300 es

layout(location = 4) in vec4 a_position;
layout(location = 5) in vec4 a_color;

uniform mat4    u_mvpMatrix;
out     vec4    v_color;

void main()
{
    v_color = a_color;
    gl_Position = u_mvpMatrix * a_position;
}

Logs:
Vertex shader failed to compile with the following errors:
ERROR: 0:2: error(#308) Profile " " is not available in shader version 1777753240
ERROR: 0:1: error(#132) Syntax error: "es" parse error
ERROR: error(#273) 2 compilation errors.  No code generated

I set my Context to 3.0 as below.
const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION,
                            3,  // Request opengl ES3.0
                            EGL_NONE};
context_ = eglCreateContext(display_, config_, NULL, context_attribs);

still did not compile.
Am I missing something?
thx!

A:

Typically this means that your device does not support the GLSL version you are requiring. Try running the following code to confirm that the GLSL version supports GLSL 3.
glGetString(GL_SHADING_LANGUAGE_VERSION);

From here you can determine how to read this format.

The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings begin with a version number. The version number uses one of these forms:
  major_number.minor_number major_number.minor_number.release_number
  Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.

Here is the configuration I currently use.
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
const EGLint attribs[] = {
    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,
    EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
    EGL_BLUE_SIZE, 8,
    EGL_GREEN_SIZE, 8,
    EGL_RED_SIZE, 8,
    EGL_ALPHA_SIZE, 8,
    EGL_DEPTH_SIZE, 8,
    EGL_STENCIL_SIZE, 8,
    EGL_NONE
};
...
eglChooseConfig(display, attribs, &config, 1, &numConfigs);
...
EGLint openGLVersionRequested = 3; 
EGLint contextAttribs[] = {
    EGL_CONTEXT_CLIENT_VERSION,
    openGLVersionRequested,      // selects OpenGL ES 3.0, set to 2 to select OpenGL ES 2.0
    EGL_NONE
};
context = eglCreateContext(display, config, NULL, contextAttribs);
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
    LOGW("Unable to eglMakeCurrent");
    return -1;
}

