15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    APPLE_clip_distance
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_APPLE_clip_distance
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Eric Sunalp, Apple (esunalp 'at' apple.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Keith Bauer
165bd8deadSopenharmony_ci    Alex Eddy
175bd8deadSopenharmony_ci    Benj Lipchak
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciStatus
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Complete
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciVersion
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Last Modified Date: December 9, 2013
265bd8deadSopenharmony_ci    Revision: 1
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciNumber
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    OpenGL ES Extension #193
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciDependencies
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    OpenGL ES 2.0 or OpenGL ES 3.0 is required.
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    This extension is written against the OpenGL ES 2.0.25 Specification
375bd8deadSopenharmony_ci    (November 2, 2010) and the OpenGL ES 3.0.2 Specification (April 8, 2013).
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciOverview
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    This extension adds support for hardware clip planes to OpenGL ES 2.0
425bd8deadSopenharmony_ci    and 3.0.  These were present in OpenGL ES 1.1, but were removed to
435bd8deadSopenharmony_ci    better match certain hardware.  Since they're useful for certain
445bd8deadSopenharmony_ci    applications, notable CAD, we return them here.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciIP Status
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    No known IP claims.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciNew Tokens
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    Accepted by the <pname> parameters of GetBooleanv, GetIntegerv,
535bd8deadSopenharmony_ci    GetInteger64v, and GetFloatv:
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci        MAX_CLIP_DISTANCES_APPLE       0x0D32
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Accepted by the <pname> parameters of Enable, Disable and IsEnabled:
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci        CLIP_DISTANCE0_APPLE           0x3000
605bd8deadSopenharmony_ci        CLIP_DISTANCE1_APPLE           0x3001
615bd8deadSopenharmony_ci        CLIP_DISTANCE2_APPLE           0x3002
625bd8deadSopenharmony_ci        CLIP_DISTANCE3_APPLE           0x3003
635bd8deadSopenharmony_ci        CLIP_DISTANCE4_APPLE           0x3004
645bd8deadSopenharmony_ci        CLIP_DISTANCE5_APPLE           0x3005
655bd8deadSopenharmony_ci        CLIP_DISTANCE6_APPLE           0x3006
665bd8deadSopenharmony_ci        CLIP_DISTANCE7_APPLE           0x3007
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
695bd8deadSopenharmony_ci[ES2] or
705bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 3.0 Specification (OpenGL Operation)
715bd8deadSopenharmony_ci[ES3]
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ciModify Section 2.13, Primitive Clipping (p. 46) [ES2] or
745bd8deadSopenharmony_ciModify Section 2.17, Primitive Clipping (p. 91) [ES3]
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    This view volume may be further restricted by as many as n client-
775bd8deadSopenharmony_ci    defined half-spaces. (n is an implementation-dependent maximum that must
785bd8deadSopenharmony_ci    be at least 8.)
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    The clip volume is the intersection of all such half-spaces with the view
815bd8deadSopenharmony_ci    volume (if no client-defined half-spaces are enabled, the clip volume is
825bd8deadSopenharmony_ci    the view volume).
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    A vertex shader may write a single clip distance for each supported
855bd8deadSopenharmony_ci    half-space to elements of the gl_ClipDistance[] array. Half-space n is
865bd8deadSopenharmony_ci    then given by the set of points satisfying the inequality
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci        c_n(P) >= 0,
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    where c_n(P) is the value of clip distance n at point P. For point
915bd8deadSopenharmony_ci    primitives, c_n(P) is simply the clip distance for the vertex in question.
925bd8deadSopenharmony_ci    For line and triangle primitives, per-vertex clip distances are
935bd8deadSopenharmony_ci    interpolated using a weighted mean, with weights derived according to the
945bd8deadSopenharmony_ci    algorithms described in sections 3.4 [ES2] or 3.5 [ES3] and
955bd8deadSopenharmony_ci    3.5 [ES2] or 3.6[ES3].
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    Client-defined half-spaces are enabled with the generic Enable command
985bd8deadSopenharmony_ci    and disabled with the Disable command. The value of the argument to
995bd8deadSopenharmony_ci    either command is CLIP_DISTANCEi_APPLE, where i is an integer between 0
1005bd8deadSopenharmony_ci    and n − 1; specifying a value of i enables or disables the plane equation
1015bd8deadSopenharmony_ci    with index i. The constants obey CLIP_DISTANCEi_APPLE =
1025bd8deadSopenharmony_ci    CLIP_DISTANCE0_APPLE + i.
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ciAdditions to OpenGL ES Shading Language 1.00 Specification [ES2] or
1055bd8deadSopenharmony_ciAdditions to OpenGL ES Shading Language 3.00 Specification [ES3]
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    Including the following line in a shader can be used to control
1085bd8deadSopenharmony_ci    the language features described in this extension:
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci        #extension GL_APPLE_clip_distance : <behavior>
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    where <behavior> is as described in section 3.4.
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL ES Shading Language:
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci        #define GL_APPLE_clip_distance 1
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL ES Shading Language 1.00 Specification 
1195bd8deadSopenharmony_ci(Built-in Variables) [ES2] or
1205bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL ES Shading Language 3.00 Specification
1215bd8deadSopenharmony_ci(Built-in Variables) [ES3]
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ciModify Section 7.1, Vertex Shader Special Variables (p. 59) [ES2]
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci        varying highp float gl_ClipDistance[];
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ciModify Section 7.1, Vertex Shader Special Variables (p. 77) [ES3]
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci        out highp float gl_ClipDistance[];
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ciModify Section 7.1, Vertex Shader Special Variables (p. 59) [ES2] or
1325bd8deadSopenharmony_ciModify Section 7.1, Vertex Shader Special Variables (p. 77) [ES3]
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    The variable gl_ClipDistance provides the mechanism for controlling
1355bd8deadSopenharmony_ci    user clipping.  The element gl_ClipDistance[i] specifies a clip distance
1365bd8deadSopenharmony_ci    for each plane i.  A distance of 0 means the vertex is on the plane, a
1375bd8deadSopenharmony_ci    positive distance means the vertex is inside the clip plane, and a
1385bd8deadSopenharmony_ci    negative distance means the point is outside the clip plane.  The clip
1395bd8deadSopenharmony_ci    distances will be linearly interpolated across the primitive and the
1405bd8deadSopenharmony_ci    portion of the primitive with interpolated distances less than 0 will
1415bd8deadSopenharmony_ci    be clipped.
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    The gl_ClipDistance array is predeclared as unsized and must be sized by
1445bd8deadSopenharmony_ci    the shader either redeclaring it with a size or indexing it only with
1455bd8deadSopenharmony_ci    integral constant expressions.  This needs to size the array to include
1465bd8deadSopenharmony_ci    all the clip planes that are enabled via the OpenGL ES API; if the size
1475bd8deadSopenharmony_ci    does not include all enabled planes, results are undefined.  The size can
1485bd8deadSopenharmony_ci    be at most gl_MaxClipDistances.  The number of varying vectors (see
1495bd8deadSopenharmony_ci    gl_MaxVaryingVectors) consumed by gl_ClipDistance will match the size
1505bd8deadSopenharmony_ci    of the array divided by four, no matter how many planes are enabled.
1515bd8deadSopenharmony_ci    The shader must also set all values in gl_ClipDistance that have been
1525bd8deadSopenharmony_ci    enabled via the OpenGL API, or results are undefined.  Values written
1535bd8deadSopenharmony_ci    into gl_ClipDistance for planes that are not enabled have no effect.
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ciModify Section 7.4, Built-in Constants (p. 61) [ES2] or
1565bd8deadSopenharmony_ciModify Section 7.3, Built-In Constants (p. 78) [ES3]
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    const mediump int gl_MaxClipDistances = 8;
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    None
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ciErrors
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    none
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ciNew State
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci                                      Initial
1715bd8deadSopenharmony_ci    Get Value      Type   Get Command Value    Description       Sec.
1725bd8deadSopenharmony_ci    -------------- ------ ----------- -------- ----------------- ----
1735bd8deadSopenharmony_ci    CLIP_DISTANCE- 8* x B IsEnabled   FALSE    ith user clipping 2.13 [ES2] or
1745bd8deadSopenharmony_ci    iAPPLE                                     plane enabled     2.17 [ES3]
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ciNew Implementation Dependent State
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci                                      Minimum
1805bd8deadSopenharmony_ci    Get Value      Type   Get Command Value    Description       Sec.
1815bd8deadSopenharmony_ci    -------------- ------ ----------- -------- ----------------- ----
1825bd8deadSopenharmony_ci    MAX_CLIP_DIST- Z+     GetIntegerv 8        Maximum number of 2.13 [ES2] or
1835bd8deadSopenharmony_ci    ANCES_APPLE                                user clipping     2.17 [ES3]
1845bd8deadSopenharmony_ci                                               planes
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ciConformance Tests
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    Unspecified at this time.
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ciIssues
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    (1) GLSL 300 doesn't support unsized arrays, how should gl_ClipDistance
1935bd8deadSopenharmony_ci    be sized?
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci      RESOLVED: For maximal compatibility, it works like ES2/desktop,
1965bd8deadSopenharmony_ci      remaining unsized until sized by direct access or explicitly
1975bd8deadSopenharmony_ci      redeclared.  Language describing this behavior must be added to the
1985bd8deadSopenharmony_ci      extension specification since it's gone from the base language
1995bd8deadSopenharmony_ci      specification.
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    (2) Should we specify gl_ClipDistance as input to the fragment shader?
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci      RESOLVED: No.  Although this departs from the desktop, we don't know
2045bd8deadSopenharmony_ci      of anyone who needs or wants this behavior, and it complicates the
2055bd8deadSopenharmony_ci      driver without adding any additional functionality (the user can
2065bd8deadSopenharmony_ci      always pass clip distances to the fragment shader in user-defined
2075bd8deadSopenharmony_ci      varyings if they wish).
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    (3) Should the GLSL built-in be named gl_ClipDistanceAPPLE?
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci      RESOLVED: No.  Very few GLSL extensions have adopted name suffixes, it
2125bd8deadSopenharmony_ci      would hinder portability of shaders between OpenGL and OpenGL ES, and
2135bd8deadSopenharmony_ci      if in the future gl_ClipDistance becomes part of some core ES shading
2145bd8deadSopenharmony_ci      language there are no likely incompatibilities with this extension.
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ciRevision History
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    Revision 1, 2013/12/13
2195bd8deadSopenharmony_ci        - 
220