# creator ci20 GLES compiler: intermittent absence of GL\_ES macro

**URL:** <https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336>\
**Category:** PowerVR Insider\
**Created:** [July 28, 2015, 7:16pm UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336 "2015-07-28T19:16:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin-krastev](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin-krastev](https://forums.imgtec.com/u/martin-krastev)\
**Post date:** [July 28, 2015, 7:16pm UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336/1 "2015-07-28T19:16:14Z")

</div>

Hello,

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,  
Martin

---

<div class="post-metadata">

**Author:** ![PaulLy](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@PaulLy](https://forums.imgtec.com/u/PaulLy)\
**Post date:** [July 29, 2015, 8:23am UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336/2 "2015-07-29T08:23:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![martin-krastev](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin-krastev](https://forums.imgtec.com/u/martin-krastev)\
**Post date:** [July 29, 2015, 7:26pm UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336/3 "2015-07-29T19:26:36Z")

</div>

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):

```auto

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.

```

```auto

#if GL_ES == 1

#define in_qualifier attribute
#define out_qualifier varying

#else

#define in_qualifier in
#define out_qualifier out

#endif

in_qualifier vec3 at_Vertex;

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

```

```auto

#if GL_ES == 1

#ifdef GL_FRAGMENT_PRECISION_HIGH
    precision highp float;
#else
    precision mediump float;
#endif

#define xx_FragColor gl_FragColor

#else
out vec4 xx_FragColor;

#endif

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!’

---

<div class="post-metadata">

**Author:** ![PaulLy](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@PaulLy](https://forums.imgtec.com/u/PaulLy)\
**Post date:** [August 7, 2015, 7:22am UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336/4 "2015-08-07T07:22:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![martin-krastev](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin-krastev](https://forums.imgtec.com/u/martin-krastev)\
**Post date:** [August 11, 2015, 11:27pm UTC](https://forums.imgtec.com/t/creator-ci20-gles-compiler-intermittent-absence-of-gl-es-macro/2336/5 "2015-08-11T23:27:27Z")

</div>

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.
