title: OpenGL ES 3.0 and APPLE_clip_distance extension
body: <p>According to <a href="https://developer.apple.com/library/ios/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/OpenGLESPlatforms/OpenGLESPlatforms.html" rel="nofollow">this document</a> APPLE_clip_distance extension is present on OpenGL ES 3.0 and iPhone 6+ hardware. I'm trying to use this by first enabling it in code and then using in the shader. </p>
  
  <p>I can query the maximum number of clipping planes by doing</p>
  
  <pre><code>GLint i;
  glGetIntegerv(GL_MAX_CLIP_DISTANCES_APPLE, &amp;i);
  printf("i: %d\n", i);
  </code></pre>
  
  <p>and this prints out 8.</p>
  
  <p>When trying to use this in the shader like this:</p>
  
  <pre><code>const mediump int gl_MaxClipDistances = 8;
  out highp float gl_ClipDistance[gl_MaxClipDistances];
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ERROR: 0:24: Identifier name 'gl_MaxClipDistances' cannot start with 'gl_'
  ERROR: 0:25: Use of undeclared identifier 'gl_MaxClipDistances'
  ERROR: 0:33: Use of undeclared identifier 'gl_ClipDistance'
  </code></pre>
  
  <p><a href="https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_clip_distance.txt" rel="nofollow">This document</a> describes the extension and as far as I understand it I'm supposed to redeclare the clip distance array due to the fact that I'm using ES 3.0:</p>
  
  <pre><code>(1) GLSL 300 doesn't support unsized arrays, how should gl_ClipDistance
  be sized?
  
    RESOLVED: For maximal compatibility, it works like ES2/desktop,
    remaining unsized until sized by direct access or explicitly
    redeclared.  Language describing this behavior must be added to the
    extension specification since it's gone from the base language
    specification.
  </code></pre>
  
  <p>Also declaring it like this:</p>
  
  <pre><code>out highp float gl_ClipDistance[];
  </code></pre>
  
  <p>gives this error:</p>
  
  <pre><code>ERROR: 0:25: Unsized array 'gl_ClipDistance' requires sized initializer under GLSL 300
  ERROR: 0:33: Use of undeclared identifier 'gl_ClipDistance'
  </code></pre>
  
  <p>Does somebody have a working example of this extension? </p>