15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_separate_shader_objects
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_separate_shader_objects
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA (mjk 'at' nvidia.com)
125bd8deadSopenharmony_ci    Greg Roth, NVIDIA (groth 'at' nvidia.com)
135bd8deadSopenharmony_ci    Pat Brown, NVIDIA (pbrown 'at' nvidia.com)
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ciContributors
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    Bruce Merry, ARM
185bd8deadSopenharmony_ci    Daniel Koch, TransGaming
195bd8deadSopenharmony_ci    Eric Werness, NVIDIA
205bd8deadSopenharmony_ci    Graham Sellers, AMD
215bd8deadSopenharmony_ci    Greg Roth, NVIDIA
225bd8deadSopenharmony_ci    Jason Green, TransGaming
235bd8deadSopenharmony_ci    John Kessenich, Intel
245bd8deadSopenharmony_ci    Jon Leech
255bd8deadSopenharmony_ci    Kevin Rogovin 
265bd8deadSopenharmony_ci    Nick Haemel, AMD
275bd8deadSopenharmony_ci    Robert Ohannessian
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ciNotice
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ci    Copyright (c) 2010-2013 The Khronos Group Inc. Copyright terms at
325bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ciSpecification Update Policy
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
375bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
385bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
395bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
405bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
415bd8deadSopenharmony_ci    described in more detail at
425bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciStatus
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    Complete. Approved by the ARB on June 9, 2010.
475bd8deadSopenharmony_ci    Approved by the Khronos Board of Promoters on July 23, 2010.
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciVersion
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    Last Modified Date:  1 August 2011
525bd8deadSopenharmony_ci    Version:             25
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ciNumber
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    ARB Extension #97
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ciDependencies
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 4.0 Compatibility
615bd8deadSopenharmony_ci    Profile (March 11, 2010) specification.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    Written based on the wording of The OpenGL Shading Language 4.00.8
645bd8deadSopenharmony_ci    (March 10, 2010) specification.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    This extension requires OpenGL 2.0 or ARB_shader_objects.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci    This extension interacts with OpenGL 4.0 (Core Profile).
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    This extension interacts with GLSL 1.40 (and earlier).
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    This extension interacts with ARB_geometry_shader4,
735bd8deadSopenharmony_ci    EXT_geometry_shader4, and/or NV_geometry_shader4.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    This extension depends on ARB_explicit_attrib_location.
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    This extension interacts with ARB_tessellation_shader or OpenGL 4.0.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci    This extension interacts with GL_ARB_gpu_shader_fp64 or OpenGL 4.0.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    This extension interacts with ARB_explicit_attrib_location,
825bd8deadSopenharmony_ci    ARB_vertex_attrib_64bit, OpenGL 3.3, and OpenGL 4.1.
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    This extension interacts with the EXT_separate_shader_objects extension.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    This extension interacts with ARB_vertex_program, ARB_fragment_program,
875bd8deadSopenharmony_ci    NV_gpu_program4 and related assembly extensions.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ciOverview
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    Conventional GLSL requires multiple shader stages (vertex,
925bd8deadSopenharmony_ci    fragment, geometry, tessellation control, and tessellation
935bd8deadSopenharmony_ci    evaluation) to be linked into a single monolithic program object to
945bd8deadSopenharmony_ci    specify a GLSL shader for each stage.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    While GLSL's monolithic approach has some advantages for
975bd8deadSopenharmony_ci    optimizing shaders as a unit that span multiple stages, all
985bd8deadSopenharmony_ci    existing GPU hardware supports the more flexible mix-and-match
995bd8deadSopenharmony_ci    approach.
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    Shaders written for HLSL9, Cg, the prior OpenGL assembly program
1025bd8deadSopenharmony_ci    extensions, and game console favor a more flexible "mix-and-match"
1035bd8deadSopenharmony_ci    approach to specifying shaders independently for these different
1045bd8deadSopenharmony_ci    shader stages.  Many developers build their shader content around
1055bd8deadSopenharmony_ci    the mix-and-match approach where they can use a single vertex shader
1065bd8deadSopenharmony_ci    with multiple fragment shaders (or vice versa).
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    This extension adopts a "mix-and-match" shader stage model for GLSL
1095bd8deadSopenharmony_ci    allowing multiple different GLSL program objects to be bound at once
1105bd8deadSopenharmony_ci    each to an individual rendering pipeline stage independently of
1115bd8deadSopenharmony_ci    other stage bindings. This allows program objects to contain only
1125bd8deadSopenharmony_ci    the shader stages that best suit the applications needs.
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    This extension introduces the program pipeline object that serves as
1155bd8deadSopenharmony_ci    a container for the program bound to any particular rendering stage.
1165bd8deadSopenharmony_ci    It can be bound, unbound, and rebound to simply save and restore the
1175bd8deadSopenharmony_ci    complete shader stage to program object bindings.  Like framebuffer
1185bd8deadSopenharmony_ci    and vertex array objects, program pipeline objects are "container"
1195bd8deadSopenharmony_ci    objects that are not shared between contexts.
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    To bind a program object to a specific shader stage or set of
1225bd8deadSopenharmony_ci    stages, UseProgramStages is used.  The VERTEX_SHADER_BIT,
1235bd8deadSopenharmony_ci    GEOMETRY_SHADER_BIT, FRAGMENT_SHADER_BIT, TESS_CONTROL_SHADER_BIT,
1245bd8deadSopenharmony_ci    and TESS_EVALUATION_SHADER_BIT tokens refer to the conventional
1255bd8deadSopenharmony_ci    vertex, geometry, fragment, tessellation control and tessellation
1265bd8deadSopenharmony_ci    evaluation stages respectively. ActiveShaderProgram specifies the
1275bd8deadSopenharmony_ci    program that Uniform* commands will update.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    While ActiveShaderProgram allows the use of conventional Uniform*
1305bd8deadSopenharmony_ci    commands to update uniform variable values for separable program
1315bd8deadSopenharmony_ci    objects, this extension provides a preferrable interface in a set
1325bd8deadSopenharmony_ci    of ProgramUniform* commands that update the same uniform variables
1335bd8deadSopenharmony_ci    but take a parameter indicating the program object to be updated,
1345bd8deadSopenharmony_ci    rather than updating the currently active program object. These
1355bd8deadSopenharmony_ci    commands mirror those introduced in EXT_direct_state_access.
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    While glActiveShaderProgram provides a selector for setting and
1385bd8deadSopenharmony_ci    querying uniform values of a program object, the glProgramUniform*
1395bd8deadSopenharmony_ci    commands provide a selector-free way to modify uniforms of a GLSL
1405bd8deadSopenharmony_ci    program object without an explicit bind. This selector-free model
1415bd8deadSopenharmony_ci    reduces API overhead and provides a cleaner interface for
1425bd8deadSopenharmony_ci    applications.
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Separate linking creates the possibility that certain output varyings
1455bd8deadSopenharmony_ci    of a shader may go unread by the subsequent shader inputting varyings.
1465bd8deadSopenharmony_ci    In this case, the output varyings are simply ignored.  It is also
1475bd8deadSopenharmony_ci    possible input varyings from a shader may not be written as output
1485bd8deadSopenharmony_ci    varyings of a preceding shader.  In this case, the unwritten input
1495bd8deadSopenharmony_ci    varying values are undefined.
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    This extension builds on the proof-of-concept provided by
1525bd8deadSopenharmony_ci    EXT_separate_shader_objects which demonstrated that separate
1535bd8deadSopenharmony_ci    shader objects can work for GLSL.  EXT_separate_shader_objects
1545bd8deadSopenharmony_ci    was a response to repeated requests for this functionality from
1555bd8deadSopenharmony_ci    3D developers.
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci    This ARB version addresses several "loose ends" in the prior
1585bd8deadSopenharmony_ci    EXT extension.  In particular, it allows user-defined varyings
1595bd8deadSopenharmony_ci    with explicitly defined locations or implicitly assigned locations.
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci    This ARB extension extends the GLSL language's use of layout
1625bd8deadSopenharmony_ci    qualifiers to provide cross-stage interfacing.
1635bd8deadSopenharmony_ci    
1645bd8deadSopenharmony_ciIP Status
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    No known IP claims.
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ciNew Procedures and Functions
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    void UseProgramStages(uint pipeline, bitfield stages,
1715bd8deadSopenharmony_ci                          uint program);
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    void ActiveShaderProgram(uint pipeline, uint program);
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    uint CreateShaderProgramv(enum type, sizei count,
1765bd8deadSopenharmony_ci                              const char **strings);
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    void BindProgramPipeline(uint pipeline);
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci    void DeleteProgramPipelines(sizei n, const uint *pipelines);
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    void GenProgramPipelines(sizei n, uint *pipelines);
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    boolean IsProgramPipeline(uint pipeline);
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci    void ProgramParameteri(uint program, enum pname, int value);
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    void GetProgramPipelineiv(uint pipeline, enum pname, int *params);
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    void ProgramUniform1i(uint program, int location,
1915bd8deadSopenharmony_ci                          int x);
1925bd8deadSopenharmony_ci    void ProgramUniform2i(uint program, int location,
1935bd8deadSopenharmony_ci                          int x, int y);
1945bd8deadSopenharmony_ci    void ProgramUniform3i(uint program, int location,
1955bd8deadSopenharmony_ci                          int x, int y, int z);
1965bd8deadSopenharmony_ci    void ProgramUniform4i(uint program, int location,
1975bd8deadSopenharmony_ci                          int x, int y, int z, int w);
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    void ProgramUniform1ui(uint program, int location,
2005bd8deadSopenharmony_ci                           uint x);
2015bd8deadSopenharmony_ci    void ProgramUniform2ui(uint program, int location,
2025bd8deadSopenharmony_ci                           uint x, uint y);
2035bd8deadSopenharmony_ci    void ProgramUniform3ui(uint program, int location,
2045bd8deadSopenharmony_ci                           uint x, uint y, uint z);
2055bd8deadSopenharmony_ci    void ProgramUniform4ui(uint program, int location,
2065bd8deadSopenharmony_ci                           uint x, uint y, uint z, uint w);
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    void ProgramUniform1f(uint program, int location,
2095bd8deadSopenharmony_ci                          float x);
2105bd8deadSopenharmony_ci    void ProgramUniform2f(uint program, int location,
2115bd8deadSopenharmony_ci                          float x, float y);
2125bd8deadSopenharmony_ci    void ProgramUniform3f(uint program, int location,
2135bd8deadSopenharmony_ci                          float x, float y, float z);
2145bd8deadSopenharmony_ci    void ProgramUniform4f(uint program, int location,
2155bd8deadSopenharmony_ci                          float x, float y, float z, float w);
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ci    void ProgramUniform1d(uint program, int location,
2185bd8deadSopenharmony_ci                          double x);
2195bd8deadSopenharmony_ci    void ProgramUniform2d(uint program, int location,
2205bd8deadSopenharmony_ci                          double x, double y);
2215bd8deadSopenharmony_ci    void ProgramUniform3d(uint program, int location,
2225bd8deadSopenharmony_ci                          double x, double y, double z);
2235bd8deadSopenharmony_ci    void ProgramUniform4d(uint program, int location,
2245bd8deadSopenharmony_ci                          double x, double y, double z, double w);
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    void ProgramUniform1iv(uint program, int location,
2275bd8deadSopenharmony_ci                           sizei count, const int *value);
2285bd8deadSopenharmony_ci    void ProgramUniform2iv(uint program, int location,
2295bd8deadSopenharmony_ci                           sizei count, const int *value);
2305bd8deadSopenharmony_ci    void ProgramUniform3iv(uint program, int location,
2315bd8deadSopenharmony_ci                           sizei count, const int *value);
2325bd8deadSopenharmony_ci    void ProgramUniform4iv(uint program, int location,
2335bd8deadSopenharmony_ci                           sizei count, const int *value);
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    void ProgramUniform1uiv(uint program, int location,
2365bd8deadSopenharmony_ci                            sizei count, const uint *value);
2375bd8deadSopenharmony_ci    void ProgramUniform2uiv(uint program, int location,
2385bd8deadSopenharmony_ci                            sizei count, const uint *value);
2395bd8deadSopenharmony_ci    void ProgramUniform3uiv(uint program, int location,
2405bd8deadSopenharmony_ci                            sizei count, const uint *value);
2415bd8deadSopenharmony_ci    void ProgramUniform4uiv(uint program, int location,
2425bd8deadSopenharmony_ci                            sizei count, const uint *value);
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    void ProgramUniform1fv(uint program, int location,
2455bd8deadSopenharmony_ci                           sizei count, const float *value);
2465bd8deadSopenharmony_ci    void ProgramUniform2fv(uint program, int location,
2475bd8deadSopenharmony_ci                           sizei count, const float *value);
2485bd8deadSopenharmony_ci    void ProgramUniform3fv(uint program, int location,
2495bd8deadSopenharmony_ci                           sizei count, const float *value);
2505bd8deadSopenharmony_ci    void ProgramUniform4fv(uint program, int location,
2515bd8deadSopenharmony_ci                           sizei count, const float *value);
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    void ProgramUniform1dv(uint program, int location,
2545bd8deadSopenharmony_ci                           sizei count, const double *value);
2555bd8deadSopenharmony_ci    void ProgramUniform2dv(uint program, int location,
2565bd8deadSopenharmony_ci                           sizei count, const double *value);
2575bd8deadSopenharmony_ci    void ProgramUniform3dv(uint program, int location,
2585bd8deadSopenharmony_ci                           sizei count, const double *value);
2595bd8deadSopenharmony_ci    void ProgramUniform4dv(uint program, int location,
2605bd8deadSopenharmony_ci                           sizei count, const double *value);
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    void ProgramUniformMatrix2fv(uint program, int location,
2635bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2645bd8deadSopenharmony_ci                                 const float *value);
2655bd8deadSopenharmony_ci    void ProgramUniformMatrix3fv(uint program, int location,
2665bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2675bd8deadSopenharmony_ci                                 const float *value);
2685bd8deadSopenharmony_ci    void ProgramUniformMatrix4fv(uint program, int location,
2695bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2705bd8deadSopenharmony_ci                                 const float *value);
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    void ProgramUniformMatrix2dv(uint program, int location,
2735bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2745bd8deadSopenharmony_ci                                 const double *value);
2755bd8deadSopenharmony_ci    void ProgramUniformMatrix3dv(uint program, int location,
2765bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2775bd8deadSopenharmony_ci                                 const double *value);
2785bd8deadSopenharmony_ci    void ProgramUniformMatrix4dv(uint program, int location,
2795bd8deadSopenharmony_ci                                 sizei count, boolean transpose,
2805bd8deadSopenharmony_ci                                 const double *value);
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    void ProgramUniformMatrix2x3fv(uint program, int location,
2835bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2845bd8deadSopenharmony_ci                                   const float *value);
2855bd8deadSopenharmony_ci    void ProgramUniformMatrix3x2fv(uint program, int location,
2865bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2875bd8deadSopenharmony_ci                                   const float *value);
2885bd8deadSopenharmony_ci    void ProgramUniformMatrix2x4fv(uint program, int location,
2895bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2905bd8deadSopenharmony_ci                                   const float *value);
2915bd8deadSopenharmony_ci    void ProgramUniformMatrix4x2fv(uint program, int location,
2925bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2935bd8deadSopenharmony_ci                                   const float *value);
2945bd8deadSopenharmony_ci    void ProgramUniformMatrix3x4fv(uint program, int location,
2955bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2965bd8deadSopenharmony_ci                                   const float *value);
2975bd8deadSopenharmony_ci    void ProgramUniformMatrix4x3fv(uint program, int location,
2985bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
2995bd8deadSopenharmony_ci                                   const float *value);
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci    void ProgramUniformMatrix2x3dv(uint program, int location,
3025bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3035bd8deadSopenharmony_ci                                   const double *value);
3045bd8deadSopenharmony_ci    void ProgramUniformMatrix3x2dv(uint program, int location,
3055bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3065bd8deadSopenharmony_ci                                   const double *value);
3075bd8deadSopenharmony_ci    void ProgramUniformMatrix2x4dv(uint program, int location,
3085bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3095bd8deadSopenharmony_ci                                   const double *value);
3105bd8deadSopenharmony_ci    void ProgramUniformMatrix4x2dv(uint program, int location,
3115bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3125bd8deadSopenharmony_ci                                   const double *value);
3135bd8deadSopenharmony_ci    void ProgramUniformMatrix3x4dv(uint program, int location,
3145bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3155bd8deadSopenharmony_ci                                   const double *value);
3165bd8deadSopenharmony_ci    void ProgramUniformMatrix4x3dv(uint program, int location,
3175bd8deadSopenharmony_ci                                   sizei count, boolean transpose,
3185bd8deadSopenharmony_ci                                   const double *value);
3195bd8deadSopenharmony_ci
3205bd8deadSopenharmony_ci   void ValidateProgramPipeline(uint pipeline );
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci   void GetProgramPipelineInfoLog(uint pipeline, sizei bufSize,
3235bd8deadSopenharmony_ci                                  sizei *length, char *infoLog);
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ciNew Tokens
3265bd8deadSopenharmony_ci
3275bd8deadSopenharmony_ci    Accepted by <stages> parameter to UseProgramStages:
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci        VERTEX_SHADER_BIT                      0x00000001
3305bd8deadSopenharmony_ci        FRAGMENT_SHADER_BIT                    0x00000002
3315bd8deadSopenharmony_ci        GEOMETRY_SHADER_BIT                    0x00000004
3325bd8deadSopenharmony_ci        TESS_CONTROL_SHADER_BIT                0x00000008
3335bd8deadSopenharmony_ci        TESS_EVALUATION_SHADER_BIT             0x00000010
3345bd8deadSopenharmony_ci        ALL_SHADER_BITS                        0xFFFFFFFF
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    Accepted by the <pname> parameter of ProgramParameteri and
3375bd8deadSopenharmony_ci    GetProgramiv:
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci        PROGRAM_SEPARABLE                      0x8258
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci    Accepted by <type> parameter to GetProgramPipelineiv:
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci        ACTIVE_PROGRAM                         0x8259
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
3465bd8deadSopenharmony_ci    GetInteger64v, GetFloatv, and GetDoublev:
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci        PROGRAM_PIPELINE_BINDING               0x825A
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.0 Compatibility Profile
3515bd8deadSopenharmony_ciSpecification (OpenGL Operation):
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci -- Section 2.14 "Vertex Shaders" (page 89)
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    Modify the third paragraphs:
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci    To use a vertex shader, shader source code is first loaded into a
3585bd8deadSopenharmony_ci    shader object and then compiled. A shader object corresponds to a
3595bd8deadSopenharmony_ci    stage in the rendering pipeline referred to as its shader stage or
3605bd8deadSopenharmony_ci    type. One or more vertex shader objects are attached to a program
3615bd8deadSopenharmony_ci    object. The program object is then linked, which generates
3625bd8deadSopenharmony_ci    executable code from all the compiled shader objects attached to the
3635bd8deadSopenharmony_ci    program. When program objects are bound to a shader stage, they
3645bd8deadSopenharmony_ci    become the current program object for that stage. When the current
3655bd8deadSopenharmony_ci    program object for the vertex stage includes a vertex shader, it is
3665bd8deadSopenharmony_ci    considered the active program object for the vertex stage. The
3675bd8deadSopenharmony_ci    current program object for all stages may be set at once using a
3685bd8deadSopenharmony_ci    single unified program object, or the current program object may be
3695bd8deadSopenharmony_ci    set for each stage individually using a separable program object
3705bd8deadSopenharmony_ci    where different separable program objects may be current for other
3715bd8deadSopenharmony_ci    stages. The set of separable program objects current for all stages
3725bd8deadSopenharmony_ci    are collected in a program pipeline object that must be bound for
3735bd8deadSopenharmony_ci    use. When a linked program object is made active for the vertex
3745bd8deadSopenharmony_ci    stage, the executable code for the vertex shaders it contains is
3755bd8deadSopenharmony_ci    used to process vertices."
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ci    Modify the last sentence in the fourth paragraph:
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci    "... A single program object can contain all of vertex, tessellation
3805bd8deadSopenharmony_ci    control, tessellation evaluation, geometry, and fragment shaders, or
3815bd8deadSopenharmony_ci    any subset thereof."
3825bd8deadSopenharmony_ci
3835bd8deadSopenharmony_ci    Modify the fifth paragraph:
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    "When the program object currently in use for the vertex stage
3865bd8deadSopenharmony_ci    includes a vertex shader, its vertex shader is considered active and
3875bd8deadSopenharmony_ci    is used to process vertices. If the current vertex stage program
3885bd8deadSopenharmony_ci    object has no vertex shader or no program object is current for the
3895bd8deadSopenharmony_ci    vertex stage, ..."
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci -- Section 2.14.2 "Program Objects" (page 91) 
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    In the list of linking failures following the description of
3945bd8deadSopenharmony_ci    LinkProgram, modify the bullets reading "the program contains no objects
3955bd8deadSopenharmony_ci    to form a vertex shader" when using a tessellation control, tessellation
3965bd8deadSopenharmony_ci    evaluation, or geometry shader (pp. 92-93) to read:
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci      - the program is not separable and contains no objects to form a
3995bd8deadSopenharmony_ci        vertex shader;
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    Modify the eighth paragraph:
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    If a program has been successfully linked by LinkProgram, it can be made
4045bd8deadSopenharmony_ci    part of the current rendering state for all shader stages with the command
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci        void UseProgram(uint program);
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci    If <program> is non-zero, this command will make <program> the current
4095bd8deadSopenharmony_ci    program object.  This will install executable code as part of the current
4105bd8deadSopenharmony_ci    rendering state for each shader stage present when the program was last
4115bd8deadSopenharmony_ci    successfully linked.  If UseProgram is called with <program> set to zero,
4125bd8deadSopenharmony_ci    then there is no current program object.  If <program> has not been
4135bd8deadSopenharmony_ci    successfully linked, the error INVALID_OPERATION is generated and the
4145bd8deadSopenharmony_ci    current rendering state is not modified.
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci    Insert before the last paragraph, p. 93:
4175bd8deadSopenharmony_ci
4185bd8deadSopenharmony_ci    The executable code for an individual shader stage is taken from the
4195bd8deadSopenharmony_ci    current program for that stage.  If there is a current program object
4205bd8deadSopenharmony_ci    established by UseProgram, that program is considered current for all
4215bd8deadSopenharmony_ci    stages.  Otherwise, if there is a bound program pipeline object (section
4225bd8deadSopenharmony_ci    2.14.PPO), the program bound to the appropriate stage of the pipeline
4235bd8deadSopenharmony_ci    object is considered current.  If there is no current program object or
4245bd8deadSopenharmony_ci    bound program pipeline object, no program is current for any stage.  The
4255bd8deadSopenharmony_ci    current program for a stage is considered active if it contains executable
4265bd8deadSopenharmony_ci    code for that stage; otherwise, no program is considered active for that
4275bd8deadSopenharmony_ci    stage.  If there is no active program for the vertex or fragment shader
4285bd8deadSopenharmony_ci    stages,
4295bd8deadSopenharmony_ci      [[ Compatibility Profile ]] 
4305bd8deadSopenharmony_ci    fixed-function vertex and/or fragment processing will be used to process
4315bd8deadSopenharmony_ci    vertices and/or fragments.
4325bd8deadSopenharmony_ci      [[ Core Profile ]] 
4335bd8deadSopenharmony_ci    the results of vertex and/or fragment processing will be undefined. 
4345bd8deadSopenharmony_ci    However, this is not an error.
4355bd8deadSopenharmony_ci      [[ End Profile-Specific Language ]]
4365bd8deadSopenharmony_ci    If there is no active program for the tessellation control, tessellation
4375bd8deadSopenharmony_ci    evaluation, or geometry shader stages, those stages are ignored.
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci    Insert at the end of the section, p. 94 (note:  this will be inserted
4405bd8deadSopenharmony_ci    below several of the edits that follow).
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci    "The command
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci        uint CreateShaderProgramv(enum type, sizei count,
4455bd8deadSopenharmony_ci                                  const char **strings);
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    creates a stand-alone program from an array of null-terminated
4485bd8deadSopenharmony_ci    source code strings for a single shader type.  CreateShaderProgramv
4495bd8deadSopenharmony_ci    is equivalent to the following command sequence:
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci        const uint shader = CreateShader(type);
4525bd8deadSopenharmony_ci        if (shader) {
4535bd8deadSopenharmony_ci            ShaderSource(shader, count, strings, NULL);
4545bd8deadSopenharmony_ci            CompileShader(shader);
4555bd8deadSopenharmony_ci            const uint program = CreateProgram();
4565bd8deadSopenharmony_ci            if (program) {
4575bd8deadSopenharmony_ci                int compiled = FALSE;
4585bd8deadSopenharmony_ci                GetShaderiv(shader, COMPILE_STATUS, &compiled);
4595bd8deadSopenharmony_ci                ProgramParameteri(program, PROGRAM_SEPARABLE, TRUE);
4605bd8deadSopenharmony_ci                if (compiled) {
4615bd8deadSopenharmony_ci                    AttachShader(program, shader);
4625bd8deadSopenharmony_ci                    LinkProgram(program);
4635bd8deadSopenharmony_ci                    DetachShader(program, shader);
4645bd8deadSopenharmony_ci                }
4655bd8deadSopenharmony_ci                append-shader-info-log-to-program-info-log
4665bd8deadSopenharmony_ci            }
4675bd8deadSopenharmony_ci            DeleteShader(shader);
4685bd8deadSopenharmony_ci            return program;
4695bd8deadSopenharmony_ci        } else {
4705bd8deadSopenharmony_ci            return 0;
4715bd8deadSopenharmony_ci        }
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci    The program may not actually link if the output variables in the
4745bd8deadSopenharmony_ci    shader attached to the final stage of the linked program take up
4755bd8deadSopenharmony_ci    too many locations. If this situation arises, the info log may
4765bd8deadSopenharmony_ci    explain this.
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    Because no shader is returned by CreateShaderProgramv and the
4795bd8deadSopenharmony_ci    shader that is created is deleted in the course of the command
4805bd8deadSopenharmony_ci    sequence, the info log of the shader object is copied to the program
4815bd8deadSopenharmony_ci    so the shader's failed info log for the failed compilation is
4825bd8deadSopenharmony_ci    accessible to the application."
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci    Modify first and second paragraphs, p. 94:
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    If a program object that is active for any shader stage is re-linked
4875bd8deadSopenharmony_ci    successfully, the LinkProgram command will install the generated
4885bd8deadSopenharmony_ci    executable code as part of the current rendering state for all shader
4895bd8deadSopenharmony_ci    stages where the program is active.  Additionally, the newly generated
4905bd8deadSopenharmony_ci    executable code is made part of the state of any program pipeline for all
4915bd8deadSopenharmony_ci    stages where the program is attached.
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci    If a program object that is active for any shader stage is re-linked
4945bd8deadSopenharmony_ci    unsuccessfully, the link status will be set to FALSE, but existing
4955bd8deadSopenharmony_ci    executables and associated state will remain part of the current rendering
4965bd8deadSopenharmony_ci    state until a subsequent call to UseProgram, UseProgramStages, or
4975bd8deadSopenharmony_ci    BindProgramPipeline removes them from use.  If such a program is attached
4985bd8deadSopenharmony_ci    to any program pipeline object, the existing executables and associated
4995bd8deadSopenharmony_ci    state will remain part of the program pipeline object until a subsequent
5005bd8deadSopenharmony_ci    call to UseProgramStages removes them from use.  An unsuccessfully linked
5015bd8deadSopenharmony_ci    program may not be made part of the current rendering state by UseProgram
5025bd8deadSopenharmony_ci    or added to program pipeline objects by UseProgramStages until it is
5035bd8deadSopenharmony_ci    successfully re-linked.  If such a program was attached to a program
5045bd8deadSopenharmony_ci    pipeline at the time of a failed link, its existing executable may still
5055bd8deadSopenharmony_ci    be made part of the current rendering state indirectly by
5065bd8deadSopenharmony_ci    BindProgramPipeline.
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci    Modify the last paragraph of the section, p. 94:
5095bd8deadSopenharmony_ci
5105bd8deadSopenharmony_ci    "If <program> is not current for any GL context, is not the active
5115bd8deadSopenharmony_ci    program for any program pipeline object, and is not the current
5125bd8deadSopenharmony_ci    program for any stage of any program pipeline object, it is deleted
5135bd8deadSopenharmony_ci    immediately. Otherwise, program is flagged ..."
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci    Insert prior to the description of DeleteProgram, p. 94 (note:  this text
5165bd8deadSopenharmony_ci    is inserted above the previous edit):
5175bd8deadSopenharmony_ci
5185bd8deadSopenharmony_ci    "Program parameters control aspects of how the program is linked,
5195bd8deadSopenharmony_ci    executed, or stored. To set a program parameter, call
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci        void ProgramParameteri(uint program, enum pname, int value)
5225bd8deadSopenharmony_ci
5235bd8deadSopenharmony_ci    <pname> identifies which parameter to set for program object
5245bd8deadSopenharmony_ci    <program>. <value> holds the value being set.
5255bd8deadSopenharmony_ci        If <pname> is PROGRAM_SEPARABLE, <value> must be TRUE or FALSE
5265bd8deadSopenharmony_ci    and indicates whether the <program> can be bound for individual
5275bd8deadSopenharmony_ci    pipeline stages via UseProgramStages after it is next linked.
5285bd8deadSopenharmony_ci        If <pname> is any other value, the error INVALID_ENUM is
5295bd8deadSopenharmony_ci    generated.
5305bd8deadSopenharmony_ci
5315bd8deadSopenharmony_ci -- New section 2.14.PPO "Program Pipeline Objects" after 2.14.2
5325bd8deadSopenharmony_ci    "Program Objects"
5335bd8deadSopenharmony_ci
5345bd8deadSopenharmony_ci    Instead of packaging all shader stages into a single program object,
5355bd8deadSopenharmony_ci    shader types might be contained in multiple program objects each
5365bd8deadSopenharmony_ci    consisting of part of the complete pipeline. A program object may
5375bd8deadSopenharmony_ci    even contain only a single shader stage. This facilitates greater
5385bd8deadSopenharmony_ci    flexibility when combining different shaders in various ways without
5395bd8deadSopenharmony_ci    requiring a program object for each combination.
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    Program bindings associating program objects with shader types are
5425bd8deadSopenharmony_ci    collected to form a program pipeline object.
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci    The command
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ci        void GenProgramPipelines(sizei n, uint *pipelines);
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci    returns <n> previously unused program pipeline object names in
5495bd8deadSopenharmony_ci    <pipelines>. These names are marked as used, for the purposes of
5505bd8deadSopenharmony_ci    GenProgramPipelines only, but they acquire state only when they are
5515bd8deadSopenharmony_ci    first bound.
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci    Program pipeline objects are deleted by calling
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci        void DeleteProgramPipelines(sizei n, const uint *pipelines);
5565bd8deadSopenharmony_ci    
5575bd8deadSopenharmony_ci    <pipelines> contains <n> names of program pipeline objects to be
5585bd8deadSopenharmony_ci    deleted. Once a program pipeline object is deleted, it has no
5595bd8deadSopenharmony_ci    contents and its name becomes unused. If an object that is currently
5605bd8deadSopenharmony_ci    bound is deleted, the binding for that object reverts to zero and no
5615bd8deadSopenharmony_ci    program pipeline object becomes current. Unused names in <pipelines>
5625bd8deadSopenharmony_ci    are silently ignored, as is the value zero.
5635bd8deadSopenharmony_ci
5645bd8deadSopenharmony_ci    A program pipeline object is created by binding a name returned by
5655bd8deadSopenharmony_ci    GenProgramPipelines with the command
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci        void BindProgramPipeline(uint pipeline);
5685bd8deadSopenharmony_ci
5695bd8deadSopenharmony_ci    <pipeline> is the program pipeline object name. The resulting program
5705bd8deadSopenharmony_ci    pipeline object is a new state vector, comprising ACTIVE_PROGRAM,
5715bd8deadSopenharmony_ci    VERTEX_SHADER, GEOMETRY_SHADER, FRAGMENT_SHADER, TESS_CONTROL_SHADER,
5725bd8deadSopenharmony_ci    and TESS_EVALUATION_SHADER.
5735bd8deadSopenharmony_ci
5745bd8deadSopenharmony_ci    BindProgramPipeline may also be used to bind an existing program
5755bd8deadSopenharmony_ci    pipeline object. If the bind is successful, no change is  made to
5765bd8deadSopenharmony_ci    the state of the bound program pipeline object, and any previous
5775bd8deadSopenharmony_ci    binding is broken. If BindProgramPipeline is called with <pipeline>
5785bd8deadSopenharmony_ci    set to zero, then there is no current program pipeline object.
5795bd8deadSopenharmony_ci
5805bd8deadSopenharmony_ci    If no current program object has been established by UseProgram, the
5815bd8deadSopenharmony_ci    program objects used for each shader stage and for uniform updates are
5825bd8deadSopenharmony_ci    taken from the bound program pipeline object, if any.  If there is a
5835bd8deadSopenharmony_ci    current program object established by UseProgram, the bound program
5845bd8deadSopenharmony_ci    pipeline object has no effect on rendering or uniform updates.  When a
5855bd8deadSopenharmony_ci    bound program pipeline object is used for rendering, individual shader
5865bd8deadSopenharmony_ci    executables are taken from its program objects as described in the
5875bd8deadSopenharmony_ci    discussion of UseProgram in section 2.14.2.
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci    BindProgramPipeline fails and an INVALID_OPERATION error is
5905bd8deadSopenharmony_ci    generated if <pipeline> is not zero or a name returned from a
5915bd8deadSopenharmony_ci    previous call to GenProgramPipelines, or if such a name has since
5925bd8deadSopenharmony_ci    been deleted with DeleteProgramPipelines.
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci    The executables in a program object associated with one or more
5955bd8deadSopenharmony_ci    shader stages can be made part of the program pipeline state for
5965bd8deadSopenharmony_ci    those shader stages with the command:
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci       void UseProgramStages(uint pipeline, bitfield stages,
5995bd8deadSopenharmony_ci                             uint program);
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    where <pipeline> is the program pipeline object to be updated,
6025bd8deadSopenharmony_ci    <stages> is the bitwise OR of accepted constants representing
6035bd8deadSopenharmony_ci    shader stages, and <program> is the program object from which the
6045bd8deadSopenharmony_ci    executables are taken. The bits set in <stages> indicate the program
6055bd8deadSopenharmony_ci    stages for which the program object named by <program> becomes
6065bd8deadSopenharmony_ci    current. These stages may include tessellation control, tessellation
6075bd8deadSopenharmony_ci    evaluation, vertex, geometry, or fragment indicated by TESS_CONTROL_-
6085bd8deadSopenharmony_ci    SHADER_BIT, TESS_EVALUATION_SHADER_BIT, VERTEX_SHADER_BIT, GEOMETRY_-
6095bd8deadSopenharmony_ci    SHADER_BIT, or FRAGMENT_SHADER_BIT respectively. The constant ALL_-
6105bd8deadSopenharmony_ci    SHADER_BITS indicates <program> is to be made current for all
6115bd8deadSopenharmony_ci    shader stages. If <program> refers to a program object with a valid
6125bd8deadSopenharmony_ci    shader attached for an indicated shader stage, this call installs
6135bd8deadSopenharmony_ci    the executable code for that stage in the indicated program pipeline
6145bd8deadSopenharmony_ci    object state.  If UseProgramStages is called with <program> set to
6155bd8deadSopenharmony_ci    zero or with a program object that contains no executable code for a
6165bd8deadSopenharmony_ci    given stages, it is as if the pipeline object has no programmable stage
6175bd8deadSopenharmony_ci    configured for the indicated shader stages.  If <stages> is not the
6185bd8deadSopenharmony_ci    special value ALL_SHADER_BITS and has a bit set that is not recognized,
6195bd8deadSopenharmony_ci    the error INVALID_VALUE is generated.  If the program object named
6205bd8deadSopenharmony_ci    by <program> was linked without the PROGRAM_SEPARABLE parameter set
6215bd8deadSopenharmony_ci    or was not linked successfully, the error INVALID_OPERATION is 
6225bd8deadSopenharmony_ci    generated and the corresponding shader stages in the <pipeline> 
6235bd8deadSopenharmony_ci    program pipeline object are not modified.
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci    If <pipeline> is a name that has been generated (without subsequent
6265bd8deadSopenharmony_ci    deletion) by GenProgramPipelines, but refers to a program pipeline
6275bd8deadSopenharmony_ci    object that has not been previously bound, the GL first creates a
6285bd8deadSopenharmony_ci    new state vector in the same manner as when BindProgramPipeline
6295bd8deadSopenharmony_ci    creates a new program pipeline object. If <pipeline> is not a name
6305bd8deadSopenharmony_ci    returned from a previous call to GenProgramPipelines or if such a
6315bd8deadSopenharmony_ci    name has since been deleted by DeleteProgramPipelines, an INVALID_-
6325bd8deadSopenharmony_ci    OPERATION error is generated.
6335bd8deadSopenharmony_ci
6345bd8deadSopenharmony_ci    The command
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci        void ActiveShaderProgram(uint pipeline, uint program);
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ci    sets the linked program named by <program> to be the active program
6395bd8deadSopenharmony_ci    (discussed later in the secion 2.14.4) for the program pipeline
6405bd8deadSopenharmony_ci    object <pipeline> .  If <program> has not been successfully linked,
6415bd8deadSopenharmony_ci    the error INVALID_OPERATION is generated and active program is not
6425bd8deadSopenharmony_ci    modified.
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    If <pipeline> is a name that has been generated (without subsequent
6455bd8deadSopenharmony_ci    deletion) by GenProgramPipelines, but refers to a program pipeline
6465bd8deadSopenharmony_ci    object that has not been previously bound, the GL first creates a
6475bd8deadSopenharmony_ci    new state vector in the same manner as when BindProgramPipeline
6485bd8deadSopenharmony_ci    creates a new program pipeline object. If <pipeline> is not a name
6495bd8deadSopenharmony_ci    returned from a previous call to GenProgramPipelines or if such a
6505bd8deadSopenharmony_ci    name has since been deleted by DeleteProgramPipelines, an INVALID_-
6515bd8deadSopenharmony_ci    OPERATION error is generated.
6525bd8deadSopenharmony_ci
6535bd8deadSopenharmony_ci
6545bd8deadSopenharmony_ci    Shader Interface Matching
6555bd8deadSopenharmony_ci
6565bd8deadSopenharmony_ci    When multiple shader stages are active, the outputs of one stage form an
6575bd8deadSopenharmony_ci    interface with the inputs of the next stage.  At each such interface,
6585bd8deadSopenharmony_ci    shader inputs are matched up against outputs from the previous stage:
6595bd8deadSopenharmony_ci
6605bd8deadSopenharmony_ci      * An output block is considered to match an input block in the
6615bd8deadSopenharmony_ci        subsequent shader if the two blocks have the same block name, and the
6625bd8deadSopenharmony_ci        members of the block match exactly in name, type, qualification, and
6635bd8deadSopenharmony_ci        declaration order.
6645bd8deadSopenharmony_ci
6655bd8deadSopenharmony_ci      * An output variable is considered to match an input variable in the
6665bd8deadSopenharmony_ci        subequent shader if:
6675bd8deadSopenharmony_ci
6685bd8deadSopenharmony_ci        * the two variables match in name, type, and qualification; or
6695bd8deadSopenharmony_ci
6705bd8deadSopenharmony_ci        * the two variables are declared with the same location layout
6715bd8deadSopenharmony_ci          qualifier and match in type and qualification.
6725bd8deadSopenharmony_ci
6735bd8deadSopenharmony_ci    Variables or block members declared as structures are considered to match
6745bd8deadSopenharmony_ci    in type if and only if structure members match in name, type,
6755bd8deadSopenharmony_ci    qualification, and declaration order.  Variables or block members declared
6765bd8deadSopenharmony_ci    as arrays are considered to match in type only if both declarations
6775bd8deadSopenharmony_ci    specify the same element type and array size.  The rules for determining
6785bd8deadSopenharmony_ci    if variables or block members match in qualification are found in the
6795bd8deadSopenharmony_ci    OpenGL Shading Language Specification.
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    Tessellation control shader per-vertex output variables and blocks and
6825bd8deadSopenharmony_ci    tessellation control, tessellation evaluation, and geometry shader
6835bd8deadSopenharmony_ci    per-vertex input variables and blocks are required to be declared as
6845bd8deadSopenharmony_ci    arrays, with each element representing input or output values for a single
6855bd8deadSopenharmony_ci    vertex of a multi-vertex primitive.  For the purposes of interface
6865bd8deadSopenharmony_ci    matching, such variables and blocks are treated as though they were not
6875bd8deadSopenharmony_ci    declared as arrays.
6885bd8deadSopenharmony_ci
6895bd8deadSopenharmony_ci    For program objects containing multiple shaders, LinkProgram will check
6905bd8deadSopenharmony_ci    for mismatches on interfaces between shader stages in the program being
6915bd8deadSopenharmony_ci    linked and generate a link error if a mismatch is detected.  A link error
6925bd8deadSopenharmony_ci    will be generated if any statically referenced input variable or block
6935bd8deadSopenharmony_ci    does not have a matching output.  If either shader redeclares the built-in
6945bd8deadSopenharmony_ci    array gl_ClipDistance[] ((compatibility profile only: or gl_TexCoord[])),
6955bd8deadSopenharmony_ci    the array must have the same size in both shaders.  ((compatibility
6965bd8deadSopenharmony_ci    profile only: If either shader redeclares built-in input or output color
6975bd8deadSopenharmony_ci    variables, they must have matching interpolation qualifiers, as described
6985bd8deadSopenharmony_ci    in the OpenGL Shading Language Specification.))
6995bd8deadSopenharmony_ci
7005bd8deadSopenharmony_ci    With separable program objects, interfaces between shader stages may
7015bd8deadSopenharmony_ci    involve the outputs from one program object and the inputs from a
7025bd8deadSopenharmony_ci    second program object.  For such interfaces, it is not possible to
7035bd8deadSopenharmony_ci    detect mismatches at link time, because the programs are linked
7045bd8deadSopenharmony_ci    separately.  When each such program is linked, all inputs or outputs
7055bd8deadSopenharmony_ci    interfacing with another program stage are treated as active.  The
7065bd8deadSopenharmony_ci    linker will generate an executable that assumes the presence of a
7075bd8deadSopenharmony_ci    compatible program on the other side of the interface.  If a mismatch
7085bd8deadSopenharmony_ci    between programs occurs, no GL error will be generated, but some or all
7095bd8deadSopenharmony_ci    of the inputs on the interface will be undefined.
7105bd8deadSopenharmony_ci
7115bd8deadSopenharmony_ci    At an interface between program objects, the set of inputs and outputs are
7125bd8deadSopenharmony_ci    considered to match exactly if and only if:
7135bd8deadSopenharmony_ci
7145bd8deadSopenharmony_ci      * The built-in input and output blocks used on the interface
7155bd8deadSopenharmony_ci        ("gl_PerVertex" or "gl_PerFragment") match, as described below.
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ci      * Every declared input block or variable must have a matching output, as
7185bd8deadSopenharmony_ci        described above.
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci      * There are no output blocks or user-defined output variables
7215bd8deadSopenharmony_ci        declared without a matching input block or variable declaration.
7225bd8deadSopenharmony_ci
7235bd8deadSopenharmony_ci    When the set of inputs and outputs on an interface between programs
7245bd8deadSopenharmony_ci    matches exactly, all inputs are well-defined unless the corresponding
7255bd8deadSopenharmony_ci    outputs were not written in the previous shader.  However, any mismatch
7265bd8deadSopenharmony_ci    between inputs and outputs results in all inputs being undefined except
7275bd8deadSopenharmony_ci    for cases noted below.  Even if an input has a corresponding output
7285bd8deadSopenharmony_ci    that matches exactly, mismatches on other inputs or outputs may
7295bd8deadSopenharmony_ci    adversely affect the executable code generated to read or write the
7305bd8deadSopenharmony_ci    matching variable.
7315bd8deadSopenharmony_ci
7325bd8deadSopenharmony_ci    The inputs and outputs on an interface between programs need not match
7335bd8deadSopenharmony_ci    exactly when input and output location qualifiers (sections 4.3.8.1 and
7345bd8deadSopenharmony_ci    4.3.8.2 of the GLSL Specification) are used.  When using location
7355bd8deadSopenharmony_ci    qualifiers, any input with an input location qualifier will be
7365bd8deadSopenharmony_ci    well-defined as long as the other program writes to a matching output, as
7375bd8deadSopenharmony_ci    described above.  The names of variables need not match when matching by
7385bd8deadSopenharmony_ci    location.
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci    Additionally, scalar and vector inputs with location layout qualifiers
7415bd8deadSopenharmony_ci    will be well-defined if there is a corresponding output satisfying all of
7425bd8deadSopenharmony_ci    the following conditions:
7435bd8deadSopenharmony_ci
7445bd8deadSopenharmony_ci      * the input and output match exactly in qualification, including in the
7455bd8deadSopenharmony_ci        location layout qualifier;
7465bd8deadSopenharmony_ci
7475bd8deadSopenharmony_ci      * the output is a vector with the same basic component type and has more
7485bd8deadSopenharmony_ci        components than the input; and
7495bd8deadSopenharmony_ci
7505bd8deadSopenharmony_ci      * the common component type of the input and output is "int", "uint", or
7515bd8deadSopenharmony_ci        "float" (scalars and vectors with "double" component type are
7525bd8deadSopenharmony_ci        excluded).
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    In this case, the components of the input will be taken from the first
7555bd8deadSopenharmony_ci    components of the matching output, and the extra components of the output
7565bd8deadSopenharmony_ci    will be ignored.
7575bd8deadSopenharmony_ci
7585bd8deadSopenharmony_ci    To use any built-in input or output in the gl_PerVertex and
7595bd8deadSopenharmony_ci    gl_PerFragment blocks in separable program objects, shader code must
7605bd8deadSopenharmony_ci    redeclare those blocks prior to use.  A separable program will
7615bd8deadSopenharmony_ci    fail to link if:
7625bd8deadSopenharmony_ci
7635bd8deadSopenharmony_ci      * it contains multiple shaders of a single type with different
7645bd8deadSopenharmony_ci        redeclarations of these built-in input and output blocks; or
7655bd8deadSopenharmony_ci
7665bd8deadSopenharmony_ci      * any shader uses a built-in block member not found in the
7675bd8deadSopenharmony_ci        redeclaration of that block.
7685bd8deadSopenharmony_ci
7695bd8deadSopenharmony_ci    [[ There are two somewhat different versions of the following language --
7705bd8deadSopenharmony_ci       one for the compatibility profile and the other for the core
7715bd8deadSopenharmony_ci       profile. ]]
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci    [[ Compatibility Profile ]] 
7745bd8deadSopenharmony_ci
7755bd8deadSopenharmony_ci    As described above, an exact interface match requires matching built-in
7765bd8deadSopenharmony_ci    input and output blocks.  At an interface between two non-fragment 
7775bd8deadSopenharmony_ci    shader stages, the gl_PerVertex input and output blocks are considered 
7785bd8deadSopenharmony_ci    to match if and only if the block members members match exactly in 
7795bd8deadSopenharmony_ci    name, type, qualification, and declaration order.  At an interface 
7805bd8deadSopenharmony_ci    involving the fragment shader stage, a gl_PerVertex output block is
7815bd8deadSopenharmony_ci    considered to match a gl_PerFragment input block if all of the
7825bd8deadSopenharmony_ci    following conditions apply:
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ci      * the gl_PerVertex block includes either gl_FrontColor or
7855bd8deadSopenharmony_ci        gl_BackColor if and only if the gl_PerFragment block includes
7865bd8deadSopenharmony_ci        gl_Color;
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci      * the gl_PerVertex block includes either gl_FrontSecondaryColor or
7895bd8deadSopenharmony_ci        gl_BackSecondaryColor if and only if the gl_PerFragment block
7905bd8deadSopenharmony_ci        includes gl_SecondaryColor; 
7915bd8deadSopenharmony_ci
7925bd8deadSopenharmony_ci      * the gl_PerVertex block includes gl_FogFragCoord if and only if the
7935bd8deadSopenharmony_ci        gl_PerFragment block also includes gl_FogFragCoord; and
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci      * the size of gl_TexCoord[] in gl_PerVertex and gl_PerFragment is
7965bd8deadSopenharmony_ci        identical.
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci    At an interface between gl_PerVertex outputs and gl_PerFragment inputs,
7995bd8deadSopenharmony_ci    the presence or absence of any block members other than those listed
8005bd8deadSopenharmony_ci    immediately above does not affect interface matching.
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci    [[ Core Profile ]] 
8035bd8deadSopenharmony_ci
8045bd8deadSopenharmony_ci    As described above, an exact interface match requires matching built-in
8055bd8deadSopenharmony_ci    input and output blocks.  At an interface between two non-fragment 
8065bd8deadSopenharmony_ci    shader stages, the gl_PerVertex input and output blocks are considered 
8075bd8deadSopenharmony_ci    to match if and only if the block members members match exactly in 
8085bd8deadSopenharmony_ci    name, type, qualification, and declaration order.  At an interface
8095bd8deadSopenharmony_ci    involving the fragment shader stage, the presence or absence of any
8105bd8deadSopenharmony_ci    built-in output does not affect interface matching.
8115bd8deadSopenharmony_ci
8125bd8deadSopenharmony_ci    [[ End Profile-Specific Language ]]
8135bd8deadSopenharmony_ci
8145bd8deadSopenharmony_ci    Built-in inputs or outputs not found in blocks do not affect interface
8155bd8deadSopenharmony_ci    matching.  Any such built-in inputs are well-defined unless they are
8165bd8deadSopenharmony_ci    derived from built-in outputs not written by the previous shader stage.
8175bd8deadSopenharmony_ci
8185bd8deadSopenharmony_ci
8195bd8deadSopenharmony_ci    Program Pipeline Object State
8205bd8deadSopenharmony_ci
8215bd8deadSopenharmony_ci    "The state required to support program pipeline objects consists of
8225bd8deadSopenharmony_ci    a single binding name of the current program pipeline object. This
8235bd8deadSopenharmony_ci    binding is initially zero indicating no program pipeline object is
8245bd8deadSopenharmony_ci    bound.
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ci    The state of each program pipeline object consists of:
8275bd8deadSopenharmony_ci
8285bd8deadSopenharmony_ci    * Six unsigned integers (initially all zero) are  required to hold
8295bd8deadSopenharmony_ci      each respective name of the current vertex stage program, current
8305bd8deadSopenharmony_ci      geometry stage program, current fragment stage program, current
8315bd8deadSopenharmony_ci      tessellation control stage program, current tessellation evaluation
8325bd8deadSopenharmony_ci      stage program, and active program respectively.
8335bd8deadSopenharmony_ci    * A Boolean holding the status of the last validation attempt,
8345bd8deadSopenharmony_ci      initially false
8355bd8deadSopenharmony_ci    * An array of type char containing the information log, initially
8365bd8deadSopenharmony_ci      empty.
8375bd8deadSopenharmony_ci    * An integer holding the length of the information log"
8385bd8deadSopenharmony_ci
8395bd8deadSopenharmony_ci -- Section 2.14.4 "Uniform Variables" (page 97) 
8405bd8deadSopenharmony_ci
8415bd8deadSopenharmony_ci    Replace the 1st paragraph of the "Loading Uniform Variables In The
8425bd8deadSopenharmony_ci    Default Uniform Block" section (page 108):
8435bd8deadSopenharmony_ci
8445bd8deadSopenharmony_ci        "To load values into the uniform variables of the active program
8455bd8deadSopenharmony_ci    object, use the commands ...
8465bd8deadSopenharmony_ci
8475bd8deadSopenharmony_ci    ... If a non-zero program object is bound by UseProgram, it is the
8485bd8deadSopenharmony_ci    active program object whose uniforms are updated by these commands.
8495bd8deadSopenharmony_ci    If no program object is bound using UseProgram, the active program
8505bd8deadSopenharmony_ci    object of the current program pipeline object set by ActiveShader-
8515bd8deadSopenharmony_ci    Program is the active program object. If the current program pipeline
8525bd8deadSopenharmony_ci    object has no active program or there is not current program pipeline
8535bd8deadSopenharmony_ci    object, then there is no active program.
8545bd8deadSopenharmony_ci        The given values are loaded into the default ... "
8555bd8deadSopenharmony_ci
8565bd8deadSopenharmony_ci    Change the last bullet in the "Loading Uniform Variables In The
8575bd8deadSopenharmony_ci    Default Uniform Block" section (page 110) to:
8585bd8deadSopenharmony_ci
8595bd8deadSopenharmony_ci    "* if there is no active program in use."
8605bd8deadSopenharmony_ci
8615bd8deadSopenharmony_ci    Add to the end of the subsection "Loading Uniform Variables In The
8625bd8deadSopenharmony_ci    Default Uniform Block" section (page 110): 
8635bd8deadSopenharmony_ci
8645bd8deadSopenharmony_ci    To load values into the uniform variables of the default uniform
8655bd8deadSopenharmony_ci    block of a program which may not necessarily be bound, use the
8665bd8deadSopenharmony_ci    commands
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci        void ProgramUniform{1234}{ifd}(uint program, int location,
8695bd8deadSopenharmony_ci                                       T value);
8705bd8deadSopenharmony_ci        void ProgramUniform{1234}{ifd}v(uint program, int location,
8715bd8deadSopenharmony_ci                                        sizei count, const T value);
8725bd8deadSopenharmony_ci        void ProgramUniform{1234}ui(uint program, int location,
8735bd8deadSopenharmony_ci                                    T value);
8745bd8deadSopenharmony_ci        void ProgramUniform{1234}uiv(uint program, int location,
8755bd8deadSopenharmony_ci                                     sizei count, T value);
8765bd8deadSopenharmony_ci        void ProgramUniformMatrix{234}{fd}v
8775bd8deadSopenharmony_ci                                      (uint program, int location,
8785bd8deadSopenharmony_ci                                       sizei count, boolean transpose,
8795bd8deadSopenharmony_ci                                       const float *value);
8805bd8deadSopenharmony_ci        void ProgramUniformMatrix{2x3 3x2 2x4 4x2 3x4 4x3}{fd}v
8815bd8deadSopenharmony_ci                                      (uint program, int location,
8825bd8deadSopenharmony_ci                                       sizei count, boolean transpose,
8835bd8deadSopenharmony_ci                                       const float *value);
8845bd8deadSopenharmony_ci
8855bd8deadSopenharmony_ci    These commands operate identically to the corresponding commands
8865bd8deadSopenharmony_ci    above without "Program" in the command name except, rather than
8875bd8deadSopenharmony_ci    updating the currently active program object, these "Program"
8885bd8deadSopenharmony_ci    commands update the program object named by the initial <program>
8895bd8deadSopenharmony_ci    parameter.The remaining parameters following the initial <program>
8905bd8deadSopenharmony_ci    parameter match the parameters for the corresponding non-"Program"
8915bd8deadSopenharmony_ci    uniform command. If <program> is not the name of a created program
8925bd8deadSopenharmony_ci    or shader object, the error INVALID_VALUE is generated. If <program>
8935bd8deadSopenharmony_ci    identifies a shader object or a program object that has not been
8945bd8deadSopenharmony_ci    linked successfully, the error INVALID_OPERATION is generated.
8955bd8deadSopenharmony_ci
8965bd8deadSopenharmony_ci -- Section 2.14.4 "Subroutine Uniform Variables" (page 114) 
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ci    Modify the last paragraph of the section, p. 117
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    When the active program for a shader stage is re-linked or changed by a
9015bd8deadSopenharmony_ci    call to UseProgram, BindProgramPipeline, or UseProgramStages, subroutine
9025bd8deadSopenharmony_ci    uniforms for that stage are reset to arbitrarily chosen default functions
9035bd8deadSopenharmony_ci    with compatible subroutine types.
9045bd8deadSopenharmony_ci
9055bd8deadSopenharmony_ci
9065bd8deadSopenharmony_ci -- Section 2.14.8 "Shader Execution" (page 122) 
9075bd8deadSopenharmony_ci
9085bd8deadSopenharmony_ci    Change the first paragraph:
9095bd8deadSopenharmony_ci
9105bd8deadSopenharmony_ci    "If there is an active program object present for the vertex,
9115bd8deadSopenharmony_ci    tessellation control, tessellation evaluation, or geometry shader
9125bd8deadSopenharmony_ci    stages, the executable code for these active programs is used
9135bd8deadSopenharmony_ci    to process incoming vertex values rather than the fixed-function
9145bd8deadSopenharmony_ci    vertex processing described in sections 2.12 through 2.13.  In
9155bd8deadSopenharmony_ci    particular, ..."
9165bd8deadSopenharmony_ci
9175bd8deadSopenharmony_ci    Modify first paragraph of "Validation", p. 129
9185bd8deadSopenharmony_ci
9195bd8deadSopenharmony_ci    (replace first paragraph) It is not always possible to determine at link
9205bd8deadSopenharmony_ci    time if a program object can execute successfully, given that LinkProgram
9215bd8deadSopenharmony_ci    can not know the state of the remainder of the pipeline.  Therefore
9225bd8deadSopenharmony_ci    validation is done when the first rendering command is issued, to
9235bd8deadSopenharmony_ci    determine if the set of active program objects can be executed.  If the
9245bd8deadSopenharmony_ci    current set of active program objects cannot be executed, no primitives
9255bd8deadSopenharmony_ci    are processed and the error INVALID_OPERATION will be generated.
9265bd8deadSopenharmony_ci
9275bd8deadSopenharmony_ci    Add to the list in the second paragraph of subsection "Validation"
9285bd8deadSopenharmony_ci    (Page 129):
9295bd8deadSopenharmony_ci
9305bd8deadSopenharmony_ci    "* A program object is active for at least one, but not all of the
9315bd8deadSopenharmony_ci      shader stages that were present when the program was linked.
9325bd8deadSopenharmony_ci
9335bd8deadSopenharmony_ci    * One program object is active for at least two shader stages and
9345bd8deadSopenharmony_ci      a second program is active for a shader stage between two stages
9355bd8deadSopenharmony_ci      for which the first program was active.
9365bd8deadSopenharmony_ci
9375bd8deadSopenharmony_ci    * There is an active program for tessellation control, tessellation
9385bd8deadSopenharmony_ci      evaluation, or geometry stages with corresponding executable
9395bd8deadSopenharmony_ci      shader, but there is no active program with executable vertex
9405bd8deadSopenharmony_ci      shader.
9415bd8deadSopenharmony_ci
9425bd8deadSopenharmony_ci    * There is not current unified program object and the current program
9435bd8deadSopenharmony_ci      pipeline object includes a program object that was relinked since
9445bd8deadSopenharmony_ci      being applied to the pipeline object via UseProgramStages with the
9455bd8deadSopenharmony_ci      PROGRAM_SEPARABLE parameter set to FALSE."
9465bd8deadSopenharmony_ci
9475bd8deadSopenharmony_ci    Add after the description of ValidateProgram in subsection
9485bd8deadSopenharmony_ci    "Validation":
9495bd8deadSopenharmony_ci
9505bd8deadSopenharmony_ci    "Separable program objects may have validation failures that cannot
9515bd8deadSopenharmony_ci    be detected without the complete program pipeline. Mismatched
9525bd8deadSopenharmony_ci    interfaces, improper usage of program objects together, and the same
9535bd8deadSopenharmony_ci    state-dependent failures can result in validation errors for such
9545bd8deadSopenharmony_ci    program objects. As a development aid, use the command
9555bd8deadSopenharmony_ci
9565bd8deadSopenharmony_ci        void ValidateProgramPipeline(uint pipeline );
9575bd8deadSopenharmony_ci    
9585bd8deadSopenharmony_ci    to validate the program pipeline object <pipeline> against the
9595bd8deadSopenharmony_ci    current GL state. Each program pipeline object has a boolean status,
9605bd8deadSopenharmony_ci    VALIDATE_STATUS, that is modified as a result of validation. This
9615bd8deadSopenharmony_ci    status can be queried with GetProgramPipelineiv (See section 6.1.18).
9625bd8deadSopenharmony_ci    If validation succeeded, the program pipeline object is guaranteed
9635bd8deadSopenharmony_ci    to execute given the current GL state. 
9645bd8deadSopenharmony_ci
9655bd8deadSopenharmony_ci    If <pipeline> is a name that has been generated (without subsequent
9665bd8deadSopenharmony_ci    deletion) by GenProgramPipelines, but refers to a program pipeline
9675bd8deadSopenharmony_ci    object that has not been previously bound, the GL first creates a
9685bd8deadSopenharmony_ci    new state vector in the same manner as when BindProgramPipeline
9695bd8deadSopenharmony_ci    creates a new program pipeline object. If <pipeline> is not a name
9705bd8deadSopenharmony_ci    returned from a previous call to GenProgramPipelines or if such a
9715bd8deadSopenharmony_ci    name has since been deleted by DeleteProgramPipelines, an INVALID_-
9725bd8deadSopenharmony_ci    OPERATION error is generated.
9735bd8deadSopenharmony_ci
9745bd8deadSopenharmony_ci -- Section 2.15 "Tessellation" (page 131)
9755bd8deadSopenharmony_ci
9765bd8deadSopenharmony_ci    (modify second paragraph, p. 132) ... Tessellation is considered active if
9775bd8deadSopenharmony_ci    and only if there is an active tessellation control or tessellation
9785bd8deadSopenharmony_ci    evaluation program object.
9795bd8deadSopenharmony_ci
9805bd8deadSopenharmony_ci    (modify next-to-last paragraph, p. 132) Patch primitives are not supported
9815bd8deadSopenharmony_ci    by pipeline stages below the tessellation evaluation shader.  If there is
9825bd8deadSopenharmony_ci    no active tessellation evaluation program, the error INVALID_OPERATION is
9835bd8deadSopenharmony_ci    generated by Begin, and any command that performs an implicit Begin, if
9845bd8deadSopenharmony_ci    the primitive mode is PATCHES.
9855bd8deadSopenharmony_ci
9865bd8deadSopenharmony_ci    Modify last paragraph, p. 132:
9875bd8deadSopenharmony_ci
9885bd8deadSopenharmony_ci    "A program object or program pipeline object that includes a
9895bd8deadSopenharmony_ci    tessellation shader of any kind must also include a vertex shader.
9905bd8deadSopenharmony_ci    If the current program state has a tessellation shader but no
9915bd8deadSopenharmony_ci    vertex shader at Begin or any command that implicitly calls Begin, an
9925bd8deadSopenharmony_ci    INVALID_OPERATION error will be generated."
9935bd8deadSopenharmony_ci
9945bd8deadSopenharmony_ci -- Section 2.15.1 "Tessellation Control Shaders" (page 133)
9955bd8deadSopenharmony_ci
9965bd8deadSopenharmony_ci    Change the first paragraph of "Tessellation Control Shader Execution
9975bd8deadSopenharmony_ci    Environment" (p. 134)
9985bd8deadSopenharmony_ci
9995bd8deadSopenharmony_ci    "If there is an active program for the tessellation control stage, the
10005bd8deadSopenharmony_ci     executable version of the program's tessellation control shader is used
10015bd8deadSopenharmony_ci     ..."
10025bd8deadSopenharmony_ci
10035bd8deadSopenharmony_ci -- Section 2.15.3 "Tessellation Evaluation Shaders" (page 147)
10045bd8deadSopenharmony_ci
10055bd8deadSopenharmony_ci    Change the first paragraph of "Tessellation Evaluation Shader
10065bd8deadSopenharmony_ci    Execution Environment" (p. 149)
10075bd8deadSopenharmony_ci
10085bd8deadSopenharmony_ci    "If there is an active program for the tessellation evaluation stage, the
10095bd8deadSopenharmony_ci     executable version of the program's tessellation evaluation shader is
10105bd8deadSopenharmony_ci     used ..."
10115bd8deadSopenharmony_ci
10125bd8deadSopenharmony_ci -- Section 2.16, "Geometry Shaders" (page 153)
10135bd8deadSopenharmony_ci
10145bd8deadSopenharmony_ci    Change the 4th paragraph:
10155bd8deadSopenharmony_ci
10165bd8deadSopenharmony_ci    "A program object or program pipeline object that includes a
10175bd8deadSopenharmony_ci    geometry shader must also include a vertex shader. If the current
10185bd8deadSopenharmony_ci    program state has a geometry shader but no vertex shader at Begin or
10195bd8deadSopenharmony_ci    any command that implicitly calls Begin, an INVALID_OPERATION error
10205bd8deadSopenharmony_ci    will be generated."
10215bd8deadSopenharmony_ci
10225bd8deadSopenharmony_ci -- Section 2.16.1, Geometry Shader Input Primitives, p. 153
10235bd8deadSopenharmony_ci
10245bd8deadSopenharmony_ci    (modify first paragraph of the section)  ... will generate an
10255bd8deadSopenharmony_ci    INVALID_OPERATION error if the primitive <mode> parameter is incompatible
10265bd8deadSopenharmony_ci    with the input primitive type of the geometry shader of the active
10275bd8deadSopenharmony_ci    geometry program object, as discussed below.
10285bd8deadSopenharmony_ci
10295bd8deadSopenharmony_ci -- Section 2.16.4, Geometry Shader Execution Environment
10305bd8deadSopenharmony_ci
10315bd8deadSopenharmony_ci    Change the first paragraph:
10325bd8deadSopenharmony_ci
10335bd8deadSopenharmony_ci    "If there is an active program for the geometry stage, the executable
10345bd8deadSopenharmony_ci     version of the program's geometry shader is used ..."
10355bd8deadSopenharmony_ci
10365bd8deadSopenharmony_ci -- Section 2.20 "Transform Feedback" (page 167)
10375bd8deadSopenharmony_ci
10385bd8deadSopenharmony_ci    Modify first paragraph and add the subsequent paragraphs:
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    "In transform feedback mode, attributes of the vertices of
10415bd8deadSopenharmony_ci    primitives passed to the transform feedback stage are written out to
10425bd8deadSopenharmony_ci    one or more buffer objects.  The vertices are fed back after vertex
10435bd8deadSopenharmony_ci    color clamping, but before flatshading and clipping. The transformed
10445bd8deadSopenharmony_ci    vertices may be optionally discarded after being stored into one or
10455bd8deadSopenharmony_ci    more buffer objects, or they can be passed on down to the clipping
10465bd8deadSopenharmony_ci    stage for further processing. The set of attributes captured is
10475bd8deadSopenharmony_ci    determined when a program is linked.
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    The data captured in transform feedback mode depends on the active
10505bd8deadSopenharmony_ci    programs on each of the shader stages.  If a program is active for
10515bd8deadSopenharmony_ci    the geometry shader stage, transform feedback captures the vertices
10525bd8deadSopenharmony_ci    of each primitive emitted by the geometry shader.  Otherwise, if a
10535bd8deadSopenharmony_ci    program is active for the tessellation evaluation shader stage,
10545bd8deadSopenharmony_ci    transform feedback captures each primitive produced by the
10555bd8deadSopenharmony_ci    tessellation primitive generator, whose vertices are processed by the
10565bd8deadSopenharmony_ci    tessellation evaluation shader. Otherwise, transform feedback
10575bd8deadSopenharmony_ci    captures each primitive processed by the vertex shader.
10585bd8deadSopenharmony_ci
10595bd8deadSopenharmony_ci    If separable program objects are in use, the set of attributes
10605bd8deadSopenharmony_ci    captured is taken from the program object active on the last shader
10615bd8deadSopenharmony_ci    stage processing the primitives captured by transform feedback.  The
10625bd8deadSopenharmony_ci    set of attributes to capture in transform feedback mode for any
10635bd8deadSopenharmony_ci    other program active on a previous shader stage is ignored."
10645bd8deadSopenharmony_ci
10655bd8deadSopenharmony_ci    Add to list of INVALID_OPERATION errors on page 172
10665bd8deadSopenharmony_ci
10675bd8deadSopenharmony_ci    * by UseProgramStages if the program pipeline object it refers to is
10685bd8deadSopenharmony_ci    current and the current transform feedback object is active and not
10695bd8deadSopenharmony_ci    paused.
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci    * by BindProgramPipeline if the current transform feedback object is
10725bd8deadSopenharmony_ci    active and not paused.
10735bd8deadSopenharmony_ci
10745bd8deadSopenharmony_ci    * by ResumeTransformFeedback if the program pipeline object being
10755bd8deadSopenharmony_ci    used by the current transform feedback object is not bound, any of
10765bd8deadSopenharmony_ci    its shader stage bindings has changed, or a single program object
10775bd8deadSopenharmony_ci    is active and overriding it.
10785bd8deadSopenharmony_ci
10795bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.0 Compatibility Profile
10805bd8deadSopenharmony_ciSpecification (Rasterization)
10815bd8deadSopenharmony_ci
10825bd8deadSopenharmony_ci -- Section 3.12 "Fragment Shaders" (page 321) 
10835bd8deadSopenharmony_ci
10845bd8deadSopenharmony_ci    Replace the second to the last paragraph with:
10855bd8deadSopenharmony_ci
10865bd8deadSopenharmony_ci    "When the current fragment shader program object currently includes
10875bd8deadSopenharmony_ci    a fragment shader, its fragment shader is considered active, and is
10885bd8deadSopenharmony_ci    used to process fragments.  If the fragment shader program object
10895bd8deadSopenharmony_ci    has no fragment shader, or no fragment shader program object is
10905bd8deadSopenharmony_ci    currently in use, the fixed-function fragment processing operations
10915bd8deadSopenharmony_ci    described in the previous sections are used."
10925bd8deadSopenharmony_ci
10935bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.0 Compatibility Profile
10945bd8deadSopenharmony_ciSpecification (Per-Fragment Operations and the Frame Buffer)
10955bd8deadSopenharmony_ci
10965bd8deadSopenharmony_ci    None
10975bd8deadSopenharmony_ci
10985bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.0 Compatibility Profile
10995bd8deadSopenharmony_ciSpecification (Special Functions)
11005bd8deadSopenharmony_ci
11015bd8deadSopenharmony_ci -- Section 5.5 "Display Lists" (page 410) 
11025bd8deadSopenharmony_ci
11035bd8deadSopenharmony_ci    Add CreateShaderProgram, GenProgramPipelines, DeleteProgram-
11045bd8deadSopenharmony_ci    Pipelines, and BindProgramPipelines to the "Program and shader
11055bd8deadSopenharmony_ci    objects" list of commands that cannot be compiled into a display
11065bd8deadSopenharmony_ci    list but are instead executed immediately.
11075bd8deadSopenharmony_ci
11085bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.0 Compatibility Profile Specific-
11095bd8deadSopenharmony_ciation (State and State Requests)
11105bd8deadSopenharmony_ci
11115bd8deadSopenharmony_ci -- Section 6.1.18 "Shader and Program Queries"
11125bd8deadSopenharmony_ci    
11135bd8deadSopenharmony_ci    Add to GetProgramiv description:
11145bd8deadSopenharmony_ci
11155bd8deadSopenharmony_ci    "If <pname> is PROGRAM_SEPARABLE, TRUE is returned if the program has
11165bd8deadSopenharmony_ci    been flagged for use as a separable program object that can be bound
11175bd8deadSopenharmony_ci    to individual shader stages with UseProgramStages."
11185bd8deadSopenharmony_ci
11195bd8deadSopenharmony_ci    Add after GetProgramiv description:
11205bd8deadSopenharmony_ci
11215bd8deadSopenharmony_ci    "The command 
11225bd8deadSopenharmony_ci
11235bd8deadSopenharmony_ci        boolean IsProgramPipeline(uint pipeline);
11245bd8deadSopenharmony_ci
11255bd8deadSopenharmony_ci    returns TRUE if <pipeline> is the name of a program pipeline object.
11265bd8deadSopenharmony_ci    If <pipeline> is zero, or a non-zero value that is not the name of a
11275bd8deadSopenharmony_ci    program pipeline object, IsProgramPipeline returns FALSE. No error
11285bd8deadSopenharmony_ci    is generated if <pipeline> is not a valid program pipeline object
11295bd8deadSopenharmony_ci    name.
11305bd8deadSopenharmony_ci
11315bd8deadSopenharmony_ci    The command
11325bd8deadSopenharmony_ci
11335bd8deadSopenharmony_ci        GetProgramPipelineiv(uint pipeline, enum pname, int *params);
11345bd8deadSopenharmony_ci
11355bd8deadSopenharmony_ci    returns properties of the program pipeline object named <pipeline>
11365bd8deadSopenharmony_ci    in <params>. The parameter value to return is specified by <pname>.
11375bd8deadSopenharmony_ci
11385bd8deadSopenharmony_ci    If <pipeline> is a name that has been generated (without subsequent
11395bd8deadSopenharmony_ci    deletion) by GenProgramPipelines, but refers to a program pipeline
11405bd8deadSopenharmony_ci    object that has not been previously bound, the GL first creates a
11415bd8deadSopenharmony_ci    new state vector in the same manner as when BindProgramPipeline
11425bd8deadSopenharmony_ci    creates a new program pipeline object. If <pipeline> is not a name
11435bd8deadSopenharmony_ci    returned from a previous call to GenProgramPipelines or if such a
11445bd8deadSopenharmony_ci    name has since been deleted by DeleteProgramPipelines, an INVALID_-
11455bd8deadSopenharmony_ci    OPERATION error is generated.
11465bd8deadSopenharmony_ci
11475bd8deadSopenharmony_ci       If <pname> is ACTIVE_PROGRAM, the name of the active program
11485bd8deadSopenharmony_ci    object of the program pipeline object is returned.
11495bd8deadSopenharmony_ci       If <pname> is VERTEX_SHADER, the name of the current program
11505bd8deadSopenharmony_ci    object for the vertex shader type of the program pipeline object is
11515bd8deadSopenharmony_ci    returned.
11525bd8deadSopenharmony_ci       If <pname> is FRAGMENT_SHADER, the name of the current program
11535bd8deadSopenharmony_ci    object for the fragment shader type of the program pipeline object
11545bd8deadSopenharmony_ci    is returned.
11555bd8deadSopenharmony_ci       If <pname> is GEOMETRY_SHADER, the name of the current program
11565bd8deadSopenharmony_ci    object for the geometry shader type of the program pipeline object
11575bd8deadSopenharmony_ci    is returned;
11585bd8deadSopenharmony_ci       If <pname> is TESS_CONTROL_SHADER, the name of the current
11595bd8deadSopenharmony_ci    program object for the tessellation control shader type of the
11605bd8deadSopenharmony_ci    program pipeline object is returned;
11615bd8deadSopenharmony_ci       If <pname> is TESS_EVALUATION_SHADER, the name of the current
11625bd8deadSopenharmony_ci    program object for the tessellation evaluations shader type of the
11635bd8deadSopenharmony_ci    program pipeline object is returned.
11645bd8deadSopenharmony_ci       If <pname> is VALIDATE_STATUS, the validation status of the
11655bd8deadSopenharmony_ci    program pipeline object, as determined by ValidateProgramPipeline
11665bd8deadSopenharmony_ci    (see section 2.14.8) is returned.
11675bd8deadSopenharmony_ci       If <pname> is INFO_LOG_LENGTH, the length of the info log,
11685bd8deadSopenharmony_ci    including a null terminator, is returned. If there is no info log,
11695bd8deadSopenharmony_ci    zero is returned."
11705bd8deadSopenharmony_ci    If <pname> is not the name of an accepted parameter, an INVALID_-
11715bd8deadSopenharmony_ci    ENUM error is generated.
11725bd8deadSopenharmony_ci
11735bd8deadSopenharmony_ci    Change paragraph describing GetShaderInfoLog and GetProgram:
11745bd8deadSopenharmony_ci
11755bd8deadSopenharmony_ci    "A string that contains information about the last compilation
11765bd8deadSopenharmony_ci    attempt on a shader object, last link or validation attempt on a
11775bd8deadSopenharmony_ci    program object, or last validation attempt on a program pipeline
11785bd8deadSopenharmony_ci    object, called the info log, can be obtained with the commands
11795bd8deadSopenharmony_ci
11805bd8deadSopenharmony_ci        void GetShaderInfoLog (uint shader, sizei bufSize,
11815bd8deadSopenharmony_ci                               sizei *length, char *infoLog);
11825bd8deadSopenharmony_ci        void GetProgramInfoLog (uint program, sizei bufSize,
11835bd8deadSopenharmony_ci                                sizei *length, char *infoLog);
11845bd8deadSopenharmony_ci        void GetProgramPipelineInfoLog (uint pipeline, sizei bufSize,
11855bd8deadSopenharmony_ci                                        sizei *length, char *infoLog);
11865bd8deadSopenharmony_ci
11875bd8deadSopenharmony_ci    These commands return the info log string in <infoLog>. This string
11885bd8deadSopenharmony_ci    will be null-terminated. The actual number of characters written
11895bd8deadSopenharmony_ci    into <infoLog>, excluding the null terminator, is returned in
11905bd8deadSopenharmony_ci    <length>. If <length> is NULL, then no length is returned. The
11915bd8deadSopenharmony_ci    maximum number of characters that may be written into <infoLog>,
11925bd8deadSopenharmony_ci    including the null terminator, is specified by <bufSize>. The number
11935bd8deadSopenharmony_ci    of characters in the info log can be queried with GetShaderiv,
11945bd8deadSopenharmony_ci    GetProgramiv, or GetProgramPipelineiv with INFO_LOG_LENGTH. If
11955bd8deadSopenharmony_ci    <shader> is a shader object, the returned info log will either be an
11965bd8deadSopenharmony_ci    empty string or it will contain information about the last compil-
11975bd8deadSopenharmony_ci    ation attempt for that object. If <program> is a program object, the
11985bd8deadSopenharmony_ci    returned info log will either be an empty string or it will contain
11995bd8deadSopenharmony_ci    information about the last link attempt or last validation attempt
12005bd8deadSopenharmony_ci    for that object. If <pipeline> is a program pipeline object, the
12015bd8deadSopenharmony_ci    returned info log will either be an empty string or it will contain
12025bd8deadSopenharmony_ci    information about the last validation attempt for that object.
12035bd8deadSopenharmony_ci
12045bd8deadSopenharmony_ci
12055bd8deadSopenharmony_ciAdditions to Appendix D of the OpenGL 4.0 Compatibility Profile Specific-
12065bd8deadSopenharmony_ciation (Shared Objects and Multiple Contexts)
12075bd8deadSopenharmony_ci
12085bd8deadSopenharmony_ci    (modify third paragraph, p. 533, making program pipeline objects
12095bd8deadSopenharmony_ci    non-shared) Framebuffer, query, vertex array, and program pipeline 
12105bd8deadSopenharmony_ci    objects are not shared.
12115bd8deadSopenharmony_ci
12125bd8deadSopenharmony_ci
12135bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
12145bd8deadSopenharmony_ci
12155bd8deadSopenharmony_ci    None
12165bd8deadSopenharmony_ci
12175bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language Specification, Version 4.00.8
12185bd8deadSopenharmony_ci
12195bd8deadSopenharmony_ci    Including the following line in a shader can be used to control
12205bd8deadSopenharmony_ci    the language feature described in thie extension:
12215bd8deadSopenharmony_ci
12225bd8deadSopenharmony_ci      #extension GL_ARB_separate_shader_objects : <behavior>
12235bd8deadSopenharmony_ci
12245bd8deadSopenharmony_ci    where <behavior> is as described in section 3.3.
12255bd8deadSopenharmony_ci
12265bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL Shading Language:
12275bd8deadSopenharmony_ci
12285bd8deadSopenharmony_ci      #define GL_ARB_separate_shader_objects 1
12295bd8deadSopenharmony_ci
12305bd8deadSopenharmony_ci -- Section 4.3 "Storage Qualifiers" (page 32):
12315bd8deadSopenharmony_ci
12325bd8deadSopenharmony_ci    Add to the end of the section:
12335bd8deadSopenharmony_ci
12345bd8deadSopenharmony_ci    When comparing an output from one shader stage to an input of a second
12355bd8deadSopenharmony_ci    shader stage, the input and output are considered to match only if
12365bd8deadSopenharmony_ci    compatible storage qualifiers are used.  An output declared with "out",
12375bd8deadSopenharmony_ci    "centroid out", "sample out", or "patch out" matches an input only if the
12385bd8deadSopenharmony_ci    input is declared with "in", "centroid in", "sample in", or "patch in",
12395bd8deadSopenharmony_ci    respectively.  Additionally, an output will only match an input with
12405bd8deadSopenharmony_ci    identical interpolation qualifiers.
12415bd8deadSopenharmony_ci
12425bd8deadSopenharmony_ci    [[ Note:  If the GLSL specification is updated to break out "centroid",
12435bd8deadSopenharmony_ci       "sample", and "patch" as separate auxillary qualifiers instead of
12445bd8deadSopenharmony_ci       tightly coupling with "in" and "out" as in GLSL 4.00, this language
12455bd8deadSopenharmony_ci       should be rewritten to require that these auxillary qualifiers match
12465bd8deadSopenharmony_ci       (and that "in" match "out", of course). ]]
12475bd8deadSopenharmony_ci
12485bd8deadSopenharmony_ci -- Section 4.3.4 "Inputs" (page 36):
12495bd8deadSopenharmony_ci
12505bd8deadSopenharmony_ci    Add to the end of the section:
12515bd8deadSopenharmony_ci
12525bd8deadSopenharmony_ci    When an interface between shader stages is formed using shaders from two
12535bd8deadSopenharmony_ci    separate program objects, it is not possible to detect mismatches between
12545bd8deadSopenharmony_ci    inputs and outputs when the programs are linked.  When there are
12555bd8deadSopenharmony_ci    mismatches between inputs and outputs on such interfaces, the values
12565bd8deadSopenharmony_ci    passed across the interface will be partially or completely undefined.
12575bd8deadSopenharmony_ci    Shaders can ensure matches across such interfaces either by using input
12585bd8deadSopenharmony_ci    and output layout qualifiers (Sections 4.3.8.1 and 4.3.8.2) or by using
12595bd8deadSopenharmony_ci    identical input and output declarations.  Complete rules for interface
12605bd8deadSopenharmony_ci    matching are found in the "Shader Interface Matching" portion of section
12615bd8deadSopenharmony_ci    2.14.PPO of the OpenGL Specification.
12625bd8deadSopenharmony_ci
12635bd8deadSopenharmony_ci -- Section 4.3.8.1 "Input Layout Qualifiers" (page 44):
12645bd8deadSopenharmony_ci
12655bd8deadSopenharmony_ci    All shaders allow location input layout qualifiers on input variable
12665bd8deadSopenharmony_ci    declarations. The location layout qualifier identifier for inputs is:
12675bd8deadSopenharmony_ci
12685bd8deadSopenharmony_ci        layout-qualifier-id
12695bd8deadSopenharmony_ci            location = integer-constant
12705bd8deadSopenharmony_ci
12715bd8deadSopenharmony_ci    Only one argument is accepted. For example,
12725bd8deadSopenharmony_ci
12735bd8deadSopenharmony_ci        layout(location = 3) in vec4 normal;
12745bd8deadSopenharmony_ci
12755bd8deadSopenharmony_ci    establishes that the shader input <normal> is assigned to location number
12765bd8deadSopenharmony_ci    3.  For vertex shader inputs, the location specifies the number of the
12775bd8deadSopenharmony_ci    generic vertex attribute from which input values are taken.  For inputs of
12785bd8deadSopenharmony_ci    all other shader types, the location specifies a vector number that can be
12795bd8deadSopenharmony_ci    used to match against outputs from a previous shader stage, even if that 
12805bd8deadSopenharmony_ci    shader is in a different program object.
12815bd8deadSopenharmony_ci
12825bd8deadSopenharmony_ci    If the declared input has a scalar or vector type, it will consume a
12835bd8deadSopenharmony_ci    single location, except for non-vertex inputs of type "dvec3" and "dvec4",
12845bd8deadSopenharmony_ci    which will consume two consecutive locations.  Inputs of type "double" and
12855bd8deadSopenharmony_ci    "dvec2" will consume only a single location in all shaders.
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci    If the declared input is an array of size <n> and each element takes up
12885bd8deadSopenharmony_ci    <m> locations, it will be assigned <m>*<n> consecutive locations starting
12895bd8deadSopenharmony_ci    with the location specified.  For example,
12905bd8deadSopenharmony_ci
12915bd8deadSopenharmony_ci        layout(location = 6) in vec4 colors[3];
12925bd8deadSopenharmony_ci
12935bd8deadSopenharmony_ci    will establish that the input <colors> is assigned to vector
12945bd8deadSopenharmony_ci    location numbers 6, 7, and 8.
12955bd8deadSopenharmony_ci
12965bd8deadSopenharmony_ci    If the declared input is an <n>x<m> single- or double-precision matrix, it
12975bd8deadSopenharmony_ci    will be assigned multiple locations starting with the location specified.
12985bd8deadSopenharmony_ci    The number of locations assigned for each matrix will be the same as for
12995bd8deadSopenharmony_ci    an <n>-element array of <m>-component vectors.  For example,
13005bd8deadSopenharmony_ci
13015bd8deadSopenharmony_ci        layout(location = 9) in mat4 transforms[2];
13025bd8deadSopenharmony_ci
13035bd8deadSopenharmony_ci    will establish that input <transforms> is assigned to vector location
13045bd8deadSopenharmony_ci    numbers 9-16, with transforms[0] being assigned to locations 9-12 and
13055bd8deadSopenharmony_ci    transforms[1] being assigned to locations 13-16.
13065bd8deadSopenharmony_ci
13075bd8deadSopenharmony_ci    If the declared input is a structure, its members will be assigned
13085bd8deadSopenharmony_ci    consecutive locations in the order of declaration, with the first member
13095bd8deadSopenharmony_ci    assigned the location specified for the structure.  The number of
13105bd8deadSopenharmony_ci    locations consumed by a structure member is determined by applying the
13115bd8deadSopenharmony_ci    rules above recursively as though the structure member were declared as
13125bd8deadSopenharmony_ci    an input variable of the same type.  For example,
13135bd8deadSopenharmony_ci
13145bd8deadSopenharmony_ci        layout(location = 3) struct S {
13155bd8deadSopenharmony_ci           vec3 a;
13165bd8deadSopenharmony_ci           mat2 b;
13175bd8deadSopenharmony_ci           vec4 c[2];
13185bd8deadSopenharmony_ci        } s;
13195bd8deadSopenharmony_ci
13205bd8deadSopenharmony_ci    will assign location 3 to "s.a", locations 4 and 5 to the two column
13215bd8deadSopenharmony_ci    vectors of "s.b", and locations 6 and 7 to "s.c".
13225bd8deadSopenharmony_ci
13235bd8deadSopenharmony_ci    Location layout qualifiers may be used on input variables declared as
13245bd8deadSopenharmony_ci    structures, but not on individual members.  Location layout qualifiers may
13255bd8deadSopenharmony_ci    not be used on input blocks or input block members.
13265bd8deadSopenharmony_ci
13275bd8deadSopenharmony_ci    The number of input locations available to a shader is limited.  For
13285bd8deadSopenharmony_ci    vertex shaders, the limit is the advertised number of vertex attributes.
13295bd8deadSopenharmony_ci    For all other shaders, the limit is implementation-dependent and must be
13305bd8deadSopenharmony_ci    no less than one fourth of the advertised maximum input component count.
13315bd8deadSopenharmony_ci    A program will fail to link if any attached shader uses a location greater
13325bd8deadSopenharmony_ci    than or equal to the number of supported locations, unless
13335bd8deadSopenharmony_ci    device-dependent optimizations are able to make the program fit within
13345bd8deadSopenharmony_ci    available hardware resources.
13355bd8deadSopenharmony_ci
13365bd8deadSopenharmony_ci    A program will fail to link if any two non-vertex shader input variables
13375bd8deadSopenharmony_ci    are assigned to the same location.  For vertex shaders, multiple input
13385bd8deadSopenharmony_ci    variables may be assigned to the same location using either layout
13395bd8deadSopenharmony_ci    qualifiers or via the OpenGL API.  However, such aliasing is intended only
13405bd8deadSopenharmony_ci    to support vertex shaders where each execution path accesses at most one
13415bd8deadSopenharmony_ci    input at each location.  Implementations are permitted, but not required,
13425bd8deadSopenharmony_ci    to generate link errors if they detect that every path through the vertex
13435bd8deadSopenharmony_ci    shader executable accesses multiple inputs assigned to any single
13445bd8deadSopenharmony_ci    location.  For all shader types, a program will fail to link if explicit
13455bd8deadSopenharmony_ci    location assignments leave the linker unable to find space for other
13465bd8deadSopenharmony_ci    variables without explicit assignments.
13475bd8deadSopenharmony_ci
13485bd8deadSopenharmony_ci    For the purposes of determining if a non-vertex input matches an output
13495bd8deadSopenharmony_ci    from a previous shader stage, the location layout qualifier (if any) must
13505bd8deadSopenharmony_ci    match.
13515bd8deadSopenharmony_ci
13525bd8deadSopenharmony_ci -- Section 4.3.8.2 "Output Layout Qualifiers" (page 48)
13535bd8deadSopenharmony_ci
13545bd8deadSopenharmony_ci    Modify the description of fragment output qualifiers.
13555bd8deadSopenharmony_ci
13565bd8deadSopenharmony_ci    All shaders allow location output layout qualifiers on output
13575bd8deadSopenharmony_ci    variable declarations. The location layout qualifier identifier for
13585bd8deadSopenharmony_ci    outputs is:
13595bd8deadSopenharmony_ci
13605bd8deadSopenharmony_ci        layout-qualifier-id
13615bd8deadSopenharmony_ci            location = integer-constant
13625bd8deadSopenharmony_ci
13635bd8deadSopenharmony_ci    Fragment shaders allow an additional index output layout qualifiers:
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci        layout-qualifier-id
13665bd8deadSopenharmony_ci            location = integer-constant
13675bd8deadSopenharmony_ci            index = integer-constant
13685bd8deadSopenharmony_ci
13695bd8deadSopenharmony_ci    Each of these qualifiers may appear at most once. If index is
13705bd8deadSopenharmony_ci    specified, location must also be specified. If index is not
13715bd8deadSopenharmony_ci    specified, the value 0 is used. For example, in a fragment shader,
13725bd8deadSopenharmony_ci
13735bd8deadSopenharmony_ci        layout(location = 3) out vec4 color;
13745bd8deadSopenharmony_ci
13755bd8deadSopenharmony_ci    will establish that the fragment shader output <color> is assigned
13765bd8deadSopenharmony_ci    to fragment color 3 as the first (index zero) input to the blend
13775bd8deadSopenharmony_ci    equation. And,
13785bd8deadSopenharmony_ci
13795bd8deadSopenharmony_ci        layout(location = 3, index = 1) out vec4 factor;
13805bd8deadSopenharmony_ci
13815bd8deadSopenharmony_ci    will establish that the fragment shader output factor is assigned
13825bd8deadSopenharmony_ci    to fragment color 3 as the second (index one) input to the blend
13835bd8deadSopenharmony_ci    equation.
13845bd8deadSopenharmony_ci
13855bd8deadSopenharmony_ci    For fragment shader outputs, the location and index specify the color
13865bd8deadSopenharmony_ci    output number and index receiving the values of the output.  For outputs
13875bd8deadSopenharmony_ci    of all other shader types, the location specifies a vector number that can
13885bd8deadSopenharmony_ci    be used to match against inputs in a subsequent shader stage, even if that
13895bd8deadSopenharmony_ci    shader is in a different program object.
13905bd8deadSopenharmony_ci
13915bd8deadSopenharmony_ci    If the declared output has a scalar or vector type, it will consume a
13925bd8deadSopenharmony_ci    single location, except for outputs of type "dvec3" and "dvec4", which
13935bd8deadSopenharmony_ci    will consume two consecutive locations.  Outputs of type "double" and
13945bd8deadSopenharmony_ci    "dvec2" will consume only a single location in all shaders.
13955bd8deadSopenharmony_ci
13965bd8deadSopenharmony_ci    If the declared output is an array, it will be assigned consecutive
13975bd8deadSopenharmony_ci    locations starting with the location specified.  For example,
13985bd8deadSopenharmony_ci
13995bd8deadSopenharmony_ci        layout(location = 2) out vec4 colors[3];
14005bd8deadSopenharmony_ci
14015bd8deadSopenharmony_ci    will establish that <colors> is assigned to vector location
14025bd8deadSopenharmony_ci    numbers 2, 3, and 4.
14035bd8deadSopenharmony_ci
14045bd8deadSopenharmony_ci    If the declared output is an <n>x<m> single- or double-precision matrix,
14055bd8deadSopenharmony_ci    it will be assigned multiple locations starting with the location
14065bd8deadSopenharmony_ci    specified.  The number of locations assigned will be the same as for an
14075bd8deadSopenharmony_ci    <n>-element array of <m>-component vectors.
14085bd8deadSopenharmony_ci
14095bd8deadSopenharmony_ci    If the declared output is a structure, its members will be assigned
14105bd8deadSopenharmony_ci    consecutive locations in the order of declaration, with the first member
14115bd8deadSopenharmony_ci    assigned the location specified for the structure.  The number of
14125bd8deadSopenharmony_ci    locations consumed by a structure member is determined by applying the
14135bd8deadSopenharmony_ci    rules above recursively as though the structure member were declared as
14145bd8deadSopenharmony_ci    an output variable of the same type.
14155bd8deadSopenharmony_ci
14165bd8deadSopenharmony_ci    Location layout qualifiers may be used on output variables declared as
14175bd8deadSopenharmony_ci    structures, but not on individual members.  Location layout qualifiers may
14185bd8deadSopenharmony_ci    not be used on output blocks or output block members.
14195bd8deadSopenharmony_ci
14205bd8deadSopenharmony_ci    The number of output locations available to a shader is limited.  For
14215bd8deadSopenharmony_ci    fragment shaders, the limit is the advertised number of draw buffers.  For
14225bd8deadSopenharmony_ci    all other shaders, the limit is implementation-dependent and must be no
14235bd8deadSopenharmony_ci    less than one fourth of the advertised maximum output component count.  A
14245bd8deadSopenharmony_ci    program will fail to link if any attached shader uses a location greater
14255bd8deadSopenharmony_ci    than or equal to the number of supported locations, unless
14265bd8deadSopenharmony_ci    device-dependent optimizations are able to make the program fit within
14275bd8deadSopenharmony_ci    available hardware resources.
14285bd8deadSopenharmony_ci
14295bd8deadSopenharmony_ci    A program will fail to link if any two fragment shader output variables
14305bd8deadSopenharmony_ci    are assigned to the same location and index, or if any two output
14315bd8deadSopenharmony_ci    variables from the same non-fragment shader stage are assigned to the same
14325bd8deadSopenharmony_ci    location.  For fragment shader outputs, locations can be assigned using
14335bd8deadSopenharmony_ci    either a layout qualifier or via the OpenGL API.  For all shader types, a
14345bd8deadSopenharmony_ci    program will fail to link if explicit location assignments leave the
14355bd8deadSopenharmony_ci    linker unable to find space for other variables without explicit
14365bd8deadSopenharmony_ci    assignments.
14375bd8deadSopenharmony_ci
14385bd8deadSopenharmony_ci    For the purposes of determining if a non-fragment output matches an input
14395bd8deadSopenharmony_ci    from a subsequent shader stage, the location layout qualifier (if any)
14405bd8deadSopenharmony_ci    must match.
14415bd8deadSopenharmony_ci
14425bd8deadSopenharmony_ci -- Section 4.5.2, "Precision Qualifiers" (page 53)
14435bd8deadSopenharmony_ci
14445bd8deadSopenharmony_ci    (add new paragraph to the end of the section) For the purposes of
14455bd8deadSopenharmony_ci    determining if an output from one shader stage matches an input of the
14465bd8deadSopenharmony_ci    next stage, the precision qualifier need not match.
14475bd8deadSopenharmony_ci
14485bd8deadSopenharmony_ci -- Section 4.6.1, "The Invariant Qualifier" (page 55)
14495bd8deadSopenharmony_ci
14505bd8deadSopenharmony_ci    (add new paragraph to the end of the section) For the purposes of
14515bd8deadSopenharmony_ci    determining if an output from one shader stage matches an input of the
14525bd8deadSopenharmony_ci    next stage, the "invariant" qualifier need not match.
14535bd8deadSopenharmony_ci
14545bd8deadSopenharmony_ci -- Section 4.7, "The Precise Qualifier" (page 56)
14555bd8deadSopenharmony_ci
14565bd8deadSopenharmony_ci    (add new paragraph to the end of the section) For the purposes of
14575bd8deadSopenharmony_ci    determining if an output from one shader stage matches an input of the
14585bd8deadSopenharmony_ci    next stage, the "precise" qualifier need not match.
14595bd8deadSopenharmony_ci
14605bd8deadSopenharmony_ci
14615bd8deadSopenharmony_ciGLX Protocol
14625bd8deadSopenharmony_ci
14635bd8deadSopenharmony_ci    The following rendering command is sent to the server as part of a
14645bd8deadSopenharmony_ci    glXRender request:
14655bd8deadSopenharmony_ci
14665bd8deadSopenharmony_ci        UseProgramStages
14675bd8deadSopenharmony_ci            2           8               rendering command length
14685bd8deadSopenharmony_ci            2           ZZZZ            rendering command opcode
14695bd8deadSopenharmony_ci            4           ENUM            type
14705bd8deadSopenharmony_ci            4           CARD32          program
14715bd8deadSopenharmony_ci
14725bd8deadSopenharmony_ci        ActiveShaderProgram
14735bd8deadSopenharmony_ci            2           4               rendering command length
14745bd8deadSopenharmony_ci            2           ZZZZ            rendering command opcode
14755bd8deadSopenharmony_ci            4           CARD32          program
14765bd8deadSopenharmony_ci
14775bd8deadSopenharmony_ciErrors
14785bd8deadSopenharmony_ci
14795bd8deadSopenharmony_ci    UseProgramStages generates INVALID_OPERATION if the program
14805bd8deadSopenharmony_ci    parameter has not been successfully linked.
14815bd8deadSopenharmony_ci
14825bd8deadSopenharmony_ci    UseProgramStages generates INVALID_OPERATION if transform feedback
14835bd8deadSopenharmony_ci    is active.
14845bd8deadSopenharmony_ci
14855bd8deadSopenharmony_ci    UseProgramStages generates INVALID_VALUE if <stages> has a bit
14865bd8deadSopenharmony_ci    set for any other than TESS_CONTROL_SHADER_BIT, TESS_EVALUATION_-
14875bd8deadSopenharmony_ci    SHADER_BIT, VERTEX_SHADER_BIT, GEOMETRY_SHADER_BIT, or FRAGMENT_-
14885bd8deadSopenharmony_ci    SHADER_BIT, unless <stages> is ALL_SHADER_BITS.
14895bd8deadSopenharmony_ci
14905bd8deadSopenharmony_ci    ActiveShaderProgram generates INVALID_OPERATION if the program
14915bd8deadSopenharmony_ci    parameter has not been successfully linked.
14925bd8deadSopenharmony_ci
14935bd8deadSopenharmony_ci    The INVALID_OPERATION error produced by LinkProgram if the program
14945bd8deadSopenharmony_ci    object has a geometry, tessellation control, or tessellation
14955bd8deadSopenharmony_ci    evalutations shader attached and no vertex shader attached is now
14965bd8deadSopenharmony_ci    produced at Begin time.
14975bd8deadSopenharmony_ci
14985bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command
14995bd8deadSopenharmony_ci    that implicitly calls Begin, is called when a program object with
15005bd8deadSopenharmony_ci    multiple attached shaders is active for one or more, but not all of
15015bd8deadSopenharmony_ci    the shader program types corresponding to the shaders that are
15025bd8deadSopenharmony_ci    attached.
15035bd8deadSopenharmony_ci
15045bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command
15055bd8deadSopenharmony_ci    that implicitly calls Begin, is called when an active program object
15065bd8deadSopenharmony_ci    has two shaders attached that have shader program types in between
15075bd8deadSopenharmony_ci    them with active programs that are not zero and are not equal to the
15085bd8deadSopenharmony_ci    active program of the first two shaders.
15095bd8deadSopenharmony_ci
15105bd8deadSopenharmony_ci    INVALID_OPERATION is generated if any of the commands added by this
15115bd8deadSopenharmony_ci    extension are executed between the execution of Begin and the
15125bd8deadSopenharmony_ci    corresponding execution of End.
15135bd8deadSopenharmony_ci
15145bd8deadSopenharmony_ciDependencies on OpenGL 4.0 (Core Profile)
15155bd8deadSopenharmony_ci
15165bd8deadSopenharmony_ci    If the OpenGL 4.0 core profile is used, references to built-in shader
15175bd8deadSopenharmony_ci    variables found only in the compatibility profile should be removed.
15185bd8deadSopenharmony_ci    Additionally, the fragment shader built-in input block "gl_PerFragment"
15195bd8deadSopenharmony_ci    doesn't exist, and references to it should be removed.  When matching
15205bd8deadSopenharmony_ci    shader outputs to fragment inputs, the members of "gl_PerVertex" output
15215bd8deadSopenharmony_ci    block do not affect matching.  References to fixed-function vertex and
15225bd8deadSopenharmony_ci    fragment processing should also be removed.
15235bd8deadSopenharmony_ci
15245bd8deadSopenharmony_ciDependencies on GLSL 1.40 and earlier
15255bd8deadSopenharmony_ci
15265bd8deadSopenharmony_ci    This extension typically requires that shaders redeclare "gl_PerVertex" 
15275bd8deadSopenharmony_ci    or "gl_PerFragment" to use members of built-in input or output blocks in
15285bd8deadSopenharmony_ci    separable shaders.  However, since input and output interface blocks 
15295bd8deadSopenharmony_ci    are not supported in GLSL 1.40 or earlier, such redeclarations are not 
15305bd8deadSopenharmony_ci    even possible using older versions of GLSL.
15315bd8deadSopenharmony_ci
15325bd8deadSopenharmony_ci    To deal with this case, this extension provides a specific exception to
15335bd8deadSopenharmony_ci    this rule, allowing vertex and fragment shaders using #version 140 or
15345bd8deadSopenharmony_ci    lower to redeclare all variables that would otherwise belong to these
15355bd8deadSopenharmony_ci    blocks at global scope.  When linking separable programs using such
15365bd8deadSopenharmony_ci    shaders, the set of redeclared inputs/outputs are taken to form an
15375bd8deadSopenharmony_ci    implicit redeclaration of "gl_PerVertex" or "gl_PerFragment".  After this,
15385bd8deadSopenharmony_ci    normal matching rules for the gl_PerVertex and gl_PerFragment blocks are
15395bd8deadSopenharmony_ci    applied.  When using this capability:
15405bd8deadSopenharmony_ci
15415bd8deadSopenharmony_ci      * all built-in vertex outputs or fragment inputs must be redeclared;
15425bd8deadSopenharmony_ci
15435bd8deadSopenharmony_ci      * all shaders of a given type must make the same redeclarations; and
15445bd8deadSopenharmony_ci
15455bd8deadSopenharmony_ci      * to get an exact interface match, the vertex output and fragment input
15465bd8deadSopenharmony_ci        redeclarations must be compatible according to block matching rules.
15475bd8deadSopenharmony_ci
15485bd8deadSopenharmony_ci    This exception is important because we expect this extension to be
15495bd8deadSopenharmony_ci    supported on implementations and GPUs supporting only OpenGL 2.1, which
15505bd8deadSopenharmony_ci    doesn't support the interface blocks added by GLSL 1.50.  
15515bd8deadSopenharmony_ci
15525bd8deadSopenharmony_ci    Note that this exception applies only to shaders using #version 140.  When
15535bd8deadSopenharmony_ci    using this extension with shaders using #version 150 or higher, the
15545bd8deadSopenharmony_ci    shaders must redeclare gl_PerVertex or gl_PerFragment blocks.
15555bd8deadSopenharmony_ci
15565bd8deadSopenharmony_ci    The following edits to the GLSL 1.40 (revision 7) specification are made
15575bd8deadSopenharmony_ci    when this extension is enabled by an #extension directive:
15585bd8deadSopenharmony_ci
15595bd8deadSopenharmony_ci      Add new Section 7.7, Built-In Redeclaration and Separable Programs
15605bd8deadSopenharmony_ci
15615bd8deadSopenharmony_ci      The following vertex shader outputs may be redeclared at global scope to
15625bd8deadSopenharmony_ci      specify a built-in output interface, with or without special qualifiers:
15635bd8deadSopenharmony_ci
15645bd8deadSopenharmony_ci        gl_Position
15655bd8deadSopenharmony_ci        gl_PointSize
15665bd8deadSopenharmony_ci        gl_ClipDistance[]
15675bd8deadSopenharmony_ci        gl_ClipVertex           (compatibility only)
15685bd8deadSopenharmony_ci        gl_FrontColor           (compatibility only)
15695bd8deadSopenharmony_ci        gl_BackColor            (compatibility only)
15705bd8deadSopenharmony_ci        gl_FrontSecondaryColor  (compatibility only)
15715bd8deadSopenharmony_ci        gl_BackSecondaryColor   (compatibility only)
15725bd8deadSopenharmony_ci        gl_TexCoord[]           (compatibility only)
15735bd8deadSopenharmony_ci        gl_FogFragCoord         (compatibility only)
15745bd8deadSopenharmony_ci
15755bd8deadSopenharmony_ci      The following fragment shader inputs may be redeclared at global scope
15765bd8deadSopenharmony_ci      to specify a built-in input interface, with or without special
15775bd8deadSopenharmony_ci      qualifiers:
15785bd8deadSopenharmony_ci
15795bd8deadSopenharmony_ci        gl_Color                (compatibility only)
15805bd8deadSopenharmony_ci        gl_SecondaryColor       (compatibility only)
15815bd8deadSopenharmony_ci        gl_TexCoord[]           (compatibility only)
15825bd8deadSopenharmony_ci        gl_FogFragCoord         (compatibility only)
15835bd8deadSopenharmony_ci
15845bd8deadSopenharmony_ci      When compiling shaders using any of the above variables, all such
15855bd8deadSopenharmony_ci      variables must be redeclared prior to use.  ((Note:  This restriction
15865bd8deadSopenharmony_ci      applies only to shaders using version 140 or earlier that enable the
15875bd8deadSopenharmony_ci      ARB_separate_shader objects extension; shaders not enabling the
15885bd8deadSopenharmony_ci      extension do not have this requirement.))  A separable program object
15895bd8deadSopenharmony_ci      will fail to link if any attached shader uses one of the above variables
15905bd8deadSopenharmony_ci      without redeclaration, or if it has two shaders of the same type using
15915bd8deadSopenharmony_ci      any of these variables where the sets of variable declarations don't
15925bd8deadSopenharmony_ci      match exactly.
15935bd8deadSopenharmony_ci
15945bd8deadSopenharmony_ci    Additionally, the API specification language in this specification
15955bd8deadSopenharmony_ci    (written assuming input and output blocks in GLSL) is modified as follows:
15965bd8deadSopenharmony_ci
15975bd8deadSopenharmony_ci      (Add to the end of the "Shader Interface Matching" section)
15985bd8deadSopenharmony_ci
15995bd8deadSopenharmony_ci      When using vertex or fragment shaders with version 140 or lower in
16005bd8deadSopenharmony_ci      separable programs, the language doesn't support input and output blocks
16015bd8deadSopenharmony_ci      or redeclaration of gl_PerVertex or gl_PerFragment.  In such cases, an
16025bd8deadSopenharmony_ci      implicit block redeclaration is formed from the set of vertex shader
16035bd8deadSopenharmony_ci      outputs or fragment shader inputs redeclared according to Section 7.7 of
16045bd8deadSopenharmony_ci      the OpenGL Shading Language Specification.  The order of individual
16055bd8deadSopenharmony_ci      variable redeclarations does not affect the resulting implicit block
16065bd8deadSopenharmony_ci      redeclaration.  The block matching rules described above are then
16075bd8deadSopenharmony_ci      applied to such implicit block redeclarations.  Note that an implicit
16085bd8deadSopenharmony_ci      block redeclaration is never considered to match with an explicit block
16095bd8deadSopenharmony_ci      redeclaration.
16105bd8deadSopenharmony_ci
16115bd8deadSopenharmony_ci
16125bd8deadSopenharmony_ciDependencies on ARB_geometry_shader4, EXT_geometry_shader4, NV_geometry_-
16135bd8deadSopenharmony_cishader4, and/or OpenGL version 3.2
16145bd8deadSopenharmony_ci
16155bd8deadSopenharmony_ci    If none of ARB_geometry_shader4, EXT_geometry_shader4, NV_geometry_-
16165bd8deadSopenharmony_ci    shader4, or OpenGL 3.2 are supported by the implementation, ignore
16175bd8deadSopenharmony_ci    all references to geometry shaders and generate an INVALID_ENUM
16185bd8deadSopenharmony_ci    error when UseProgramStages is called with GEOMETRY_SHADER_BIT
16195bd8deadSopenharmony_ci    set in <stages>.
16205bd8deadSopenharmony_ci
16215bd8deadSopenharmony_ciDependencies on ARB_tessellation_shader and OpenGL 4.0
16225bd8deadSopenharmony_ci
16235bd8deadSopenharmony_ci    If ARB_tessellation_shader and OpenGL 4.0 are not supported by the
16245bd8deadSopenharmony_ci    implementation, ignore references to tessellation control and evaluation
16255bd8deadSopenharmony_ci    shaders and generate an INVALID_ENUM error when UseProgramStages is called
16265bd8deadSopenharmony_ci    with TESS_CONTROL_SHADER_BIT or TESS_EVALUTAION_SHADER_BIT is set in
16275bd8deadSopenharmony_ci    <stages>.
16285bd8deadSopenharmony_ci
16295bd8deadSopenharmony_ciDependencies on ARB_gpu_shader_fp64 and OpenGL 4.0
16305bd8deadSopenharmony_ci
16315bd8deadSopenharmony_ci    If ARB_gpu_shader_fp64 and OpenGL 4.0 are not supported by the
16325bd8deadSopenharmony_ci    implementation, ignore references to double sized uniforms including
16335bd8deadSopenharmony_ci    ProgramUniform* calls with a 'd' suffix.  Additionally, references to
16345bd8deadSopenharmony_ci    double-precision GLSL variable types should be removed.
16355bd8deadSopenharmony_ci
16365bd8deadSopenharmony_ciDependencies on ARB_explicit_attrib_location, ARB_vertex_attrib_64bit, OpenGL
16375bd8deadSopenharmony_ci3.3, and OpenGL 4.1
16385bd8deadSopenharmony_ci
16395bd8deadSopenharmony_ci    If ARB_explicit_attrib_location (or OpenGL 3.3) is supported, vertex
16405bd8deadSopenharmony_ci    shader input variables (including ones with double-precision components)
16415bd8deadSopenharmony_ci    can select associated generic attributes with an explicit location layout
16425bd8deadSopenharmony_ci    qualifier in lieu of calling BindAttribLocation.  If
16435bd8deadSopenharmony_ci    ARB_vertex_attrib_64bit (or OpenGL 4.1) is supported, vertex shader inputs
16445bd8deadSopenharmony_ci    can use types with double-precision components.
16455bd8deadSopenharmony_ci
16465bd8deadSopenharmony_ci    When these extensions are supported, there are special rules for the
16475bd8deadSopenharmony_ci    number of locations consumed by "dvec3" and "dvec4" types, which require
16485bd8deadSopenharmony_ci    more storage than is available in a four-component single-precision
16495bd8deadSopenharmony_ci    vector.  The rules are:
16505bd8deadSopenharmony_ci
16515bd8deadSopenharmony_ci      * dvec3/dvec4 vertex inputs consume one location (generic vertex
16525bd8deadSopenharmony_ci        attribute), but can count as two vectors for the purposes of
16535bd8deadSopenharmony_ci        determining if the vertex shader consumes too many inputs
16545bd8deadSopenharmony_ci
16555bd8deadSopenharmony_ci      * dvec3/dvec4 inputs and outputs for other stages consume two locations
16565bd8deadSopenharmony_ci
16575bd8deadSopenharmony_ci    The relevant spec edits (modifying language introduced by
16585bd8deadSopenharmony_ci    ARB_explicit_attrib_location) can be found in this extension.
16595bd8deadSopenharmony_ci
16605bd8deadSopenharmony_ciDependencies on EXT_separate_shader_objects
16615bd8deadSopenharmony_ci
16625bd8deadSopenharmony_ci    This extension provides program pipeline objects, to which separable
16635bd8deadSopenharmony_ci    program objects can be attached via UseProgramStages (for rendering) and
16645bd8deadSopenharmony_ci    ActiveShaderProgram (for uniform updates).  A single pipeline object can
16655bd8deadSopenharmony_ci    be bound via BindProgramPipeline.  The programs attached to the bound
16665bd8deadSopenharmony_ci    pipeline object are used unless a non-separable object is made current via
16675bd8deadSopenharmony_ci    UseProgram.  Effectively UseProgram has a higher priority than
16685bd8deadSopenharmony_ci    BindProgramPipeline.
16695bd8deadSopenharmony_ci
16705bd8deadSopenharmony_ci    EXT_separate_shader_objects does something very similar, but without
16715bd8deadSopenharmony_ci    pipeline objects.  Instead, the single program attachment point set by
16725bd8deadSopenharmony_ci    UseProgram is replaced by an array of attachment points updated by
16735bd8deadSopenharmony_ci    UseShaderProgramEXT and ActiveProgramEXT.  UseProgram is redefined
16745bd8deadSopenharmony_ci    to update all attachment points.  This collection of attachment points is
16755bd8deadSopenharmony_ci    functionally equivalent to the program pipeline object in this extension,
16765bd8deadSopenharmony_ci    and can be thought of as a special pipeline object.
16775bd8deadSopenharmony_ci
16785bd8deadSopenharmony_ci    If both extensions are supported, the rule giving priority to UseProgram
16795bd8deadSopenharmony_ci    over pipeline objects needs to be updated, given that the single
16805bd8deadSopenharmony_ci    UseProgram binding point is replaced by a collection of binding points.
16815bd8deadSopenharmony_ci    We effectively treat this collection of binding points as another pipeline
16825bd8deadSopenharmony_ci    object, and treat that object as higher priority if it has a program
16835bd8deadSopenharmony_ci    attached to *any* attachment point.  The priority rules in this spec are
16845bd8deadSopenharmony_ci    rewritten as follows:
16855bd8deadSopenharmony_ci
16865bd8deadSopenharmony_ci      The executable code for an individual shader stage is taken from the
16875bd8deadSopenharmony_ci      current program for that stage.  If there is a current program object
16885bd8deadSopenharmony_ci      for any shader stage or for uniform updates established by UseProgram,
16895bd8deadSopenharmony_ci      UseShaderProgramEXT, or ActiveProgramEXT, the current program for that
16905bd8deadSopenharmony_ci      stage (if any) is considered current.  Otherwise, if there is a bound
16915bd8deadSopenharmony_ci      program pipeline object ...
16925bd8deadSopenharmony_ci
16935bd8deadSopenharmony_ci    Note that with these rules, it's not possible to mix program objects bound
16945bd8deadSopenharmony_ci    to the context with program objects bound to a program pipeline object; if
16955bd8deadSopenharmony_ci    any program is bound to the context, the current pipeline object is
16965bd8deadSopenharmony_ci    ignored.
16975bd8deadSopenharmony_ci
16985bd8deadSopenharmony_ciDependencies on ARB_vertex_program, ARB_fragment_program, NV_gpu_program4, and
16995bd8deadSopenharmony_cirelated assembly extensions
17005bd8deadSopenharmony_ci
17015bd8deadSopenharmony_ci    On implementations supporting both GLSL and assembly programmability, it
17025bd8deadSopenharmony_ci    is necessary to make a determination of what executable code (if any) is
17035bd8deadSopenharmony_ci    run in each program stage.  The logic for determining the active
17045bd8deadSopenharmony_ci    executable is as follows:
17055bd8deadSopenharmony_ci
17065bd8deadSopenharmony_ci      * If there is an active GLSL program for the stage, either from a
17075bd8deadSopenharmony_ci        program bound by UseProgram or from a program bound to the active
17085bd8deadSopenharmony_ci        program pipeline object, that program's executable will be used.
17095bd8deadSopenharmony_ci
17105bd8deadSopenharmony_ci      * Otherwise, the bound assembly program from this stage will be used if
17115bd8deadSopenharmony_ci        enabled.
17125bd8deadSopenharmony_ci
17135bd8deadSopenharmony_ci      * Otherwise, the stage will be skipped (tessellation control,
17145bd8deadSopenharmony_ci        evaluation, and geometry), fixed function vertex or fragment
17155bd8deadSopenharmony_ci        processing will be used (compatibility profile), or undefined results
17165bd8deadSopenharmony_ci        will occur (core profile).
17175bd8deadSopenharmony_ci
17185bd8deadSopenharmony_ci    This is the same behavior present without this extension; the only
17195bd8deadSopenharmony_ci    difference is that active GLSL programs are determined on a stage-by-stage
17205bd8deadSopenharmony_ci    basis with this extension.
17215bd8deadSopenharmony_ci
17225bd8deadSopenharmony_ciNew State
17235bd8deadSopenharmony_ci
17245bd8deadSopenharmony_ci    Add to Table 6.45 (Program Object State):
17255bd8deadSopenharmony_ci
17265bd8deadSopenharmony_ci    Get Value            Type  Get Command           Initial Value  Description               Sec      Attribute
17275bd8deadSopenharmony_ci    -------------------  ----  --------------------  -------------  ------------------------  ------   ---------
17285bd8deadSopenharmony_ci    ACTIVE_PROGRAM         Z+  GetProgramPipelineiv  0              The program object        2.20.2   -
17295bd8deadSopenharmony_ci                                                                    that Uniform* commands
17305bd8deadSopenharmony_ci                                                                    update when PPO bound
17315bd8deadSopenharmony_ci    VERTEX_SHADER          Z+  GetProgramPipelineiv  0              Name of current vertex    2.20.2   -
17325bd8deadSopenharmony_ci                                                                    shader program object
17335bd8deadSopenharmony_ci    GEOMETRY_SHADER        Z+  GetProgramPipelineiv  0              Name of current geometry  2.20.2   -
17345bd8deadSopenharmony_ci                                                                    shader program object
17355bd8deadSopenharmony_ci    FRAGMENT_SHADER        Z+  GetProgramPipelineiv  0              Name of current fragment  2.20.2   -
17365bd8deadSopenharmony_ci                                                                    shader program object
17375bd8deadSopenharmony_ci    TESS_CONTROL_SHADER    Z+  GetProgramPipelineiv  0              Name of current tessell-  2.20.2   -
17385bd8deadSopenharmony_ci                                                                    ation control shader
17395bd8deadSopenharmony_ci                                                                    program object
17405bd8deadSopenharmony_ci    TESS_EVALUATION_SHADER Z+  GetProgramPipelineiv  0              Name of current tessell-  2.20.2   -
17415bd8deadSopenharmony_ci                                                                    ation evaluation shader
17425bd8deadSopenharmony_ci                                                                    program object
17435bd8deadSopenharmony_ci    VALIDATE_STATUS        B   GetProgramPipelineiv  FALSE          Validate status of        2.14.8   -
17445bd8deadSopenharmony_ci                                                                    program pipeline object
17455bd8deadSopenharmony_ci    PROGRAM_PIPELINE_-     Z+  GetIntegerv           0              Current program pipeline  2.14.PPO - 
17465bd8deadSopenharmony_ci    BINDING                                                         object binding
17475bd8deadSopenharmony_ci                                                    
17485bd8deadSopenharmony_ciNew Implementation Dependent State
17495bd8deadSopenharmony_ci
17505bd8deadSopenharmony_ci    None
17515bd8deadSopenharmony_ci
17525bd8deadSopenharmony_ciIssues
17535bd8deadSopenharmony_ci
17545bd8deadSopenharmony_ci    1.  What should this extension be called?
17555bd8deadSopenharmony_ci
17565bd8deadSopenharmony_ci        RESOLVED:  ARB_separate_shader_objects
17575bd8deadSopenharmony_ci
17585bd8deadSopenharmony_ci        The adjective "separate" is used in several extension names
17595bd8deadSopenharmony_ci        (EXT_blend_equation_separate, EXT_blend_func_separate,
17605bd8deadSopenharmony_ci        EXT_separate_specular_color, ATI_separate_stencil) when joined
17615bd8deadSopenharmony_ci        state is made configurable separately.
17625bd8deadSopenharmony_ci
17635bd8deadSopenharmony_ci        The phrase "shader_objects" refers generally to GLSL shader
17645bd8deadSopenharmony_ci        objects, matching the ARB_shader_objects name.
17655bd8deadSopenharmony_ci
17665bd8deadSopenharmony_ci        Whether the name should be "separate_shader_objects"
17675bd8deadSopenharmony_ci        or "shader_objects_separate" is less clear.  The various
17685bd8deadSopenharmony_ci        "separate" extensions have different conventions as to whether
17695bd8deadSopenharmony_ci        separate is prefixed or suffixed with the separated state.
17705bd8deadSopenharmony_ci        The prefixed form is more natural to say aloud, is consistent
17715bd8deadSopenharmony_ci        with the ATI_separate_stencil naming approach, and abbreviates
17725bd8deadSopenharmony_ci        to SSO (instead of the inopportune abbreviation SOS).
17735bd8deadSopenharmony_ci
17745bd8deadSopenharmony_ci        The ability to use monolithic program objects that might be more
17755bd8deadSopenharmony_ci        optimized with individual shader program objects makes this name
17765bd8deadSopenharmony_ci        a little less appropriate.
17775bd8deadSopenharmony_ci
17785bd8deadSopenharmony_ci    1a. How is the extension different from the prior EXT version?
17795bd8deadSopenharmony_ci
17805bd8deadSopenharmony_ci        RESOLVED:  The ARB extension is a strict superset adding:
17815bd8deadSopenharmony_ci
17825bd8deadSopenharmony_ci           *   tessellation interactions, and
17835bd8deadSopenharmony_ci
17845bd8deadSopenharmony_ci           *   GLSL language additions for layout qualifiers to support
17855bd8deadSopenharmony_ci               rendezous-by-API-resource and rendezous-by-structure-offset
17865bd8deadSopenharmony_ci               cross-stage interfacing.
17875bd8deadSopenharmony_ci
17885bd8deadSopenharmony_ci           *   A container program pipeline object to bind separate
17895bd8deadSopenharmony_ci               programs to rather than to the context directly.
17905bd8deadSopenharmony_ci
17915bd8deadSopenharmony_ci           *  Support for transform feedback interactions.
17925bd8deadSopenharmony_ci
17935bd8deadSopenharmony_ci           *  CreateShaderProgramv takes multiple strings to better
17945bd8deadSopenharmony_ci              match ShaderSource
17955bd8deadSopenharmony_ci
17965bd8deadSopenharmony_ci           *  More. . . 
17975bd8deadSopenharmony_ci
17985bd8deadSopenharmony_ci    2.  What happens to a user-defined input varying variable that are
17995bd8deadSopenharmony_ci        not written by a preceding shader's write to the corresponding
18005bd8deadSopenharmony_ci        output varying variable.
18015bd8deadSopenharmony_ci
18025bd8deadSopenharmony_ci        RESOLVED:  The input variable variable's value is left undefined.
18035bd8deadSopenharmony_ci        Implementations are encouraged but not required to zero the
18045bd8deadSopenharmony_ci        value.
18055bd8deadSopenharmony_ci
18065bd8deadSopenharmony_ci        GLSL has a "rendezvous by name" model for connecting varying
18075bd8deadSopenharmony_ci        output variables to varying input variables of a subsequent
18085bd8deadSopenharmony_ci        shader.  With separate shaders, there's no assurance whether a
18095bd8deadSopenharmony_ci        preceding shader will write a given user-defined input varying
18105bd8deadSopenharmony_ci        variable.  HLSL9, Cg, and OpenGL assembly extension programs
18115bd8deadSopenharmony_ci        handle this situation by with "rendezvous by API resource" model.
18125bd8deadSopenharmony_ci        In GLSL terms, this means separate GLSL shaders /must/ communicate
18135bd8deadSopenharmony_ci        by built-in varying variables rather than user-defined varying
18145bd8deadSopenharmony_ci        variables.
18155bd8deadSopenharmony_ci
18165bd8deadSopenharmony_ci        It is undesirable from a performance standpoint to attempt to
18175bd8deadSopenharmony_ci        support "rendezvous by name" for arbitrary separate shaders
18185bd8deadSopenharmony_ci        because the separate shaders won't be naturally compiled to
18195bd8deadSopenharmony_ci        match their varying inputs and outputs of the same name without
18205bd8deadSopenharmony_ci        a special link step.  Such a special link would introduce an
18215bd8deadSopenharmony_ci        extra validation overhead to binding separate shaders.  The link
18225bd8deadSopenharmony_ci        itself would have to be deferred until glBegin time since separate
18235bd8deadSopenharmony_ci        shaders won't match when transitioning from one set of consistent
18245bd8deadSopenharmony_ci        shaders to another.  This special link would still create errors
18255bd8deadSopenharmony_ci        or undefined behavior when the names of input and output varyings
18265bd8deadSopenharmony_ci        matched but their types did not match.
18275bd8deadSopenharmony_ci
18285bd8deadSopenharmony_ci        Also the expectation from other shading APIs that support
18295bd8deadSopenharmony_ci        mix-and-match shader usage is that "rendezvous by API resource"
18305bd8deadSopenharmony_ci        is the expected norm.
18315bd8deadSopenharmony_ci
18325bd8deadSopenharmony_ci        Specifying the behavior being undefined allows a future ARB
18335bd8deadSopenharmony_ci        version of this extension to be more specific without encumbering
18345bd8deadSopenharmony_ci        this extension with enforcing a specific error.
18355bd8deadSopenharmony_ci
18365bd8deadSopenharmony_ci    3.  Do different program objects currently used by different shader
18375bd8deadSopenharmony_ci        types share a single name space for uniforms?
18385bd8deadSopenharmony_ci
18395bd8deadSopenharmony_ci        RESOLVED:  No, different program objects have their own separate
18405bd8deadSopenharmony_ci        name space for uniforms and each has locations specific to its
18415bd8deadSopenharmony_ci        unique program object.
18425bd8deadSopenharmony_ci
18435bd8deadSopenharmony_ci    4.  How do the glUniform* commands determine what program object
18445bd8deadSopenharmony_ci        to query?
18455bd8deadSopenharmony_ci
18465bd8deadSopenharmony_ci        RESOLVED:  In a program pipeline object, this extension provides
18475bd8deadSopenharmony_ci        separate program binding points for each stage, as well as an "active"
18485bd8deadSopenharmony_ci        program specified by glActiveShaderProgram.  When glUniform is called
18495bd8deadSopenharmony_ci        when a program pipeline object is active, the active program specifies
18505bd8deadSopenharmony_ci        the program used by glUniform* commands.  This active program is
18515bd8deadSopenharmony_ci        simply a selector and doesn't actually control any rendering
18525bd8deadSopenharmony_ci        operation.
18535bd8deadSopenharmony_ci
18545bd8deadSopenharmony_ci        The active program can be queried with glGetProgramPipelineiv with a
18555bd8deadSopenharmony_ci        <pname> of GL_ACTIVE_PROGRAM.
18565bd8deadSopenharmony_ci
18575bd8deadSopenharmony_ci        When a non-zero program is passed to UseProgram, any subsequent
18585bd8deadSopenharmony_ci        uniform updates will affect that program, ignoring the active program
18595bd8deadSopenharmony_ci        in any bound pipeline object.  For example:
18605bd8deadSopenharmony_ci
18615bd8deadSopenharmony_ci          glUseProgram(0);
18625bd8deadSopenharmony_ci          glBindProgramPipeline(1);
18635bd8deadSopenharmony_ci          glActiveProgram(1, 2);
18645bd8deadSopenharmony_ci          glUniform1f(0, 3.0);          // affects program 2
18655bd8deadSopenharmony_ci          glUseProgram(3);
18665bd8deadSopenharmony_ci          glUniform1f(0, 3.0);          // affects program 3
18675bd8deadSopenharmony_ci          glUseProgram(0);
18685bd8deadSopenharmony_ci          glUniform1f(0, 3.0);          // affects program 2
18695bd8deadSopenharmony_ci
18705bd8deadSopenharmony_ci
18715bd8deadSopenharmony_ci        As an alternative to setting the GL_ACTIVE_PROGRAM selector
18725bd8deadSopenharmony_ci        with glActiveShaderProgram, applications are instead encouraged
18735bd8deadSopenharmony_ci        to use the glProgramUniform* commands introduced by the
18745bd8deadSopenharmony_ci        EXT_direct_state_access extension which do not depend on a
18755bd8deadSopenharmony_ci        selector but specify the program object with which to update
18765bd8deadSopenharmony_ci        the specified uniform location explicitly.
18775bd8deadSopenharmony_ci
18785bd8deadSopenharmony_ci    5.  Do the glGetUniform* queries depend on the active program state
18795bd8deadSopenharmony_ci        (GL_ACTIVE_PROGRAM)?
18805bd8deadSopenharmony_ci
18815bd8deadSopenharmony_ci        RESOLVED:  No, the glGetUniform* queries take the program
18825bd8deadSopenharmony_ci        object for the query as an explicit parameter to the query.
18835bd8deadSopenharmony_ci        These queries do not rely on a selector.  In other words, the
18845bd8deadSopenharmony_ci        uniform queries are always selector-free.
18855bd8deadSopenharmony_ci
18865bd8deadSopenharmony_ci    6a. Should the fragment shader program object be allowed to changed
18875bd8deadSopenharmony_ci        within transform feedback mode?
18885bd8deadSopenharmony_ci
18895bd8deadSopenharmony_ci        RESOLVED:  No, this should generate a GL_INVALID_OPERATION error.
18905bd8deadSopenharmony_ci
18915bd8deadSopenharmony_ci        The OpenGL 3.0 and EXT_transform_feedback specifications say
18925bd8deadSopenharmony_ci        glUseProgram generates a GL_INVALID_OPERATION error when transform
18935bd8deadSopenharmony_ci        feedback is active.
18945bd8deadSopenharmony_ci
18955bd8deadSopenharmony_ci        The rationale for this is that user-defined varying outputs from
18965bd8deadSopenharmony_ci        the vertex or geometry shader might change.
18975bd8deadSopenharmony_ci
18985bd8deadSopenharmony_ci        Perhaps it is desirable to allow different shader program objects
18995bd8deadSopenharmony_ci        when transform feedback mode is active, but this extension
19005bd8deadSopenharmony_ci        doesn't change the existing GLSL error behavior.  In fact,
19015bd8deadSopenharmony_ci        glUseProgramStages generate the same error glUseProgram does.
19025bd8deadSopenharmony_ci
19035bd8deadSopenharmony_ci    6b. Should the active program be allowed to changed within transform
19045bd8deadSopenharmony_ci        feedback mode?
19055bd8deadSopenharmony_ci
19065bd8deadSopenharmony_ci        RESOLVED:  Yes.
19075bd8deadSopenharmony_ci
19085bd8deadSopenharmony_ci        The active program simply allows uniforms to be changed but
19095bd8deadSopenharmony_ci        doesn't actually change how the graphics pipeline itself is
19105bd8deadSopenharmony_ci        configured or what programs are used for vertex, geometry,
19115bd8deadSopenharmony_ci        and fragment processing.
19125bd8deadSopenharmony_ci
19135bd8deadSopenharmony_ci    7.  What happens if you have a program object current for a shader stage,
19145bd8deadSopenharmony_ci        but the program object doesn't contain an executable for that stage?
19155bd8deadSopenharmony_ci
19165bd8deadSopenharmony_ci        RESOLVED:  This is not an error; instead it is as though there were no
19175bd8deadSopenharmony_ci        program bound to that stage.  We have two different notions for
19185bd8deadSopenharmony_ci        programs bound to shader stages.  A program is "current" for a stage
19195bd8deadSopenharmony_ci        if it bound to that stage in the active program pipeline object.  A
19205bd8deadSopenharmony_ci        program is "active" for a stage if it is current and it has an
19215bd8deadSopenharmony_ci        executable for this stage.  In this case, the program would be current
19225bd8deadSopenharmony_ci        but not active.
19235bd8deadSopenharmony_ci
19245bd8deadSopenharmony_ci        When no program is active for a stage, the stage will be replaced with
19255bd8deadSopenharmony_ci        fixed functionality logic (compatibility profile vertex and fragment),
19265bd8deadSopenharmony_ci        disabled (tessellation control and evaluation, geometry), or have
19275bd8deadSopenharmony_ci        undefined results (core profile vertex and fragment).
19285bd8deadSopenharmony_ci
19295bd8deadSopenharmony_ci        Support for programs that are current but not active is intentional
19305bd8deadSopenharmony_ci        behavior.  Consider an example where an application wants to use two
19315bd8deadSopenharmony_ci        different types of separate program object -- one for all types of
19325bd8deadSopenharmony_ci        vertex processing and a second for fragment processing.  Some of the
19335bd8deadSopenharmony_ci        vertex pipe programs might include tessellation or geometry shaders;
19345bd8deadSopenharmony_ci        others might only include a vertex shader.  With this configuration,
19355bd8deadSopenharmony_ci        the application can use code like the following:
19365bd8deadSopenharmony_ci
19375bd8deadSopenharmony_ci          #define GL_ALL_VERTEX_PIPE_SHADER_BITS   \
19385bd8deadSopenharmony_ci              (GL_VERTEX_SHADER_BIT             |  \
19395bd8deadSopenharmony_ci               GL_TESS_CONTROL_SHADER_BIT       |  \
19405bd8deadSopenharmony_ci               GL_TESS_EVALUATION_SHADER_BIT    |  \
19415bd8deadSopenharmony_ci               GL_GEOMETRY_SHADER_BIT)
19425bd8deadSopenharmony_ci
19435bd8deadSopenharmony_ci          glUseProgramStages(pipeline, GL_ALL_VERTEX_PIPE_SHADER_BITS,
19445bd8deadSopenharmony_ci                             vertex_pipe_program);
19455bd8deadSopenharmony_ci          glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT,
19465bd8deadSopenharmony_ci                             fragment_pipe_program);
19475bd8deadSopenharmony_ci
19485bd8deadSopenharmony_ci        Such code wouldn't have to determine if <vertex_pipe_program> has
19495bd8deadSopenharmony_ci        tessellation or geometry shaders.  Instead, it simply sets all
19505bd8deadSopenharmony_ci        possible bits, which removes the old program from all non-fragment
19515bd8deadSopenharmony_ci        stages.  For stages not present in the new program, the program will
19525bd8deadSopenharmony_ci        be current but not active, and it will be as though no program were
19535bd8deadSopenharmony_ci        bound to such stages.
19545bd8deadSopenharmony_ci
19555bd8deadSopenharmony_ci    8a.  What happens if a linked program object with multiple stages (e.g.,
19565bd8deadSopenharmony_ci         vertex and fragment) is active on those stages, but there is a second
19575bd8deadSopenharmony_ci         program active in stages between the first and last stages of that
19585bd8deadSopenharmony_ci         program (e.g., a geometry-only program)?
19595bd8deadSopenharmony_ci
19605bd8deadSopenharmony_ci        RESOLVED:  Such a configuration will result in a draw-time validation
19615bd8deadSopenharmony_ci        error.  We allow the linker to perform internal optimizations on the
19625bd8deadSopenharmony_ci        interfaces between stages of a multi-stage program object.  For a
19635bd8deadSopenharmony_ci        vertex-fragment program, the vertex shader outputs can be optimized to
19645bd8deadSopenharmony_ci        pass along only those outputs needed as fragment shader inputs.  Such
19655bd8deadSopenharmony_ci        a shader would not necessarily be set up to successfully pass those
19665bd8deadSopenharmony_ci        outputs to a separate geometry-only program, even if the declared
19675bd8deadSopenharmony_ci        vertex outputs would naturally match up with the declared geometry
19685bd8deadSopenharmony_ci        inputs.
19695bd8deadSopenharmony_ci
19705bd8deadSopenharmony_ci    8b.  What happens if a linked program object with multiple stages is
19715bd8deadSopenharmony_ci         active on some of its stages, but not on others?
19725bd8deadSopenharmony_ci
19735bd8deadSopenharmony_ci         RESOLVED:  Such a configuration would result in a draw-time
19745bd8deadSopenharmony_ci         validation error.  Consider a program with vertex and fragment
19755bd8deadSopenharmony_ci         shaders, where the interface between stages is optimized as in the
19765bd8deadSopenharmony_ci         previous example.  If the vertex shader from this program were to be
19775bd8deadSopenharmony_ci         used with a separate fragment-only program instead of the program's
19785bd8deadSopenharmony_ci         fragment shader, the optimized vertex outputs wouldn't necessarily
19795bd8deadSopenharmony_ci         match the inputs from the second program, even if the set of
19805bd8deadSopenharmony_ci         variables on that interface were compatible.
19815bd8deadSopenharmony_ci
19825bd8deadSopenharmony_ci    9.  Is glUseProgramStages allowed to be compiled within a
19835bd8deadSopenharmony_ci        display list?
19845bd8deadSopenharmony_ci
19855bd8deadSopenharmony_ci        RESOLVED:  Yes, just like glUseProgram is allowed within a
19865bd8deadSopenharmony_ci        display list.
19875bd8deadSopenharmony_ci
19885bd8deadSopenharmony_ci    10. Should there be some easier to use API for creating a GLSL
19895bd8deadSopenharmony_ci        program that programs a single shader type?
19905bd8deadSopenharmony_ci
19915bd8deadSopenharmony_ci        RESOLVED:  Yes, see the glCreateShaderProgram command.
19925bd8deadSopenharmony_ci
19935bd8deadSopenharmony_ci        The existing GLSL API for creating a GLSL program involves a lot
19945bd8deadSopenharmony_ci        of steps to support multiple source strings, re-specification of
19955bd8deadSopenharmony_ci        source code, attaching and detaching multiple shader objects,
19965bd8deadSopenharmony_ci        and cross-stage linking.  These features are not particularly
19975bd8deadSopenharmony_ci        relevant for creating separate shader programs.
19985bd8deadSopenharmony_ci
19995bd8deadSopenharmony_ci    11. Can glCreateShaderProgram be compiled into a display list?
20005bd8deadSopenharmony_ci
20015bd8deadSopenharmony_ci        RESOLVED:  No.
20025bd8deadSopenharmony_ci
20035bd8deadSopenharmony_ci        glCreateShaderProgram is equivalent to a sequence of commands
20045bd8deadSopenharmony_ci        that are themselves not allowed to be compiled  into a display
20055bd8deadSopenharmony_ci        list.
20065bd8deadSopenharmony_ci
20075bd8deadSopenharmony_ci    12. Should glCreateShaderProgram allow user-defined varyings?
20085bd8deadSopenharmony_ci
20095bd8deadSopenharmony_ci        RESOLVED:  Yes.  However, to get defined results when passing
20105bd8deadSopenharmony_ci        varying values between separate programs, applications are
20115bd8deadSopenharmony_ci        required to match inputs to outputs. This matching can be
20125bd8deadSopenharmony_ci        achieved either with the "location" layout qualifier, or by
20135bd8deadSopenharmony_ci        declaring the exact same set of inputs and outputs in the adjacent
20145bd8deadSopenharmony_ci        shader stages.
20155bd8deadSopenharmony_ci
20165bd8deadSopenharmony_ci
20175bd8deadSopenharmony_ci    13. How are interpolation modifiers handled for separate shader
20185bd8deadSopenharmony_ci        programs?
20195bd8deadSopenharmony_ci
20205bd8deadSopenharmony_ci        RESOLVED:  GLSL only provides interpolation modifiers for user-
20215bd8deadSopenharmony_ci        defined varyings. These modifiers can be used in conjunction
20225bd8deadSopenharmony_ci        with the layout location qualifiers specified in this extension.
20235bd8deadSopenharmony_ci        Such modifiers must match.
20245bd8deadSopenharmony_ci
20255bd8deadSopenharmony_ci    14. Should glLinkProgram work to re-link a shader created with
20265bd8deadSopenharmony_ci        glCreateShaderProgram?
20275bd8deadSopenharmony_ci
20285bd8deadSopenharmony_ci        RESOLVED: NO because the shader created by glCreateShaderProgram
20295bd8deadSopenharmony_ci        is detached and deleted as part of the glCreateShaderProgram
20305bd8deadSopenharmony_ci        sequence.  This means if you call glLinkProgram on a program
20315bd8deadSopenharmony_ci        returned from glCreateShaderProgram, you'll find the re-link
20325bd8deadSopenharmony_ci        fails because no shader object is attached.
20335bd8deadSopenharmony_ci
20345bd8deadSopenharmony_ci        An application is free to attach one or more new shader objects
20355bd8deadSopenharmony_ci        to the program and then relink would work.
20365bd8deadSopenharmony_ci
20375bd8deadSopenharmony_ci        This is fine because re-linking isn't necessary/expected.
20385bd8deadSopenharmony_ci
20395bd8deadSopenharmony_ci    15. Wouldn't re-linking be necessary if the application wanted to
20405bd8deadSopenharmony_ci        use glBindAttribLocation to assign a user-defined attribute to
20415bd8deadSopenharmony_ci        a specific vertex attribute?
20425bd8deadSopenharmony_ci
20435bd8deadSopenharmony_ci        RESOLVED:  Yes and that's a problem if glCreateShaderProgram
20445bd8deadSopenharmony_ci        is used because the shader object is detached and deleted.
20455bd8deadSopenharmony_ci
20465bd8deadSopenharmony_ci        User-defined attributes will work when glCreateShaderProgram
20475bd8deadSopenharmony_ci        is used to easily create a vertex shader program, but the
20485bd8deadSopenharmony_ci        application must be satisfied with the implementation-dependent
20495bd8deadSopenharmony_ci        linker-assigned user-defined attributes returned by
20505bd8deadSopenharmony_ci        glGetAttribLocation.
20515bd8deadSopenharmony_ci
20525bd8deadSopenharmony_ci        We could provide a new set of built-in attributes that correspond
20535bd8deadSopenharmony_ci        to declared as:
20545bd8deadSopenharmony_ci
20555bd8deadSopenharmony_ci            attribute vec4 gl_VertexAttrib[];
20565bd8deadSopenharmony_ci
20575bd8deadSopenharmony_ci        How would these attributes map to the other built-in attributes?  That
20585bd8deadSopenharmony_ci        would depend on the implementation.  As with ARB_vertex_program, some
20595bd8deadSopenharmony_ci        implementations could choose to alias such generate vertex attributes
20605bd8deadSopenharmony_ci        with conventional vertex attributes (color, fog coord, etc.) or an
20615bd8deadSopenharmony_ci        implementation could treat the generic attributes as disjoint from the
20625bd8deadSopenharmony_ci        conventional vertex attributes.
20635bd8deadSopenharmony_ci
20645bd8deadSopenharmony_ci        If this is unsatisfactory, the solution is to avoid using
20655bd8deadSopenharmony_ci        glCreateShaderProgram and instead use the traditional GLSL
20665bd8deadSopenharmony_ci        approach for creating programs (create shader, compile shader,
20675bd8deadSopenharmony_ci        attach shader, bind attributes, link shader, use shader).
20685bd8deadSopenharmony_ci
20695bd8deadSopenharmony_ci        Demonstrating how to workaround this particular issue, here's
20705bd8deadSopenharmony_ci        an example of creating and using a vertex shader for use with
20715bd8deadSopenharmony_ci        separate shader objects that includes explicit binding of output
20725bd8deadSopenharmony_ci        varyings to fragment data locations.  First the shader:
20735bd8deadSopenharmony_ci        
20745bd8deadSopenharmony_ci          varying in vec4 attribA;
20755bd8deadSopenharmony_ci          varying in vec4 attribB;
20765bd8deadSopenharmony_ci          void main()
20775bd8deadSopenharmony_ci          {
20785bd8deadSopenharmony_ci            gl_Position = ftransform();
20795bd8deadSopenharmony_ci            gl_FrontColor = attribA;
20805bd8deadSopenharmony_ci            gl_BackColor = attribB;
20815bd8deadSopenharmony_ci          }
20825bd8deadSopenharmony_ci          
20835bd8deadSopenharmony_ci        Now creating and using a linked program from this shader where
20845bd8deadSopenharmony_ci        attribA is initialized by vertex attribute 5 and attribB is
20855bd8deadSopenharmony_ci        initialized by vertex attribute 7.
20865bd8deadSopenharmony_ci
20875bd8deadSopenharmony_ci          GLuint ppo;
20885bd8deadSopenharmony_ci          GenProgramPipelines(1, &ppo);
20895bd8deadSopenharmony_ci          BindProgramPipeline(ppo);
20905bd8deadSopenharmony_ci          const GLuint shader = glCreateShader(GL_VERTEX_SHADER);
20915bd8deadSopenharmony_ci          if (shader) {
20925bd8deadSopenharmony_ci            const GLint len = (GLint) strlen(aboveShaderString);
20935bd8deadSopenharmony_ci            glShaderSource(shader, 1, &aboveShaderString, &len);
20945bd8deadSopenharmony_ci            glCompileShader(shader);
20955bd8deadSopenharmony_ci            const uint program = glCreateProgram();
20965bd8deadSopenharmony_ci            if (program) {
20975bd8deadSopenharmony_ci              GLint compiled = FALSE;
20985bd8deadSopenharmony_ci              glGetShaderiv(shader, COMPILE_STATUS, &compiled);
20995bd8deadSopenharmony_ci              if (compiled) {
21005bd8deadSopenharmony_ci                glAttachShader(program, shader);
21015bd8deadSopenharmony_ci
21025bd8deadSopenharmony_ci                // Crucial code that glCreateShaderProgram doesn't do
21035bd8deadSopenharmony_ci                glBindAttribLocation(program, 5, "attribA");
21045bd8deadSopenharmony_ci                glBindAttribLocation(program, 7, "attribB");
21055bd8deadSopenharmony_ci
21065bd8deadSopenharmony_ci                glLinkProgram(program);
21075bd8deadSopenharmony_ci                glDetachShader(program, shader);
21085bd8deadSopenharmony_ci
21095bd8deadSopenharmony_ci                // Show this program can actually be used as a vertex shader
21105bd8deadSopenharmony_ci                glUseProgramStages(GL_VERTEX_SHADER, program);
21115bd8deadSopenharmony_ci              }
21125bd8deadSopenharmony_ci            }
21135bd8deadSopenharmony_ci            glDeleteShader(shader);
21145bd8deadSopenharmony_ci            return program;
21155bd8deadSopenharmony_ci          } else {
21165bd8deadSopenharmony_ci            return 0;
21175bd8deadSopenharmony_ci          }
21185bd8deadSopenharmony_ci
21195bd8deadSopenharmony_ci        Optionally, the glDetachShader and glDeleteShader commands could
21205bd8deadSopenharmony_ci        be removed to allow this program to be re-linked after different
21215bd8deadSopenharmony_ci        glBindAttribLocation calls.
21225bd8deadSopenharmony_ci
21235bd8deadSopenharmony_ci    16. Can you use glBindFragDataLocation to direct varying output
21245bd8deadSopenharmony_ci        variables from a fragment shader program created by
21255bd8deadSopenharmony_ci        glCreateShaderProgram to specific color buffers?
21265bd8deadSopenharmony_ci
21275bd8deadSopenharmony_ci        RESOLVED: NO for much the same reason you can't do this with
21285bd8deadSopenharmony_ci        attributes as described in issue 15.  But you could create the
21295bd8deadSopenharmony_ci        program with the standard GLSL creation process where you attach
21305bd8deadSopenharmony_ci        your own shaders and relink.
21315bd8deadSopenharmony_ci
21325bd8deadSopenharmony_ci        For fragment shader programs created with
21335bd8deadSopenharmony_ci        glCreateShaderProgram, there is already the gl_FragData[]
21345bd8deadSopenharmony_ci        builtin to output to numbered color buffers.  For integer
21355bd8deadSopenharmony_ci        framebuffers, we would need to add:
21365bd8deadSopenharmony_ci
21375bd8deadSopenharmony_ci            varying out ivec4 gl_IntFragData[];
21385bd8deadSopenharmony_ci
21395bd8deadSopenharmony_ci        User-defined output fragment shader varyings can still be used
21405bd8deadSopenharmony_ci        as long as the application is happy with the linker-assigned
21415bd8deadSopenharmony_ci        locations.
21425bd8deadSopenharmony_ci
21435bd8deadSopenharmony_ci        Demonstrating how to workaround this particular issue, here's
21445bd8deadSopenharmony_ci        an example of creating and using a fragment shader for use with
21455bd8deadSopenharmony_ci        separate shader objects that includes explicit binding of output
21465bd8deadSopenharmony_ci        varyings to fragment data locations.  First the shader:
21475bd8deadSopenharmony_ci
21485bd8deadSopenharmony_ci          varying out ivec4 bufferA;
21495bd8deadSopenharmony_ci          varying out ivec4 bufferB;
21505bd8deadSopenharmony_ci          void main()
21515bd8deadSopenharmony_ci          {
21525bd8deadSopenharmony_ci            bufferA = ivec4(1,2,3,4);
21535bd8deadSopenharmony_ci            bufferB = ivec4(5,6,7,8);
21545bd8deadSopenharmony_ci          }
21555bd8deadSopenharmony_ci
21565bd8deadSopenharmony_ci        Now creating and using a linked program from this shader where
21575bd8deadSopenharmony_ci        bufferA outputs to color buffer 0 and bufferB outputs to color
21585bd8deadSopenharmony_ci        buffer 1:
21595bd8deadSopenharmony_ci
21605bd8deadSopenharmony_ci          GLuint ppo;
21615bd8deadSopenharmony_ci          GenProgramPipelines(1, &ppo);
21625bd8deadSopenharmony_ci          BindProgramPipeline(ppo);
21635bd8deadSopenharmony_ci          const GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
21645bd8deadSopenharmony_ci          if (shader) {
21655bd8deadSopenharmony_ci            const GLint len = (GLint) strlen(aboveShaderString);
21665bd8deadSopenharmony_ci            glShaderSource(shader, 1, &aboveShaderString, &len);
21675bd8deadSopenharmony_ci            glCompileShader(shader);
21685bd8deadSopenharmony_ci            const uint program = glCreateProgram();
21695bd8deadSopenharmony_ci            if (program) {
21705bd8deadSopenharmony_ci              GLint compiled = FALSE;
21715bd8deadSopenharmony_ci              glGetShaderiv(shader, COMPILE_STATUS, &compiled);
21725bd8deadSopenharmony_ci              if (compiled) {
21735bd8deadSopenharmony_ci                glAttachShader(program, shader);
21745bd8deadSopenharmony_ci
21755bd8deadSopenharmony_ci                // Crucial code that glCreateShaderProgram doesn't do
21765bd8deadSopenharmony_ci                glBindFragDataLocation(program, 0, "bufferA");
21775bd8deadSopenharmony_ci                glBindFragDataLocation(program, 1, "bufferB");
21785bd8deadSopenharmony_ci
21795bd8deadSopenharmony_ci                glLinkProgram(program);
21805bd8deadSopenharmony_ci                glDetachShader(program, shader);
21815bd8deadSopenharmony_ci
21825bd8deadSopenharmony_ci                // Show this program can actually be used as a fragment shader
21835bd8deadSopenharmony_ci                glUseProgramStages(GL_FRAGMENT_SHADER, program);
21845bd8deadSopenharmony_ci              }
21855bd8deadSopenharmony_ci            }
21865bd8deadSopenharmony_ci            glDeleteShader(shader);
21875bd8deadSopenharmony_ci            return program;
21885bd8deadSopenharmony_ci          } else {
21895bd8deadSopenharmony_ci            return 0;
21905bd8deadSopenharmony_ci          }
21915bd8deadSopenharmony_ci
21925bd8deadSopenharmony_ci        Optionally, the glDetachShader and glDeleteShader could be
21935bd8deadSopenharmony_ci        removed to allow this program to be re-linked after different
21945bd8deadSopenharmony_ci        glBindFragDataLocation calls.
21955bd8deadSopenharmony_ci
21965bd8deadSopenharmony_ci    17. Can you output varyings in transform feedback from a separate
21975bd8deadSopenharmony_ci        shader program created with glCreateShaderProgram?
21985bd8deadSopenharmony_ci
21995bd8deadSopenharmony_ci        RESOLVED:  No.
22005bd8deadSopenharmony_ci
22015bd8deadSopenharmony_ci        glTransformFeedbackVaryings requires a re-link to take effect on
22025bd8deadSopenharmony_ci        a program.  glCreateShaderProgram detaches and deletes the
22035bd8deadSopenharmony_ci        shader object use to create the program so a glLinkProgram will
22045bd8deadSopenharmony_ci        fail.
22055bd8deadSopenharmony_ci
22065bd8deadSopenharmony_ci        You can still create a vertex or geometry shader program
22075bd8deadSopenharmony_ci        with the standard GLSL creation process where you could use
22085bd8deadSopenharmony_ci        glTransformFeedbackVaryings and glLinkProgram.
22095bd8deadSopenharmony_ci
22105bd8deadSopenharmony_ci    18. I just don't get it?  Why is it such a big deal to just require
22115bd8deadSopenharmony_ci        apps to link all their vertex and fragment shaders together?
22125bd8deadSopenharmony_ci        Please explain a situation where mix-and-match shaders is
22135bd8deadSopenharmony_ci        substantially better than GLSL as it exists without this
22145bd8deadSopenharmony_ci        extension?
22155bd8deadSopenharmony_ci
22165bd8deadSopenharmony_ci        RESOLUTION:  Consider the (not uncommon) case of a vertex shader
22175bd8deadSopenharmony_ci        for skinning a character.  The vertex shader is used in four
22185bd8deadSopenharmony_ci        distinct types of rendering passes, each using the one vertex
22195bd8deadSopenharmony_ci        shader but different fragment shaders.
22205bd8deadSopenharmony_ci
22215bd8deadSopenharmony_ci        For GLSL today, this situation today requires 4 program objects,
22225bd8deadSopenharmony_ci        each containing the one vertex shader paired with each one of
22235bd8deadSopenharmony_ci        the fragment shaders.
22245bd8deadSopenharmony_ci
22255bd8deadSopenharmony_ci        The one vertex shader has an array of dozens of skinning matrices
22265bd8deadSopenharmony_ci        along with numerous other uniform parameters.
22275bd8deadSopenharmony_ci
22285bd8deadSopenharmony_ci        Each fragment shader has its own different set of uniforms too.
22295bd8deadSopenharmony_ci
22305bd8deadSopenharmony_ci        Each GLSL program object has its own (combined) set of GLuint
22315bd8deadSopenharmony_ci        locations for the active uniforms of the vertex and fragment
22325bd8deadSopenharmony_ci        shaders objects linked into the particular program object.
22335bd8deadSopenharmony_ci
22345bd8deadSopenharmony_ci        The locations for a given program object are arbitrary and
22355bd8deadSopenharmony_ci        the location values of two distinct program objects have no
22365bd8deadSopenharmony_ci        correlation.  This is true even when they each link in the same
22375bd8deadSopenharmony_ci        vertex shader (or alternatively same fragment shader).
22385bd8deadSopenharmony_ci
22395bd8deadSopenharmony_ci        Now the application is saddled with the burden of managing
22405bd8deadSopenharmony_ci        distinct location values for the same vertex shader skinning
22415bd8deadSopenharmony_ci        matrices and other uniform variables as well as making sure
22425bd8deadSopenharmony_ci        the values of these variables are mirroed over all four program
22435bd8deadSopenharmony_ci        objects containing the skinning vertex shader.
22445bd8deadSopenharmony_ci
22455bd8deadSopenharmony_ci        What's worse is despite all the program objects being loaded
22465bd8deadSopenharmony_ci        with the same vertex shader uniform variables for skinning, the
22475bd8deadSopenharmony_ci        driver is exceedingly unlikely to recoginize that binding from
22485bd8deadSopenharmony_ci        one of these program objects to another is going to result in
22495bd8deadSopenharmony_ci        no actual vertex shader state change.  Noticing that the uniform
22505bd8deadSopenharmony_ci        vertex shader variables are changing in lock-step over a series
22515bd8deadSopenharmony_ci        of program objects (when the uniform fragment shader variables
22525bd8deadSopenharmony_ci        ARE allowed to diverge) is exceedingly expensive.
22535bd8deadSopenharmony_ci
22545bd8deadSopenharmony_ci        This situation is simple to optimize with mix-and-match shaders
22555bd8deadSopenharmony_ci        because there is just a single vertex shader to worry about.
22565bd8deadSopenharmony_ci        It's only the current fragment shader program that is changing
22575bd8deadSopenharmony_ci        so only the fragment shader state must be updated/re-validated.
22585bd8deadSopenharmony_ci
22595bd8deadSopenharmony_ci        It's also much easier and less expensive for the application to
22605bd8deadSopenharmony_ci        update the vertex shader state because there is just one copy
22615bd8deadSopenharmony_ci        of it to update.
22625bd8deadSopenharmony_ci
22635bd8deadSopenharmony_ci    19. Which should take precedence if both are bound, program objects
22645bd8deadSopenharmony_ci        or program pipeline objects?
22655bd8deadSopenharmony_ci
22665bd8deadSopenharmony_ci        RESOLVED: Program objects. Due to concerns about existing
22675bd8deadSopenharmony_ci        middleware depending on the program object state to determine
22685bd8deadSopenharmony_ci        the current program rendering state, the program object should
22695bd8deadSopenharmony_ci        override any program pipeline object that might be bound.
22705bd8deadSopenharmony_ci
22715bd8deadSopenharmony_ci
22725bd8deadSopenharmony_ci    20. Should UseProgramStages take a bitfield rather than derive the
22735bd8deadSopenharmony_ci        information from the program object?
22745bd8deadSopenharmony_ci
22755bd8deadSopenharmony_ci        RESOLVED: Yes. Though it seems pointless to include a bitfield
22765bd8deadSopenharmony_ci        that can only be erroneous if it includes bits set for shaders
22775bd8deadSopenharmony_ci        not present in the program object, without it there is no way to
22785bd8deadSopenharmony_ci        disassociate a shader type from a program object once it has
22795bd8deadSopenharmony_ci        been done.
22805bd8deadSopenharmony_ci
22815bd8deadSopenharmony_ci    21. What should the behavior be if a program object is deleted that
22825bd8deadSopenharmony_ci        is part of the current program pipeline object?
22835bd8deadSopenharmony_ci
22845bd8deadSopenharmony_ci        RESOLVED: Just as program objects made current via UseProgram
22855bd8deadSopenharmony_ci        are flagged for deletion until they are no longer referenced,
22865bd8deadSopenharmony_ci        program objects that form part of the current program pipeline
22875bd8deadSopenharmony_ci        object will be flagged and remain until no references remain.
22885bd8deadSopenharmony_ci
22895bd8deadSopenharmony_ci        Deletion of current program objects has special treatment in
22905bd8deadSopenharmony_ci        OpenGL. Such are not immediately deleted, but rather flagged for
22915bd8deadSopenharmony_ci        deletion and remain until they are no longer referenced. Being
22925bd8deadSopenharmony_ci        current indirectly as part of the current program pipeline object
22935bd8deadSopenharmony_ci        rather than directly via UseProgram makes no fundamental
22945bd8deadSopenharmony_ci        difference to the state of the program object or the rendering
22955bd8deadSopenharmony_ci        state. Whenever possible, an object made current as part of a
22965bd8deadSopenharmony_ci        container object should behave exactly as it would if it were
22975bd8deadSopenharmony_ci        to bypass that container object. In defference to that goal,
22985bd8deadSopenharmony_ci        objections to perpetuating the irregular behavior of program
22995bd8deadSopenharmony_ci        object deletion are set aside in favor of maintaining consistent
23005bd8deadSopenharmony_ci        behavior.
23015bd8deadSopenharmony_ci
23025bd8deadSopenharmony_ci    22. If multiple potential sources of transform feedback input are
23035bd8deadSopenharmony_ci        active from different program objects, where should transform feedback
23045bd8deadSopenharmony_ci        capture its input?
23055bd8deadSopenharmony_ci
23065bd8deadSopenharmony_ci        RESOLVED: The later stage in the ordered pipeline of stages
23075bd8deadSopenharmony_ci        should be the source of the transform feedback input. This is
23085bd8deadSopenharmony_ci        true at any given time regardless of how the state may change
23095bd8deadSopenharmony_ci        due to binding and releasing of different program objects. So if
23105bd8deadSopenharmony_ci        a geometry shader program is active and then removed, transform
23115bd8deadSopenharmony_ci        feedback input may switch to the vertex shader. This potential
23125bd8deadSopenharmony_ci        for changes requires an error with ResumeTransformFeedback if
23135bd8deadSopenharmony_ci        the related state has changed since it was paused.
23145bd8deadSopenharmony_ci
23155bd8deadSopenharmony_ci    23. How do built-in inputs in one stage interface with built-in outputs
23165bd8deadSopenharmony_ci        from a previous stage?
23175bd8deadSopenharmony_ci
23185bd8deadSopenharmony_ci        UNRESOLVED:  There are several different classes of inputs that
23195bd8deadSopenharmony_ci        have different behavior:
23205bd8deadSopenharmony_ci
23215bd8deadSopenharmony_ci        (a) "System inputs" are ones that are not derived directly from a
23225bd8deadSopenharmony_ci            corresponding output.  These inputs are treated as though they
23235bd8deadSopenharmony_ci            had their own dedicated locations; use of these variables in a
23245bd8deadSopenharmony_ci            shader do not affect whether the shader matches up with the
23255bd8deadSopenharmony_ci            outputs of a previous shader stage.  Examples of such inputs
23265bd8deadSopenharmony_ci            include "gl_InvocationID", "gl_SamplePosition",
23275bd8deadSopenharmony_ci            "gl_PointCoord", and "gl_TessCoord".
23285bd8deadSopenharmony_ci
23295bd8deadSopenharmony_ci        (b) "System outputs" are are typically consumed by a fixed-function
23305bd8deadSopenharmony_ci            unit.  These outputs are treated as though they had their own
23315bd8deadSopenharmony_ci            dedicated locations; use of these variables in a shader do not
23325bd8deadSopenharmony_ci            affect whether the shader matches up with the outputs of a
23335bd8deadSopenharmony_ci            previous shader stage.  Examples of such outputs include
23345bd8deadSopenharmony_ci            "gl_Layer", "gl_TessLevelOuter[]".
23355bd8deadSopenharmony_ci
23365bd8deadSopenharmony_ci        (c) Non-system inputs and outputs are those passed more-or-less
23375bd8deadSopenharmony_ci            directly between shader stages.  For fragment shader inputs,
23385bd8deadSopenharmony_ci            non-system inputs may be interpolated, but the interpolated
23395bd8deadSopenharmony_ci            values will be derived directly from outputs of the previous
23405bd8deadSopenharmony_ci            shader stages.  These inputs and outputs are not treated as
23415bd8deadSopenharmony_ci            having dedicated locations.  To ensure an exact match between
23425bd8deadSopenharmony_ci            two shader stages, the set of non-system inputs and outputs on
23435bd8deadSopenharmony_ci            the interface must match.  
23445bd8deadSopenharmony_ci
23455bd8deadSopenharmony_ci        All built-in inputs and outputs not found in the gl_PerVertex and
23465bd8deadSopenharmony_ci        gl_PerFragment blocks are treated as belonging to categories (a)
23475bd8deadSopenharmony_ci        and (b).  Members of gl_PerVertex may or may not be treated as
23485bd8deadSopenharmony_ci        "system" variables, depending on the specific interface.  (See the
23495bd8deadSopenharmony_ci        next issue for more details.)
23505bd8deadSopenharmony_ci
23515bd8deadSopenharmony_ci    24. How does the use of built-in inputs or outputs affect the exact
23525bd8deadSopenharmony_ci        interface matching?  Does their use affect matching for
23535bd8deadSopenharmony_ci        user-defined inputs?
23545bd8deadSopenharmony_ci
23555bd8deadSopenharmony_ci        UNRESOLVED:  As noted in the previous issue, built-ins outside the
23565bd8deadSopenharmony_ci        gl_PerVertex and gl_PerFragment blocks are considered "system"
23575bd8deadSopenharmony_ci        variables that don't affect interface matching at all.  For members
23585bd8deadSopenharmony_ci        of gl_PerVertex and gl_PerFragment, there are two types of
23595bd8deadSopenharmony_ci        interface between separable programs with different rules.
23605bd8deadSopenharmony_ci
23615bd8deadSopenharmony_ci        In interfaces not involving a fragment shader (e.g., vertex to
23625bd8deadSopenharmony_ci        geometry), shader outputs in gl_PerVertex are not interpreted by
23635bd8deadSopenharmony_ci        any fixed-function unit.  As such, we will treat all inputs and
23645bd8deadSopenharmony_ci        outputs as non-system.  To get defined results passing these
23655bd8deadSopenharmony_ci        built-ins between stages, gl_PerVertex must be declared identically
23665bd8deadSopenharmony_ci        on both sides of the interface.
23675bd8deadSopenharmony_ci
23685bd8deadSopenharmony_ci        In interfaces involving a fragment shader, some of the gl_PerVertex
23695bd8deadSopenharmony_ci        outputs will be consumed by the rasterizer and may not be passed to
23705bd8deadSopenharmony_ci        subsequent stages.  In particular, the built-in outputs
23715bd8deadSopenharmony_ci        gl_Position, gl_PointSize, gl_ClipDistance[], and gl_ClipVertex
23725bd8deadSopenharmony_ci        (compatibility only) are consumed by the rasterizer.
23735bd8deadSopenharmony_ci        gl_ClipDistance[] is available in the fragment shader, but will
23745bd8deadSopenharmony_ci        typically not be read there; all other outputs are not available in
23755bd8deadSopenharmony_ci        the fragment shader.  As a result, these outputs are treated as
23765bd8deadSopenharmony_ci        system outputs and are ignored when testing if gl_PerVertex and
23775bd8deadSopenharmony_ci        gl_PerFragment match.  Since gl_PerVertex and gl_PerFragment
23785bd8deadSopenharmony_ci        typically won't match, we specify a member-by-member comparison.  A
23795bd8deadSopenharmony_ci        mismatch occurs if a gl_PerFragment input is found without a
23805bd8deadSopenharmony_ci        corresponding gl_PerVertex output, or vice versa.
23815bd8deadSopenharmony_ci
23825bd8deadSopenharmony_ci        If non-system built-in inputs and outputs don't match on an
23835bd8deadSopenharmony_ci        interface, we don't guarantee that correct values are passed
23845bd8deadSopenharmony_ci        between stages (inputs are undefined).  Additionally, a mismatch
23855bd8deadSopenharmony_ci        will mean that the values passed using user-defined inputs and
23865bd8deadSopenharmony_ci        outputs without location qualifiers are also not guaranteed, since
23875bd8deadSopenharmony_ci        the locations assigned for these built-ins might affect the
23885bd8deadSopenharmony_ci        assignments for user-defined variables.
23895bd8deadSopenharmony_ci
23905bd8deadSopenharmony_ci    25. How does the use of two-sided color built-ins (e.g., gl_FrontColor
23915bd8deadSopenharmony_ci        vs. gl_BackColor) affect the matching of inputs and outputs on an
23925bd8deadSopenharmony_ci        interface?
23935bd8deadSopenharmony_ci
23945bd8deadSopenharmony_ci        UNRESOLVED:  For interfaces between two non-fragment stages, front
23955bd8deadSopenharmony_ci        and back colors are treated as separate variables over the
23965bd8deadSopenharmony_ci        interfaces.  For interfaces involving a non-fragment stage with
23975bd8deadSopenharmony_ci        fragment, both pairs of front and back colors are treated as a
23985bd8deadSopenharmony_ci        single color for matching purposes.  For example, a vertex shader
23995bd8deadSopenharmony_ci        is treated as effectively writing the fragment input "gl_Color" if
24005bd8deadSopenharmony_ci        it writes either "gl_FrontColor" or "gl_BackColor".
24015bd8deadSopenharmony_ci
24025bd8deadSopenharmony_ci    26. How should built-in inputs behave when used with user-defined
24035bd8deadSopenharmony_ci        variables with explicit locations?
24045bd8deadSopenharmony_ci
24055bd8deadSopenharmony_ci        UNRESOLVED:  Built-ins are unaffected by the presence of
24065bd8deadSopenharmony_ci        user-defined variables with explicit locations.  A mismatch in
24075bd8deadSopenharmony_ci        built-ins does not affect matching of user-defined variables with
24085bd8deadSopenharmony_ci        explicit locations.
24095bd8deadSopenharmony_ci
24105bd8deadSopenharmony_ci        Note that built-ins can not be assigned explicit locations.  This
24115bd8deadSopenharmony_ci        means that:
24125bd8deadSopenharmony_ci
24135bd8deadSopenharmony_ci          (a) when non-system built-in usage doesn't match, the mismatch
24145bd8deadSopenharmony_ci              affects all such built-ins, plus any user-defined variables
24155bd8deadSopenharmony_ci              that aren't assigned explicit locations; and
24165bd8deadSopenharmony_ci
24175bd8deadSopenharmony_ci          (b) when user-defined variables without locations don't match
24185bd8deadSopenharmony_ci              between shaders, the mismatch affects all non-system
24195bd8deadSopenharmony_ci              built-ins as well.
24205bd8deadSopenharmony_ci
24215bd8deadSopenharmony_ci    27. How does the handling of built-in inputs and outputs in this
24225bd8deadSopenharmony_ci        extension differ from EXT_separate_shader_objects?
24235bd8deadSopenharmony_ci
24245bd8deadSopenharmony_ci        UNRESOLVED:  In EXT_separate_shader_objects, shaders could only use
24255bd8deadSopenharmony_ci        built-ins to pass values between stages.  In this extension,
24265bd8deadSopenharmony_ci        user-defined variables can be used.
24275bd8deadSopenharmony_ci
24285bd8deadSopenharmony_ci        In this extension, the usage of "non-system" built-ins is required
24295bd8deadSopenharmony_ci        to match between stages.  In EXT_separate_shader_objects, there was
24305bd8deadSopenharmony_ci        no requirement that the set of built-in outputs written by one
24315bd8deadSopenharmony_ci        stage had to match the inputs read by another stage.
24325bd8deadSopenharmony_ci
24335bd8deadSopenharmony_ci        Implementations supporting EXT_separate_shader_objects are likely to
24345bd8deadSopenharmony_ci        provide logically separate locations for all shader built-ins.  That
24355bd8deadSopenharmony_ci        extension didn't provide for undefined values when the set of
24365bd8deadSopenharmony_ci        built-ins used on one side of the interface didn't exactly match those
24375bd8deadSopenharmony_ci        on that other side, so implementations were required to assign
24385bd8deadSopenharmony_ci        matching locations even if texture coordinates or colors were used as
24395bd8deadSopenharmony_ci        outputs in one program but not inputs in another.
24405bd8deadSopenharmony_ci
24415bd8deadSopenharmony_ci    28. This extension requires shaders to redeclare gl_PerVertex and
24425bd8deadSopenharmony_ci        gl_PerFragment to use certain important built-ins.  However, GLSL
24435bd8deadSopenharmony_ci        1.40 (OpenGL 3.1 and earlier) doesn't support input and output
24445bd8deadSopenharmony_ci        blocks at all.  Should we support this extension on such GL/GLSL
24455bd8deadSopenharmony_ci        versions?  If so, how?
24465bd8deadSopenharmony_ci
24475bd8deadSopenharmony_ci        RESOLVED:  Yes, we expect that some implementations will want to
24485bd8deadSopenharmony_ci        support this extension on GPUs not capable of supporting OpenGL 3.2
24495bd8deadSopenharmony_ci        and GLSL 1.50.
24505bd8deadSopenharmony_ci
24515bd8deadSopenharmony_ci        To handle such cases, we don't require block redeclarations in shaders
24525bd8deadSopenharmony_ci        using #version 140 and earlier.  Instead, we treat it these cases as
24535bd8deadSopenharmony_ci        though gl_PerVertex and gl_PerFragment existed and were re-declared
24545bd8deadSopenharmony_ci        implicitly.  We allow shaders to redeclare all relevant built-ins, and
24555bd8deadSopenharmony_ci        require that shaders redeclare each of these built-ins that it uses.
24565bd8deadSopenharmony_ci        The set of redeclared built-ins is then assembled into an implicit
24575bd8deadSopenharmony_ci        block redeclaration and normal block matching rules are then applied.
24585bd8deadSopenharmony_ci
24595bd8deadSopenharmony_ci        This capability is provided only for shaders using #version 140 or
24605bd8deadSopenharmony_ci        lower.  We considered adding a forward compatibility path allowing
24615bd8deadSopenharmony_ci        similar constructs in #version 150 and higher shaders, but opted
24625bd8deadSopenharmony_ci        against adding a second mechanism where block redeclaration is already
24635bd8deadSopenharmony_ci        available.  Additionally, the fact that #version 140 shaders using
24645bd8deadSopenharmony_ci        this feature already have to redeclare all relevant variables means
24655bd8deadSopenharmony_ci        that shaders written for #version 140 plus this extension are likely
24665bd8deadSopenharmony_ci        to already have something looking very much like a block
24675bd8deadSopenharmony_ci        redeclaration, and should be easily ported.
24685bd8deadSopenharmony_ci
24695bd8deadSopenharmony_ci        We considered adding support for input and output blocks to GLSL
24705bd8deadSopenharmony_ci        1.40 as part of this extension, but decided that was too large of
24715bd8deadSopenharmony_ci        a change.
24725bd8deadSopenharmony_ci
24735bd8deadSopenharmony_ci        The relevant language here is only included in the extension spec.  It
24745bd8deadSopenharmony_ci        doesn't need to be included in the core, because the only way to use
24755bd8deadSopenharmony_ci        the new features here with #version 140 shaders is via this extension.
24765bd8deadSopenharmony_ci
24775bd8deadSopenharmony_ci    29. How do input and output "location" layout qualifiers behave with this
24785bd8deadSopenharmony_ci        extension and ARB_explicit_attrib_location?
24795bd8deadSopenharmony_ci
24805bd8deadSopenharmony_ci        RESOLVED:  ARB_explicit_attrib_location added "location" layout
24815bd8deadSopenharmony_ci        qualifiers for vertex shader inputs and fragment shader outputs to
24825bd8deadSopenharmony_ci        interface with fixed-function vertex pulling and blending hardware.
24835bd8deadSopenharmony_ci        This extension adds "location" qualifiers for all other shader inputs
24845bd8deadSopenharmony_ci        and outputs.  To use these qualifiers, shaders must either enable the
24855bd8deadSopenharmony_ci        appropriate extension(s) using #extension or select a GLSL version
24865bd8deadSopenharmony_ci        incorporating the functionality using #version.  In vertex and
24875bd8deadSopenharmony_ci        fragment shaders, it may be necessary to enable both extensions -- one
24885bd8deadSopenharmony_ci        for inputs and the other for outputs.  
24895bd8deadSopenharmony_ci
24905bd8deadSopenharmony_ci        A shader using location layout qualifiers without an appropriate
24915bd8deadSopenharmony_ci        #extension or #version directive will fail to compile.
24925bd8deadSopenharmony_ci
24935bd8deadSopenharmony_ci    30. Can program pipeline objects be shared between contexts?
24945bd8deadSopenharmony_ci
24955bd8deadSopenharmony_ci        RESOLVED:  No.  Like framebuffer and vertex array objects (added by
24965bd8deadSopenharmony_ci        OpenGL 3.0), they are considered "container" objects to which other
24975bd8deadSopenharmony_ci        shareable objects can be attached.
24985bd8deadSopenharmony_ci
24995bd8deadSopenharmony_ci    31. How does one figure out how many locations are consumed by an input or
25005bd8deadSopenharmony_ci        output?
25015bd8deadSopenharmony_ci
25025bd8deadSopenharmony_ci        RESOLVED:  Basic scalar and single-precision vector types are
25035bd8deadSopenharmony_ci        considered to consume one (vector) location.  Double-precision scalar
25045bd8deadSopenharmony_ci        and vector types consume either one or two locations, as discussed
25055bd8deadSopenharmony_ci        further below.  An array with <n> elements, each consuming <m>
25065bd8deadSopenharmony_ci        locations, will consume <n>*<m> locations.  Matrix types are treated
25075bd8deadSopenharmony_ci        as arrays of two to four column vectors.  Locations are assigned in
25085bd8deadSopenharmony_ci        structure types by assigning consecutive locations member-by-member
25095bd8deadSopenharmony_ci        according to the member declaration order.
25105bd8deadSopenharmony_ci
25115bd8deadSopenharmony_ci    31. How many locations are consumed by shader inputs and outputs with
25125bd8deadSopenharmony_ci        double-precision types?
25135bd8deadSopenharmony_ci
25145bd8deadSopenharmony_ci        RESOLVED:  For inputs and outputs passed between shader stages, values
25155bd8deadSopenharmony_ci        of type "double" and "dvec2" consume a single location.  Values of
25165bd8deadSopenharmony_ci        type "dvec3" and "dvec4" require more storage than a single-precision
25175bd8deadSopenharmony_ci        four-component vector, and thus consume two locations.
25185bd8deadSopenharmony_ci
25195bd8deadSopenharmony_ci        For vertex shader inputs, each location is associated with a generic
25205bd8deadSopenharmony_ci        vertex attribute.  Since each such attribute in the API can hold a
25215bd8deadSopenharmony_ci        full "dvec4" if specified with VertexAttribL* or VertexAttribLPointer,
25225bd8deadSopenharmony_ci        values of type "double", "dvec2", "dvec3", and "dvec4" consume only a
25235bd8deadSopenharmony_ci        single location (generic vertex attribute).  However, for the purposes
25245bd8deadSopenharmony_ci        of determining if a vertex shader uses "too many" attribute vectors in
25255bd8deadSopenharmony_ci        LinkProgram, vertex shader inputs of types "dvec3" and "dvec4" can be
25265bd8deadSopenharmony_ci        counted as consuming two vector attributes.  For example, if a vertex
25275bd8deadSopenharmony_ci        shader specifies:
25285bd8deadSopenharmony_ci
25295bd8deadSopenharmony_ci          layout(location=4) in dvec4 attribs[4];
25305bd8deadSopenharmony_ci
25315bd8deadSopenharmony_ci        the values for the four elements of "attribs" will be taken from
25325bd8deadSopenharmony_ci        vertex attributes 4-7, though "attribs" may be counted as consuming
25335bd8deadSopenharmony_ci        eight vectors worth of attributes.
25345bd8deadSopenharmony_ci
25355bd8deadSopenharmony_ci        Arrays or matrix types with double-precision components are treated as
25365bd8deadSopenharmony_ci        comprising 
25375bd8deadSopenharmony_ci
25385bd8deadSopenharmony_ci    33. Are location layout qualifiers allowed on block declarations?  On
25395bd8deadSopenharmony_ci        block member declarations?
25405bd8deadSopenharmony_ci
25415bd8deadSopenharmony_ci        RESOLVED:  Location layout qualifiers are not allowed on either block
25425bd8deadSopenharmony_ci        or block member declarations in this extension.  One implication of
25435bd8deadSopenharmony_ci        this behavior is that in input/output interface between programs, the
25445bd8deadSopenharmony_ci        sets of declared inputs and outputs must match exactly, since
25455bd8deadSopenharmony_ci        interface blocks can not be matched by location.  Future extensions
25465bd8deadSopenharmony_ci        may consider relaxing either or both restrictions.
25475bd8deadSopenharmony_ci
25485bd8deadSopenharmony_ci    34. Should we ever allow inputs and outputs to match if they are of
25495bd8deadSopenharmony_ci        different type?
25505bd8deadSopenharmony_ci
25515bd8deadSopenharmony_ci        RESOLVED:  The location system in this extension is expressed in units
25525bd8deadSopenharmony_ci        of four-component vectors.  Because of this common numeric location,
25535bd8deadSopenharmony_ci        we allow outputs with a vector type to be fed to inputs with a scalar
25545bd8deadSopenharmony_ci        or smaller vector type as long as they have the same location and
25555bd8deadSopenharmony_ci        basic component type.  For example, if a vertex shader includes:
25565bd8deadSopenharmony_ci
25575bd8deadSopenharmony_ci          layout(location = 4) out vec4 vsout;
25585bd8deadSopenharmony_ci
25595bd8deadSopenharmony_ci        and a fragment shader includes:
25605bd8deadSopenharmony_ci
25615bd8deadSopenharmony_ci          layout(location = 4) in vec2 fsin;
25625bd8deadSopenharmony_ci
25635bd8deadSopenharmony_ci        the two components of <fsin> will be obtained by interpolating the x
25645bd8deadSopenharmony_ci        and y components of <vsout>.  The z and w components of <vsout> will
25655bd8deadSopenharmony_ci        be ignored.
25665bd8deadSopenharmony_ci
25675bd8deadSopenharmony_ci        We do not permit this behavior for double-precision vectors, because
25685bd8deadSopenharmony_ci        large types (dvec3, dvec4) consume two locations while smaller types
25695bd8deadSopenharmony_ci        (double, dvec2) consume only one.  Allowing this behavior would be 
25705bd8deadSopenharmony_ci        problematic for arrays.  For example, in a vertex shader output 
25715bd8deadSopenharmony_ci        declared as:
25725bd8deadSopenharmony_ci
25735bd8deadSopenharmony_ci          layout(location = 4) out dvec4 vsout[2];
25745bd8deadSopenharmony_ci
25755bd8deadSopenharmony_ci        "vsout[1]" would be assigned locations 6 and 7, while in a fragment
25765bd8deadSopenharmony_ci        shader input declared as
25775bd8deadSopenharmony_ci
25785bd8deadSopenharmony_ci          layout(location = 4) in dvec2 fsin[2];
25795bd8deadSopenharmony_ci
25805bd8deadSopenharmony_ci        "fsin[1]" would be assigned location 5.
25815bd8deadSopenharmony_ci
25825bd8deadSopenharmony_ci    35. What are the rules for determining if inputs and outputs match by
25835bd8deadSopenharmony_ci        qualification?
25845bd8deadSopenharmony_ci
25855bd8deadSopenharmony_ci        RESOLVED:  In order for an input in one shader stage to be considered
25865bd8deadSopenharmony_ci        to match an output in another, some of the qualifiers must match but
25875bd8deadSopenharmony_ci        others need not match.  In particular:
25885bd8deadSopenharmony_ci
25895bd8deadSopenharmony_ci          * The base storage qualifier ("in" and "out") across an interface
25905bd8deadSopenharmony_ci            will naturally not match -- one side uses "in", the other uses
25915bd8deadSopenharmony_ci            "out".
25925bd8deadSopenharmony_ci
25935bd8deadSopenharmony_ci          * Auxilliary storage qualifiers ("centroid", "sample", and "patch")
25945bd8deadSopenharmony_ci            and interpolation qualifiers ("flat", "smooth", "noperspective")
25955bd8deadSopenharmony_ci            must match.
25965bd8deadSopenharmony_ci
25975bd8deadSopenharmony_ci          * The location layout qualifier, if specified, must match.
25985bd8deadSopenharmony_ci
25995bd8deadSopenharmony_ci          * Layout qualifiers specific to one shader type (e.g., "stream" for
26005bd8deadSopenharmony_ci            geometry shader outputs) need not match.
26015bd8deadSopenharmony_ci
26025bd8deadSopenharmony_ci          * Precision qualifiers have no effect in OpenGL and need not match.
26035bd8deadSopenharmony_ci
26045bd8deadSopenharmony_ci          * The qualifiers "invariant" and "precise" affect only how outputs
26055bd8deadSopenharmony_ci            are computed within a shader stage and need not match between
26065bd8deadSopenharmony_ci            stages.
26075bd8deadSopenharmony_ci
26085bd8deadSopenharmony_ci    36. How does the behavior of input/output interface matching differ
26095bd8deadSopenharmony_ci        between separable programs and non-separable programs?
26105bd8deadSopenharmony_ci
26115bd8deadSopenharmony_ci        RESOLVED:  The rules for matching individual variables or block
26125bd8deadSopenharmony_ci        members between stages are identical for separable and non-separable
26135bd8deadSopenharmony_ci        programs, with one exception -- matching variables of different type
26145bd8deadSopenharmony_ci        with the same location, as discussed in issue 34, applies only to
26155bd8deadSopenharmony_ci        separable programs.
26165bd8deadSopenharmony_ci
26175bd8deadSopenharmony_ci        However, the ability to enforce matching requirements differs between
26185bd8deadSopenharmony_ci        program types.  In non-separable programs, both sides of an interface
26195bd8deadSopenharmony_ci        are contained in the same linked program.  In this case, if the linker
26205bd8deadSopenharmony_ci        detects a mismatch, it will generate a link error.  
26215bd8deadSopenharmony_ci
26225bd8deadSopenharmony_ci        For separable programs, the two sides of an interface may be in
26235bd8deadSopenharmony_ci        different programs, so the linker will be unable to detect a mismatch.
26245bd8deadSopenharmony_ci        In these cases, applications are responsible for ensuring matching
26255bd8deadSopenharmony_ci        inputs/outputs are used on either side of the interface.  Input
26265bd8deadSopenharmony_ci        variables are undefined when mismatches occur.  Matching can be done
26275bd8deadSopenharmony_ci        across the entire interface by ensuring that the exact same set of
26285bd8deadSopenharmony_ci        declarations is used on both sides of the interface.  Alternately,
26295bd8deadSopenharmony_ci        matching can be done variable-by-variable by using identical types and
26305bd8deadSopenharmony_ci        matching location layout qualifiers.
26315bd8deadSopenharmony_ci
26325bd8deadSopenharmony_ciRevision History
26335bd8deadSopenharmony_ci
26345bd8deadSopenharmony_ci    Rev.    Date       Author    Changes
26355bd8deadSopenharmony_ci    ----  -----------  --------- ---------------------------------------------
26365bd8deadSopenharmony_ci    25    1 Aug 2011   pbrown    More clearly specify interface matching rules
26375bd8deadSopenharmony_ci                                 for shader inputs and outputs, for cases
26385bd8deadSopenharmony_ci                                 where both sides of an interface are found in
26395bd8deadSopenharmony_ci                                 the same program and where they are in
26405bd8deadSopenharmony_ci                                 different programs (bug 7030).  Add
26415bd8deadSopenharmony_ci                                 dependencies with several ARB extensions and
26425bd8deadSopenharmony_ci                                 core version.  Add several new spec issues
26435bd8deadSopenharmony_ci                                 related to shader interface matching.
26445bd8deadSopenharmony_ci
26455bd8deadSopenharmony_ci                                 Add GLSL spec language describing what
26465bd8deadSopenharmony_ci                                 qualifiers must match for inputs/outputs to
26475bd8deadSopenharmony_ci                                 be considered to match in qualification.  Add
26485bd8deadSopenharmony_ci                                 clarifications on the number of locations
26495bd8deadSopenharmony_ci                                 consumed by different types of shader
26505bd8deadSopenharmony_ci                                 inputs/outputs.  Specify that vertex shader
26515bd8deadSopenharmony_ci                                 inputs of type "dvec3" and "dvec4" consume a
26525bd8deadSopenharmony_ci                                 single location for the purposes of matching
26535bd8deadSopenharmony_ci                                 with generic vertex attributes in the API
26545bd8deadSopenharmony_ci                                 (bug 7809).  More clearly specify that
26555bd8deadSopenharmony_ci                                 location layout qualifiers are not allowed on
26565bd8deadSopenharmony_ci                                 blocks and block members.
26575bd8deadSopenharmony_ci
26585bd8deadSopenharmony_ci    24    25 Jul 2011  pbrown    Remove the language erroneously deleting
26595bd8deadSopenharmony_ci                                 CURRENT_PROGRAM.  In the EXT extension, this
26605bd8deadSopenharmony_ci                                 token was aliased to ACTIVE_PROGRAM_EXT, and
26615bd8deadSopenharmony_ci                                 was used to indicate the last program set by
26625bd8deadSopenharmony_ci                                 either ActiveProgramEXT or UseProgram.  In
26635bd8deadSopenharmony_ci                                 the ARB extension, the SSO active programs
26645bd8deadSopenharmony_ci                                 are now program pipeline object state and
26655bd8deadSopenharmony_ci                                 CURRENT_PROGRAM should still be used to query
26665bd8deadSopenharmony_ci                                 the last program set by UseProgram (bug 7822).
26675bd8deadSopenharmony_ci
26685bd8deadSopenharmony_ci    23    25 Jul 2011  Jon Leech Add VALIDATE_STATUS to state tables and
26695bd8deadSopenharmony_ci                                 GetProgramPipelineiv description (bug 7748).
26705bd8deadSopenharmony_ci
26715bd8deadSopenharmony_ci    22    6 Jun 2011   pbrown    Treat program pipeline objects as non-shared
26725bd8deadSopenharmony_ci                                 container objects, like framebuffer and
26735bd8deadSopenharmony_ci                                 vertex array objects (bug 7713).
26745bd8deadSopenharmony_ci
26755bd8deadSopenharmony_ci    21    9 Aug 2010   pbrown    Expand ProgramUniform* function prototypes
26765bd8deadSopenharmony_ci                                 to individual entries for tools parsing
26775bd8deadSopenharmony_ci                                 extension specs.  Add missing "*" characters 
26785bd8deadSopenharmony_ci                                 for ProgramUniform*v functions.
26795bd8deadSopenharmony_ci
26805bd8deadSopenharmony_ci    20    15 Jul 2010  pbrown    Proposed update to locations for vectors
26815bd8deadSopenharmony_ci                                 with double-precision components (bug 6635).
26825bd8deadSopenharmony_ci
26835bd8deadSopenharmony_ci    19    13 Jul 2010  pbrown    Clarify issues 7 and 8.
26845bd8deadSopenharmony_ci
26855bd8deadSopenharmony_ci    18    13 Jul 2010  Jon Leech Clarify interactions of current program
26865bd8deadSopenharmony_ci                       & pbrown  object and current program pipeline object,
26875bd8deadSopenharmony_ci                                 and error conditions when a PPO with missing
26885bd8deadSopenharmony_ci                                 shader stages is current.  Add language for
26895bd8deadSopenharmony_ci                                 the interaction of separate shader objects
26905bd8deadSopenharmony_ci                                 and per-stage subroutine uniforms (bug 6641).
26915bd8deadSopenharmony_ci                                 Specify behavior for successful and failed
26925bd8deadSopenharmony_ci                                 links of programs bound to PPOs (bug 6642).
26935bd8deadSopenharmony_ci                                 Add interactions for assembly program 
26945bd8deadSopenharmony_ci                                 extensions and EXT_separate_shader_objects.
26955bd8deadSopenharmony_ci                                 Add missing code for CreateShaderProgramv
26965bd8deadSopenharmony_ci                                 treating such programs as separable.
26975bd8deadSopenharmony_ci                                 Update miscellaneous spec sections that
26985bd8deadSopenharmony_ci                                 don't account for per-stage active programs.
26995bd8deadSopenharmony_ci
27005bd8deadSopenharmony_ci    17    08 Jul 2010  pbrown    Fix interface matching language in "Inputs"
27015bd8deadSopenharmony_ci                                 section of GLSL spec; modify API spec to
27025bd8deadSopenharmony_ci                                 allow type mismatches when using location
27035bd8deadSopenharmony_ci                                 qualifiers (e.g., passing a vec4 to a vec3).
27045bd8deadSopenharmony_ci
27055bd8deadSopenharmony_ci    16    08 Jul 2010  pbrown    Restore error for linking a non-separable
27065bd8deadSopenharmony_ci                                 program without a vertex shader (bug 6517).
27075bd8deadSopenharmony_ci                                 Modify language describing the number of
27085bd8deadSopenharmony_ci                                 available locations (bug 6598).  Add language
27095bd8deadSopenharmony_ci                                 disallowing aliasing of inputs and outputs
27105bd8deadSopenharmony_ci                                 except for previously allowed vertex shader
27115bd8deadSopenharmony_ci                                 input aliasing (bug 6599).  Further work on
27125bd8deadSopenharmony_ci                                 block matching rules for built-in input and
27135bd8deadSopenharmony_ci                                 output blocks, including final rules for
27145bd8deadSopenharmony_ci                                 #version 140 shaders (bug 6636).  
27155bd8deadSopenharmony_ci                                 Miscellaneous typo fixes.
27165bd8deadSopenharmony_ci
27175bd8deadSopenharmony_ci    15    07 Jul 2010  pbrown    Minor typo corrections.  Add specific 
27185bd8deadSopenharmony_ci                                 language for the core profile, which won't
27195bd8deadSopenharmony_ci                                 have gl_PerFragment.  Add issue on the use
27205bd8deadSopenharmony_ci                                 of location qualifiers and #extension; fix
27215bd8deadSopenharmony_ci                                 spec to match.
27225bd8deadSopenharmony_ci
27235bd8deadSopenharmony_ci    14    21 Jun 2010  pbrown    Updated "Shader Interface Matching"
27245bd8deadSopenharmony_ci                                 section to include new rules for built-in
27255bd8deadSopenharmony_ci                                 inputs and outputs.  Added more
27265bd8deadSopenharmony_ci                                 dependencies on the core profile and older
27275bd8deadSopenharmony_ci                                 versions of GLSL.  Added several issues.
27285bd8deadSopenharmony_ci
27295bd8deadSopenharmony_ci    13    07 Jun 2010  groth     Minor relinking clarification. New begin error
27305bd8deadSopenharmony_ci
27315bd8deadSopenharmony_ci    12    01 Jun 2010  groth     More clarifications. Better introduction
27325bd8deadSopenharmony_ci                                 More consistency.
27335bd8deadSopenharmony_ci
27345bd8deadSopenharmony_ci    11    28 May 2010  groth     Language clarifications and issue corrections
27355bd8deadSopenharmony_ci
27365bd8deadSopenharmony_ci    10    21 May 2010  groth     move new xfb errors into pre-existing list
27375bd8deadSopenharmony_ci                                 cleaned up sundry issues
27385bd8deadSopenharmony_ci                                 further clarified deletion behavior
27395bd8deadSopenharmony_ci                                 various other non-controversial cleanups
27405bd8deadSopenharmony_ci
27415bd8deadSopenharmony_ci    9     20 May 2010  groth     Add validateProgramPipeline/infolog
27425bd8deadSopenharmony_ci                                 clarify xfb interaction
27435bd8deadSopenharmony_ci                                 complete interface location allocation 
27445bd8deadSopenharmony_ci                                 language.  mention location limits.
27455bd8deadSopenharmony_ci
27465bd8deadSopenharmony_ci    8     19 May 2010  groth     Finish responding to Pat's feedback.
27475bd8deadSopenharmony_ci                                 Reorganization for clarity.
27485bd8deadSopenharmony_ci
27495bd8deadSopenharmony_ci    7     15 May 2010  groth     Respond to various feedback
27505bd8deadSopenharmony_ci
27515bd8deadSopenharmony_ci    6     10 May 2010  groth     multiple shaders to CreateShaderProgram.
27525bd8deadSopenharmony_ci                                 Rename ActiveProgram, CreateShaderProgram
27535bd8deadSopenharmony_ci                                 Sundry corrections.
27545bd8deadSopenharmony_ci
27555bd8deadSopenharmony_ci    5     08 May 2010  groth     remove default PPO. add active program
27565bd8deadSopenharmony_ci                                 definitively to PPO. add a few issues. 
27575bd8deadSopenharmony_ci                                 fix nits.
27585bd8deadSopenharmony_ci
27595bd8deadSopenharmony_ci    4     06 May 2010  groth     Clarify PPO role. Add language about implicit
27605bd8deadSopenharmony_ci                                 interfaces.
27615bd8deadSopenharmony_ci
27625bd8deadSopenharmony_ci    3     04 May 2010  groth     Add container object. Add DSA uniform commands.
27635bd8deadSopenharmony_ci
27645bd8deadSopenharmony_ci    2     23 Apr 2010  groth     Fill out sections explaining GLSL layout
27655bd8deadSopenharmony_ci                                 pragmas.  Add tessellation awareness. Forbid
27665bd8deadSopenharmony_ci                                 certain use of monolithic and shader programs.
27675bd8deadSopenharmony_ci
27685bd8deadSopenharmony_ci    1     13 Jan 2010  mjk       Initial revision
2769