Imagination PowerVR SDK Blog

creator ci20 GLES compiler: intermittent absence of GL_ES macro



Since my shaders are shared across GL and GLES scenarios, the former rely on the #if macro apparatus to discriminated between platforms. This is how I’ve stumbled across the following issue:

The GLSL compiler from Creator’s GLES stack ver. 1.13@3341330 may omit to define the GL_ES=1 macro in the scope of a GLSL translation unit. This behaviour is intermittent - it happens once in many runs, but without much determinism. I suspect some dependence on an internally-cached state in the driver might be at play.

Best regards,


Would it be possible for you to provide the shader source that is failing?


Hi Paul,

Here are two shaders - a vertex one and a fragment one, which show the general mechanism I use to differentiate between GL and GLES, and which shaders occasionally trigger the issue. The latter manifests like this (first log is from the vertex and second - from the fragment shader):

shader compile log: Success.
shader compile log: Compile failed.
ERROR: 0:16: 'shader in & out declarations' : requires language version 130
ERROR: 1 compilation errors. No code generated.

#if GL_ES == 1

#define in_qualifier attribute
#define out_qualifier varying


#define in_qualifier in
#define out_qualifier out


in_qualifier vec3 at_Vertex;

void main()
    gl_Position = vec4(at_Vertex, 1.0);

#if GL_ES == 1

    precision highp float;
    precision mediump float;

#define xx_FragColor gl_FragColor

out vec4 xx_FragColor;


uniform vec4 solid_color;
void main()
    xx_FragColor = solid_color;

ps: I’ve tried attaching the files but the forum has rejected them with ‘This file is not valid!’


We’re still investigating to find where exactly the issue is occurring, but it seems to be platform specific.

If you can provide any more information to help us create a consistent reproduction that would be helpful.


Hi PaulL,

I’ve been running my ci20 on jessie for a couple of days now, investigating a cpu performance issue. I’ll get back to the GLES tests once I return to wheezy.