15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_tessellation_program5
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    (none)
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciStatus
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Shipping.
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciVersion
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Last Modified Date:         12/19/2011
205bd8deadSopenharmony_ci    NVIDIA Revision:            3
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNumber
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    391
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciDependencies
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    OpenGL 1.1 is required.
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    This extension is written against the OpenGL 2.1 specification.
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    NV_gpu_program5 is required.  This extension is supported if and only
335bd8deadSopenharmony_ci    "GL_NV_gpu_program5" is found in the extension string.  This extension is
345bd8deadSopenharmony_ci    written against the NV_gpu_program5 extension.
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    This specification interacts with ARB_tessellation_shader.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    This specification interacts with NV_parameter_buffer_object.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciOverview
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension, in conjunction with the ARB_tessellation_shader extension,
435bd8deadSopenharmony_ci    introduces a new tessellation stage to the OpenGL primitive processing
445bd8deadSopenharmony_ci    pipeline.  The ARB_tessellation_shader extension provides programmable
455bd8deadSopenharmony_ci    shading functionality using the OpenGL Shading Language as its base; this
465bd8deadSopenharmony_ci    extension provides assembly programmable shaders building on the family of
475bd8deadSopenharmony_ci    assembly programmability extensions including ARB_vertex_program,
485bd8deadSopenharmony_ci    ARB_fragment_program, NV_gpu_program4, and NV_geometry_program4.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension adds a new basic primitive type, called a patch, which
515bd8deadSopenharmony_ci    consists of an array of vertices plus some associated per-patch state.  It
525bd8deadSopenharmony_ci    also adds two new assembly program types:  a tessellation control program
535bd8deadSopenharmony_ci    that transforms a patch into a new patch and a tessellation evaluation
545bd8deadSopenharmony_ci    program that computes the position and attributes of each vertex produced
555bd8deadSopenharmony_ci    by the tesselator.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    When tessellation is active, it begins by running the optional
585bd8deadSopenharmony_ci    tessellation control program, if enabled.  This program consumes a
595bd8deadSopenharmony_ci    variable-size input patch and produces a new fixed-size output patch.  The
605bd8deadSopenharmony_ci    output patch consists of an array of vertices, and a set of per-patch
615bd8deadSopenharmony_ci    attributes.  The per-patch attributes include tessellation levels that
625bd8deadSopenharmony_ci    control how finely the patch will be tessellated.  For each patch
635bd8deadSopenharmony_ci    processed, multiple tessellation control program invocations are performed
645bd8deadSopenharmony_ci    -- one per output patch vertex.  Each tessellation control program
655bd8deadSopenharmony_ci    invocation writes all the attributes of its corresponding output patch
665bd8deadSopenharmony_ci    vertex.  A tessellation control program may also read the per-vertex
675bd8deadSopenharmony_ci    outputs of other tessellation control program invocations, as well as read
685bd8deadSopenharmony_ci    and write shared per-patch outputs.  The tessellation control program
695bd8deadSopenharmony_ci    invocations for a single patch effectively run as a group.  The GL
705bd8deadSopenharmony_ci    automatically synchronizes threads to ensure that when executing a given
715bd8deadSopenharmony_ci    instruction, all previous instructions have completed for all program
725bd8deadSopenharmony_ci    invocations in the group.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    The tessellation primitive generator then decomposes a patch into a new
755bd8deadSopenharmony_ci    set of primitives using the tessellation levels to determine how finely
765bd8deadSopenharmony_ci    tessellated the output should be.  The primitive generator begins with
775bd8deadSopenharmony_ci    either a triangle or a quad, and splits each outer edge of the primitive
785bd8deadSopenharmony_ci    into a number of segments approximately equal to the corresponding element
795bd8deadSopenharmony_ci    of the outer tessellation level array.  The interior of the primitive is
805bd8deadSopenharmony_ci    tessellated according to elements of the inner tessellation level array.
815bd8deadSopenharmony_ci    The primitive generator has three modes:  TRIANGLES and QUADS split a
825bd8deadSopenharmony_ci    triangular or quad-shaped patch into a set of triangles that cover the
835bd8deadSopenharmony_ci    original patch; ISOLINES_NV splits a quad-shaped patch into a set of line
845bd8deadSopenharmony_ci    strips spanning the patch.  Each vertex generated by the tessellation
855bd8deadSopenharmony_ci    primitive generator is assigned a (u,v) or (u,v,w) coordinate indicating
865bd8deadSopenharmony_ci    its relative location in the subdivided triangle or quad.
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    For each vertex produced by the tessellation primitive generator, the
895bd8deadSopenharmony_ci    tessellation evaluation program is run to compute its position and other
905bd8deadSopenharmony_ci    attributes of the vertex, using its (u,v) or (u,v,w) coordinate.  When
915bd8deadSopenharmony_ci    computing the final vertex attributes, the tessellation evaluation program
925bd8deadSopenharmony_ci    can also read the attributes of any of the vertices of the patch written
935bd8deadSopenharmony_ci    by the tessellation control program.  Tessellation evaluation program
945bd8deadSopenharmony_ci    invocations are completely independent, although all invocations for a
955bd8deadSopenharmony_ci    single patch share the same collection of input vertices and per-patch
965bd8deadSopenharmony_ci    attributes.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    The tessellator operates on vertices after they have been transformed by a
995bd8deadSopenharmony_ci    vertex program or fixed-function vertex processing.  The primitives
1005bd8deadSopenharmony_ci    generated by the tessellator are passed further down the OpenGL pipeline,
1015bd8deadSopenharmony_ci    where they can be used as inputs to geometry programs, transform feedback,
1025bd8deadSopenharmony_ci    and the rasterizer.
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    The tessellation control and evaluation programs are both optional.  If
1055bd8deadSopenharmony_ci    neither program type is present, the tessellation stage has no effect.  If
1065bd8deadSopenharmony_ci    no tessellation control program is present, the input patch provided by
1075bd8deadSopenharmony_ci    the application is passed directly to the tessellation primitive
1085bd8deadSopenharmony_ci    generator, and a set of fixed tessellation level parameters (specified via
1095bd8deadSopenharmony_ci    the PatchParameterfv function) is used to control primitive generation.
1105bd8deadSopenharmony_ci    If no tessellation evaluation program is present, the output patch
1115bd8deadSopenharmony_ci    produced by the tessellation control program is passed as a patch to
1125bd8deadSopenharmony_ci    subsequent pipeline stages, where it can be consumed by geometry programs,
1135bd8deadSopenharmony_ci    transform feedback, or the rasterizer.
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ciNew Procedures and Functions
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    None
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    (Note:  The PatchParameteri and PatchParameterfv functions from
1215bd8deadSopenharmony_ci     ARB_tessellation_shader will also be used by this extension.)
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ciNew Tokens
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, 
1265bd8deadSopenharmony_ci    by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 
1275bd8deadSopenharmony_ci    and GetDoublev, and by the <target> parameter of ProgramStringARB,
1285bd8deadSopenharmony_ci    BindProgramARB, ProgramEnvParameter4[df][v]ARB,
1295bd8deadSopenharmony_ci    ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB, 
1305bd8deadSopenharmony_ci    GetProgramLocalParameter[df]vARB, GetProgramivARB and
1315bd8deadSopenharmony_ci    GetProgramStringARB:
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci        TESS_CONTROL_PROGRAM_NV                         0x891E
1345bd8deadSopenharmony_ci        TESS_EVALUATION_PROGRAM_NV                      0x891F
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    Accepted by the <target> parameter of ProgramBufferParametersfvNV,
1375bd8deadSopenharmony_ci    ProgramBufferParametersIivNV, and ProgramBufferParametersIuivNV,
1385bd8deadSopenharmony_ci    BindBufferRangeNV, BindBufferOffsetNV, BindBufferBaseNV, and BindBuffer
1395bd8deadSopenharmony_ci    and the <value> parameter of GetIntegerIndexedvEXT:
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci        TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV        0x8C74
1425bd8deadSopenharmony_ci        TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV     0x8C75
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetProgramivARB:
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci        MAX_PROGRAM_PATCH_ATTRIBS_NV                    0x86D8
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    (Note:  Various enumerants from ARB_tessellation_shader will also be used
1495bd8deadSopenharmony_ci     by this extension.)
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.5 Specification (OpenGL Operation)
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    (Incorporate Section 2.X of the ARB_tessellation_shader specification,
1555bd8deadSopenharmony_ci     Tessellation in its entirety.)
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci    Insert a new section after Section 2.X.1 in ARB_tessellation_shader,
1585bd8deadSopenharmony_ci    Tessellation Control Shaders
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    Tessellation Control Programs
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Each patch primitive may be optionally processed by a tessellation control
1635bd8deadSopenharmony_ci    program, which operates similarly to the tessellation control shader
1645bd8deadSopenharmony_ci    described above.  Tessellation control programs are enabled by calling
1655bd8deadSopenharmony_ci    Enable with the value TESS_CONTROL_PROGRAM_NV.  If a GLSL program is
1665bd8deadSopenharmony_ci    active, the tessellation control program enable is ignored and treated as
1675bd8deadSopenharmony_ci    disabled unless the program contains only fragment shaders.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    When enabled, each patch primitive received by the GL will be processed by
1705bd8deadSopenharmony_ci    the tessellation control program to produce a new patch.  The tessellation
1715bd8deadSopenharmony_ci    control program emits a patch with a fixed number of vertices, given by
1725bd8deadSopenharmony_ci    the value specified in the VERTICES_OUT declaration.  It computes the
1735bd8deadSopenharmony_ci    attributes of each vertex of the output patch in parallel, and assembles
1745bd8deadSopenharmony_ci    the emitted vertices into an output patch.  The program also computes
1755bd8deadSopenharmony_ci    per-patch tessellation level values that control the number of vertices
1765bd8deadSopenharmony_ci    produced by the tessellation primitive generator when that patch is
1775bd8deadSopenharmony_ci    processed.  The program may also compute additional generic per-patch
1785bd8deadSopenharmony_ci    attributes that may be accessed by invocations of the tessellation
1795bd8deadSopenharmony_ci    evaluation program or a subsequent geometry program when processing the
1805bd8deadSopenharmony_ci    patch.  When the tessellation control program completes, the input patch
1815bd8deadSopenharmony_ci    is discarded and the output patch is processed by the remainder of the GL
1825bd8deadSopenharmony_ci    pipeline.
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    Each patch processed by the tessellation control program will result in
1855bd8deadSopenharmony_ci    multiple program invocations (threads), with one invocation per output
1865bd8deadSopenharmony_ci    patch vertex.  Each program invocation has a corresponding output patch
1875bd8deadSopenharmony_ci    vertex, and can write per-vertex attributes only for that vertex.  All
1885bd8deadSopenharmony_ci    program invocations may read and write per-patch attributes of the output
1895bd8deadSopenharmony_ci    patch, and may read per-vertex attributes of any vertex in the output
1905bd8deadSopenharmony_ci    patch.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    The tessellation control program threads are run as a group, and execute
1935bd8deadSopenharmony_ci    effectively in lock-step.  In this model, the execution of each
1945bd8deadSopenharmony_ci    instruction completes for all active threads before the execution of
1955bd8deadSopenharmony_ci    subsequent instruction is started.  All threads in the group are initially
1965bd8deadSopenharmony_ci    active, but the set of active threads change as flow-control instructions
1975bd8deadSopenharmony_ci    are encountered.  Full details on the execution model are specified in
1985bd8deadSopenharmony_ci    Section 2.X.5.
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci    Tessellation control programs execute using the instruction set documented
2015bd8deadSopenharmony_ci    in the GL_NV_gpu_program5 extension specification.  Tessellation control
2025bd8deadSopenharmony_ci    programs can read attributes from all vertices of the input patch, and
2035bd8deadSopenharmony_ci    each vertex attribute access must identify the vertex number being
2045bd8deadSopenharmony_ci    accessed.  For example, "vertex[1].position" and "vertex.in[1].position"
2055bd8deadSopenharmony_ci    identify the position of the second vertex (numbered "1") in the input
2065bd8deadSopenharmony_ci    patch.  Programs may also read attributes of all vertices of the output
2075bd8deadSopenharmony_ci    patch (e.g., "vertex.out[2].position") and per-patch attributes of the
2085bd8deadSopenharmony_ci    output patch (e.g., "primitive.out.attrib[3]").  In both cases, the output
2095bd8deadSopenharmony_ci    patch vertices or attributes accessed in this manner are undefined unless
2105bd8deadSopenharmony_ci    written by a previous instruction executed on one of the threads.
2115bd8deadSopenharmony_ci    Programs may also write attributes of their corresponding vertex in the
2125bd8deadSopenharmony_ci    output patch (e.g., "result.attrib[0]") and shared per-patch attributes
2135bd8deadSopenharmony_ci    (e.g., "result.patch.attrib[4]").  When writing output patch vertex
2145bd8deadSopenharmony_ci    attributes, a vertex number is not supplied.
2155bd8deadSopenharmony_ci    
2165bd8deadSopenharmony_ci    The only input primitives supported by tessellation control programs are
2175bd8deadSopenharmony_ci    patches.  The error INVALID_OPERATION is generated by Begin (or vertex
2185bd8deadSopenharmony_ci    array functions that implicitly call Begin) if a tessellation control
2195bd8deadSopenharmony_ci    program is active and <mode> is not PATCHES_NV.
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    Modify section after Section 2.X.2 of ARB_tessellation_shader,
2235bd8deadSopenharmony_ci    Tessellation Primitive Generation
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    (add to the end of the section describing the operation of the
2265bd8deadSopenharmony_ci     tessellation primitive generator when assembly tessellation evaluation
2275bd8deadSopenharmony_ci     programs are used)
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    If no GLSL program object is active, or if the active program contains
2305bd8deadSopenharmony_ci    only a fragment shader, the tessellation primitive generator will be
2315bd8deadSopenharmony_ci    active if and only if an assembly tessellation evaluation program is
2325bd8deadSopenharmony_ci    enabled.  When a tessellation evaluation program is used, the tessellation
2335bd8deadSopenharmony_ci    primitive generator will operate in exactly the manner describe above,
2345bd8deadSopenharmony_ci    except that the parameters controlling tessellation will be taken from
2355bd8deadSopenharmony_ci    declaration statements in the tessellation evaluation program.  The
2365bd8deadSopenharmony_ci    declaration statements used to specify each tessellation parameter are as
2375bd8deadSopenharmony_ci    described in Table X.1.  
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci          GLSL Program Parameter        TEP Declaration
2405bd8deadSopenharmony_ci          ------------------------      -----------------
2415bd8deadSopenharmony_ci          TESS_GEN_MODE_NV              TESS_MODE
2425bd8deadSopenharmony_ci          TESS_GEN_SPACING_NV           TESS_SPACING
2435bd8deadSopenharmony_ci          TESS_GEN_VERTEX_ORDER_NV      TESS_VERTEX_ORDER
2445bd8deadSopenharmony_ci          TESS_GEN_POINT_MODE_NV        TESS_POINT_MODE
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci      Table X.1, Parameters used to control tessellation when a program object
2475bd8deadSopenharmony_ci      with a tessellation evaluation shader is active and their tessellation
2485bd8deadSopenharmony_ci      evaluation program equivalents.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    If no tessellation control program is enabled, the default tessellation
2515bd8deadSopenharmony_ci    levels specified by calling PatchParameterfvNV with a <pname> of
2525bd8deadSopenharmony_ci    PATCH_DEFAULT_OUTER_LEVEL_NV or PATCH_DEFAULT_INNER_LEVEL_NV.
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    If a GLSL program containing only a fragment shader is active, any
2555bd8deadSopenharmony_ci    tessellation-related program parameters in effect when the program was
2565bd8deadSopenharmony_ci    linked have no effect on tessellation.
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci    Insert a new section after Section 2.X.3 in ARB_tessellation_shader,
2605bd8deadSopenharmony_ci    Tessellation Evaluation Shaders
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    Tessellation Evaluation Programs
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    If a tessellation evaluation program is active, the tessellation primitive
2655bd8deadSopenharmony_ci    generator will subdivide a basic primitive and run the tessellation
2665bd8deadSopenharmony_ci    evaluation program on each generated vertex.  Tessellation evaluation
2675bd8deadSopenharmony_ci    programs are enabled by calling Enable with the value
2685bd8deadSopenharmony_ci    TESS_EVALUATION_PROGRAM_NV.  If a GLSL program is active, the tessellation
2695bd8deadSopenharmony_ci    evaluation program enable is ignored and treated as disabled unless the
2705bd8deadSopenharmony_ci    program contains only fragment shaders.
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    When tessellation evaluation programs are enabled, each patch primitive
2735bd8deadSopenharmony_ci    received by the GL will trigger the tessellation primitive generator to
2745bd8deadSopenharmony_ci    perform primitive subdivision and generate a new set of vertices.  For
2755bd8deadSopenharmony_ci    each generated vertex, the tessellation evaluation program is invoked.
2765bd8deadSopenharmony_ci    Each tessellation evaluation program invocation produces a single output
2775bd8deadSopenharmony_ci    vertex.  These vertices are assembled into primitives according to the
2785bd8deadSopenharmony_ci    subdivision produced by the tessellation primitive generator, and these
2795bd8deadSopenharmony_ci    primitives are processed by the remainder of the GL pipeline.  The input
2805bd8deadSopenharmony_ci    patch used by the tessellation evaluation program is discarded.
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    Tessellation evaluation programs execute using the instruction set
2835bd8deadSopenharmony_ci    documented in the GL_NV_gpu_program5 extension specification and in a
2845bd8deadSopenharmony_ci    manner similar to vertex programs.  Tessellation control programs can read
2855bd8deadSopenharmony_ci    attributes from all vertices of the input patch, and each vertex attribute
2865bd8deadSopenharmony_ci    access must identify the vertex number being accessed.  For example,
2875bd8deadSopenharmony_ci    "vertex[1].position" identifies the transformed position of "vertex[1]",
2885bd8deadSopenharmony_ci    which is the second vertex in the input patch.  Additionally, the special
2895bd8deadSopenharmony_ci    attribute variable "vertex.tesscoord" is available to specify the location
2905bd8deadSopenharmony_ci    of the vertex within the subdivided primitive.  Per-patch attributes,
2915bd8deadSopenharmony_ci    including the tessellation levels, are also available.
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    The only input primitives supported by tessellation evaluation programs
2945bd8deadSopenharmony_ci    are patches.  The error INVALID_OPERATION is generated by Begin (or vertex
2955bd8deadSopenharmony_ci    array functions that implicitly call Begin) if a tessellation evaluation
2965bd8deadSopenharmony_ci    program is active and <mode> is not PATCHES_NV.
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    Modify Section 2.X.2 of NV_gpu_program4, Program Grammar
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci    (replace third paragraph)
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    Tessellation control programs are required to begin with the header string
3045bd8deadSopenharmony_ci    "!!NVtcp5.0".  Tessellation evaluation programs are required to begin with
3055bd8deadSopenharmony_ci    the header string "!!NVtep5.0".  These header strings identify the
3065bd8deadSopenharmony_ci    subsequent program body as being a tessellation control or evaluation
3075bd8deadSopenharmony_ci    program, respectively, and indicate that they should be parsed according
3085bd8deadSopenharmony_ci    to the base NV_gpu_program5 grammar plus the additions below.  Program
3095bd8deadSopenharmony_ci    string parsing begins with the character immediately following the header
3105bd8deadSopenharmony_ci    string.
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ci    (For tessellation control programs, add the following grammar rules to the
3135bd8deadSopenharmony_ci     NV_gpu_program5 base grammar)
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    <declSequence>          ::= <declaration> <declSequence>
3165bd8deadSopenharmony_ci
3175bd8deadSopenharmony_ci    <attribUseV>            ::= <attribColor> "." <faceType> <swizzleSuffix>
3185bd8deadSopenharmony_ci                              | <attribColor> "." <faceType> "." <colorType> 
3195bd8deadSopenharmony_ci                                <swizzleSuffix>
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci    <resultUseW>            ::= <resultVarName> <arrayMem> <optWriteMask>
3225bd8deadSopenharmony_ci                              | <resultColor> <optWriteMask>
3235bd8deadSopenharmony_ci                              | <resultColor> "." <colorType> <optWriteMask>
3245bd8deadSopenharmony_ci                              | <resultColor> "." <faceType> <optWriteMask>
3255bd8deadSopenharmony_ci                              | <resultColor> "." <faceType> "." <colorType> 
3265bd8deadSopenharmony_ci                                "." <optWriteMask>
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci    <resultUseD>            ::= <resultColor> <optFaceColorType>
3295bd8deadSopenharmony_ci                              | <resultMulti>
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    <optFaceColorType>      ::= <optColorType>
3325bd8deadSopenharmony_ci                              | "." <faceType> <optColorType>
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci    <declaration>           ::= "VERTICES_OUT" <int>
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    <attribBasic>           ::= <vtxPrefix> "position"
3375bd8deadSopenharmony_ci                              | <vtxPrefix> "fogcoord"
3385bd8deadSopenharmony_ci                              | <vtxPrefix> "pointsize"
3395bd8deadSopenharmony_ci                              | <vtxPrefix> "id"
3405bd8deadSopenharmony_ci                              | <attribTexCoord> <optArrayMemAbs>
3415bd8deadSopenharmony_ci                              | <attribClip> <arrayMemAbs>
3425bd8deadSopenharmony_ci                              | <attribGeneric> <arrayMemAbs>
3435bd8deadSopenharmony_ci                              | <primPrefix> "." "id"
3445bd8deadSopenharmony_ci                              | <primPrefix> "." "invocation"
3455bd8deadSopenharmony_ci                              | <primPrefix> "." "vertexcount"
3465bd8deadSopenharmony_ci                              | <attribTessOuter> <arrayMemAbs>
3475bd8deadSopenharmony_ci                              | <attribTessInner> <arrayMemAbs>
3485bd8deadSopenharmony_ci                              | <attribPatchGeneric> <arrayMemAbs>
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci    <attribColor>           ::= <vtxPrefix> "color"
3515bd8deadSopenharmony_ci
3525bd8deadSopenharmony_ci    <attribMulti>           ::= <attribTexCoord> <arrayRange>
3535bd8deadSopenharmony_ci                              | <attribClip> <arrayRange>
3545bd8deadSopenharmony_ci                              | <attribGeneric> <arrayRange>
3555bd8deadSopenharmony_ci                              | <attribTessOuter> <arrayRange>
3565bd8deadSopenharmony_ci                              | <attribTessInner> <arrayRange>
3575bd8deadSopenharmony_ci                              | <attribPatchGeneric> <arrayRange>
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci    <attribTexCoord>        ::= <vtxPrefix> "texcoord"
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci    <attribClip>            ::= <vtxPrefix> "clip"
3625bd8deadSopenharmony_ci
3635bd8deadSopenharmony_ci    <attribGeneric>         ::= <vtxPrefix> "attrib"
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    <attribTessOuter>       ::= <primPrefix> "." "tessouter"
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci    <attribTessInner>       ::= <primPrefix> "." "tessinner"
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    <attribPatchGeneric>    ::= <primPrefix> "." "patch" "." "attrib"
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    <vtxPrefix>             ::= "vertex" "."
3725bd8deadSopenharmony_ci                              | "vertex" <arrayMemAbs> "."
3735bd8deadSopenharmony_ci                              | "vertex" "." "in" <optArrayMemAbs> "."
3745bd8deadSopenharmony_ci                              | "vertex" "." "out" <optArrayMemAbs> "."
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci    <primPrefix>            ::= "primitive" "."
3775bd8deadSopenharmony_ci                              | "primitive" "." "in" "."
3785bd8deadSopenharmony_ci                              | "primitive" "." "out" "."
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    <resultBasic>           ::= <resPrefix> "position"
3815bd8deadSopenharmony_ci                              | <resPrefix> "fogcoord"
3825bd8deadSopenharmony_ci                              | <resPrefix> "pointsize"
3835bd8deadSopenharmony_ci                              | <resultTexCoord> <optArrayMemAbs>
3845bd8deadSopenharmony_ci                              | <resultClip> <arrayMemAbs>
3855bd8deadSopenharmony_ci                              | <resultGeneric> <arrayMemAbs>
3865bd8deadSopenharmony_ci                              | <resPrefix> "id"
3875bd8deadSopenharmony_ci                              | <resultTessOuter> <arrayMemAbs>
3885bd8deadSopenharmony_ci                              | <resultTessInner> <arrayMemAbs>
3895bd8deadSopenharmony_ci                              | <resultPatchGeneric> <arrayMemAbs>
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    <resultColor>           ::= <resPrefix> "color"
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    <resultMulti>           ::= <resultTexCoord> <arrayRange>
3945bd8deadSopenharmony_ci                              | <resultClip> <arrayRange>
3955bd8deadSopenharmony_ci                              | <resultGeneric> <arrayRange>
3965bd8deadSopenharmony_ci                              | <resultTessOuter> <arrayRange>
3975bd8deadSopenharmony_ci                              | <resultTessInner> <arrayRange>
3985bd8deadSopenharmony_ci                              | <resultPatchGeneric> <arrayRange>
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci    <resultTexCoord>        ::= <resPrefix> "texcoord"
4015bd8deadSopenharmony_ci
4025bd8deadSopenharmony_ci    <resultClip>            ::= <resPrefix> "clip"
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci    <resultGeneric>         ::= <resPrefix> "attrib"
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    <resultTessOuter>       ::= <resPrefix> "." "patch" "." "tessouter"
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci    <resultTessInner>       ::= <resPrefix> "." "patch" "." "tessinner"
4095bd8deadSopenharmony_ci
4105bd8deadSopenharmony_ci    <resultPatchGeneric>    ::= <resPrefix> "." "patch" "." "attrib"
4115bd8deadSopenharmony_ci
4125bd8deadSopenharmony_ci    <resPrefix>             ::= "result" "."
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    (For tessellation evaluation programs, add the following grammar rules to
4165bd8deadSopenharmony_ci     the NV_gpu_program5 base grammar)
4175bd8deadSopenharmony_ci
4185bd8deadSopenharmony_ci    <declSequence>          ::= <declaration> <declSequence>
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ci    <attribUseV>            ::= <attribColor> "." <faceType> <swizzleSuffix>
4215bd8deadSopenharmony_ci                              | <attribColor> "." <faceType> "." <colorType> 
4225bd8deadSopenharmony_ci                                <swizzleSuffix>
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    <resultUseW>            ::= <resultVarName> <arrayMem> <optWriteMask>
4255bd8deadSopenharmony_ci                              | <resultColor> <optWriteMask>
4265bd8deadSopenharmony_ci                              | <resultColor> "." <colorType> <optWriteMask>
4275bd8deadSopenharmony_ci                              | <resultColor> "." <faceType> <optWriteMask>
4285bd8deadSopenharmony_ci                              | <resultColor> "." <faceType> "." <colorType> 
4295bd8deadSopenharmony_ci                                "." <optWriteMask>
4305bd8deadSopenharmony_ci
4315bd8deadSopenharmony_ci    <resultUseD>            ::= <resultColor> <optFaceColorType>
4325bd8deadSopenharmony_ci                              | <resultMulti>
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    <optFaceColorType>      ::= <optColorType>
4355bd8deadSopenharmony_ci                              | "." <faceType> <optColorType>
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    <declaration>           ::= "TESS_MODE" <declTessMode>
4385bd8deadSopenharmony_ci                              | "TESS_SPACING" <declTessSpacing>
4395bd8deadSopenharmony_ci                              | "TESS_VERTEX_ORDER" <declTessVtxOrder>
4405bd8deadSopenharmony_ci                              | "TESS_POINT_MODE"
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci    <declTessMode>          ::= "TRIANGLES"
4435bd8deadSopenharmony_ci                              | "QUADS"
4445bd8deadSopenharmony_ci                              | "ISOLINES"
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ci    <declTessSpacing>       ::= "EQUAL"
4475bd8deadSopenharmony_ci                              | "FRACTIONAL_ODD"
4485bd8deadSopenharmony_ci                              | "FRACTIONAL_EVEN"
4495bd8deadSopenharmony_ci
4505bd8deadSopenharmony_ci    <declTessVtxOrder>      ::= "CW"
4515bd8deadSopenharmony_ci                              | "CCW"
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    <attribBasic>           ::= <vtxPrefix> "position"
4545bd8deadSopenharmony_ci                              | <vtxPrefix> "fogcoord"
4555bd8deadSopenharmony_ci                              | <vtxPrefix> "pointsize"
4565bd8deadSopenharmony_ci                              | <vtxPrefix> "id"
4575bd8deadSopenharmony_ci                              | <attribTexCoord> <optArrayMemAbs>
4585bd8deadSopenharmony_ci                              | <attribClip> <arrayMemAbs>
4595bd8deadSopenharmony_ci                              | <attribGeneric> <arrayMemAbs>
4605bd8deadSopenharmony_ci                              | "vertex" "." "tesscoord"
4615bd8deadSopenharmony_ci                              | <primPrefix> "id"
4625bd8deadSopenharmony_ci                              | <primPrefix> "vertexcount"
4635bd8deadSopenharmony_ci                              | <attribTessOuter> <optArrayMemAbs>
4645bd8deadSopenharmony_ci                              | <attribTessInner> <optArrayMemAbs>
4655bd8deadSopenharmony_ci                              | <attribPatchGeneric> <optArrayMemAbs>
4665bd8deadSopenharmony_ci
4675bd8deadSopenharmony_ci    <attribColor>           ::= <vtxPrefix> "color"
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ci    <attribMulti>           ::= <attribTexCoord> <arrayRange>
4705bd8deadSopenharmony_ci                              | <attribClip> <arrayRange>
4715bd8deadSopenharmony_ci                              | <attribGeneric> <arrayRange>
4725bd8deadSopenharmony_ci                              | <attribTessOuter> <arrayRange>
4735bd8deadSopenharmony_ci                              | <attribTessInner> <arrayRange>
4745bd8deadSopenharmony_ci                              | <attribPatchGeneric> <arrayRange>
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    <attribTexCoord>        ::= <vtxPrefix> "texcoord"
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    <attribClip>            ::= <vtxPrefix> "clip"
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    <attribGeneric>         ::= <vtxPrefix> "attrib"
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci    <attribTessOuter>       ::= <primPrefix> "." "tessouter"
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci    <attribTessInner>       ::= <primPrefix> "." "tessinner"
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    <attribPatchGeneric>    ::= <primPrefix> "." "patch" "." "attrib"
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci    <vtxPrefix>             ::= "vertex" "."
4895bd8deadSopenharmony_ci                              | "vertex" <arrayMemAbs> "."
4905bd8deadSopenharmony_ci                              | "vertex" "." "in" <optArrayMemAbs> "."
4915bd8deadSopenharmony_ci                              | "vertex" "." "out" <optArrayMemAbs> "."
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci    <primPrefix>            ::= "primitive" "."
4945bd8deadSopenharmony_ci                              | "primitive" "." "in" "."
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci    <resultBasic>           ::= <resPrefix> "position"
4975bd8deadSopenharmony_ci                              | <resPrefix> "fogcoord"
4985bd8deadSopenharmony_ci                              | <resPrefix> "pointsize"
4995bd8deadSopenharmony_ci                              | <resultTexCoord> <optArrayMemAbs>
5005bd8deadSopenharmony_ci                              | <resultClip> <arrayMemAbs>
5015bd8deadSopenharmony_ci                              | <resultGeneric> <arrayMemAbs>
5025bd8deadSopenharmony_ci                              | <resPrefix> "id"
5035bd8deadSopenharmony_ci
5045bd8deadSopenharmony_ci    <resultColor>           ::= <resPrefix> "color"
5055bd8deadSopenharmony_ci
5065bd8deadSopenharmony_ci    <resultMulti>           ::= <resultTexCoord> <arrayRange>
5075bd8deadSopenharmony_ci                              | <resultClip> <arrayRange>
5085bd8deadSopenharmony_ci                              | <resultGeneric> <arrayRange>
5095bd8deadSopenharmony_ci
5105bd8deadSopenharmony_ci    <resultTexCoord>        ::= <resPrefix> "texcoord"
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    <resultClip>            ::= <resPrefix> "clip"
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci    <resultGeneric>         ::= <resPrefix> "attrib"
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci    <resPrefix>             ::= "result" "."
5175bd8deadSopenharmony_ci   
5185bd8deadSopenharmony_ci
5195bd8deadSopenharmony_ci    (add the following subsection to section 2.X.3.2 of NV_gpu_program4, 
5205bd8deadSopenharmony_ci     Program Attribute Variables)
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci    Tessellation control and evaluation program attribute variables describe
5235bd8deadSopenharmony_ci    inputs accessible to the program.  There are several different classes of
5245bd8deadSopenharmony_ci    attribute bindings available, identified by the binding prefix.  The set
5255bd8deadSopenharmony_ci    of attribute binding classes and their corresponding prefixes are
5265bd8deadSopenharmony_ci    described in Table X.2.  The specific attributes for each class are
5275bd8deadSopenharmony_ci    identified by a binding suffix.
5285bd8deadSopenharmony_ci
5295bd8deadSopenharmony_ci      Attribute Binding Prefix   Description
5305bd8deadSopenharmony_ci      ------------------------   ------------------------------------------
5315bd8deadSopenharmony_ci      vertex[m]                  Vertex <m> of the input patch
5325bd8deadSopenharmony_ci      vertex.in[m]               Vertex <m> of the input patch
5335bd8deadSopenharmony_ci      vertex                     Array spanning vertices of the input patch
5345bd8deadSopenharmony_ci                                   or the specific vertex being evaluated
5355bd8deadSopenharmony_ci      vertex.in                  Array spanning vertices of the input patch
5365bd8deadSopenharmony_ci                                   or the specific vertex being evaluated
5375bd8deadSopenharmony_ci      primitive                  Per-patch value of the input patch
5385bd8deadSopenharmony_ci      primitive.in               Per-patch value of the input patch
5395bd8deadSopenharmony_ci      vertex.out[m]              Vertex <m> of the output patch
5405bd8deadSopenharmony_ci      vertex.out                 Array spanning vertices of the output patch
5415bd8deadSopenharmony_ci      primitive.out              Per-patch value of the output patch
5425bd8deadSopenharmony_ci
5435bd8deadSopenharmony_ci      Table X.2, Tessellation Control and Evaluation Program Attribute Binding
5445bd8deadSopenharmony_ci      Prefixes.  <m> refers to a constant integer vertex number in the input
5455bd8deadSopenharmony_ci      or output patch.
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ci    If an attribute binding prefix matches "vertex[m]" or "vertex.in[m]", the
5485bd8deadSopenharmony_ci    attribute binding refers to an attribute of the vertex numbered <m> in the
5495bd8deadSopenharmony_ci    input patch.  If <m> is greater than or equal to the number of vertices in
5505bd8deadSopenharmony_ci    the input patch, the values corresponding to the binding are undefined.
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci    If an attribute binding prefix matches "vertex" or "vertex.in" and the
5535bd8deadSopenharmony_ci    suffix identifies an attribute of the vertex being processed by a
5545bd8deadSopenharmony_ci    tessellation evaluation program (e.g., "tesscoord"), the attribute binding
5555bd8deadSopenharmony_ci    refers to that attribute.
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci    If an attribute binding prefix matches "vertex" or "vertex.in" and the
5585bd8deadSopenharmony_ci    suffix identifies any other vertex attribute, the attribute binding refers
5595bd8deadSopenharmony_ci    to that specific attribute for each of the vertices of the input patch.
5605bd8deadSopenharmony_ci    Bindings of this form may only be used in explicit variable declarations.
5615bd8deadSopenharmony_ci    If the variable declaration identifies an array, the program will fail to
5625bd8deadSopenharmony_ci    load unless each binding in the binding list uses an attribute prefix of
5635bd8deadSopenharmony_ci    this form.  When such variables are used in instructions, they must be
5645bd8deadSopenharmony_ci    accessed as an array, with the first array index identifying the vertex
5655bd8deadSopenharmony_ci    number.  If such variables are declared as an array, a second array index
5665bd8deadSopenharmony_ci    must be provided to identify the specific per-vertex attribute to select.
5675bd8deadSopenharmony_ci    If the first array index is negative or greater than or equal to the
5685bd8deadSopenharmony_ci    number of vertices in the input patch, the value obtained is undefined.
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci    If an attribute binding prefix matches "primitive" or "primitive.in", the
5715bd8deadSopenharmony_ci    attribute binding refers to an attribute of the input patch.
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci    If a tessellation control program attribute binding prefix matches
5745bd8deadSopenharmony_ci    "vertex.out[m]", the attribute binding refers to an attribute of the
5755bd8deadSopenharmony_ci    vertex numbered <m> in the output patch.  These attributes correspond to
5765bd8deadSopenharmony_ci    per-vertex output values written by the tessellation control program
5775bd8deadSopenharmony_ci    thread numbered <m>.  A program will fail to load if the vertex number <m>
5785bd8deadSopenharmony_ci    is greater than or equal to the number of vertices in the output patch.
5795bd8deadSopenharmony_ci    Tessellation evaluation programs do not have an output patch and do not
5805bd8deadSopenharmony_ci    support this attribute binding prefix.
5815bd8deadSopenharmony_ci
5825bd8deadSopenharmony_ci    If a tessellation control program attribute binding prefix matches
5835bd8deadSopenharmony_ci    "vertex.out", the attribute binding identifies a specific attribute for
5845bd8deadSopenharmony_ci    each of the vertices of the output patch.  Bindings of this form may only
5855bd8deadSopenharmony_ci    be used in explicit variable declarations, and all the usage rules
5865bd8deadSopenharmony_ci    described above for bindings using the prefix "vertex.in" apply.  If the
5875bd8deadSopenharmony_ci    vertex number identified when accessing such variables is negative or
5885bd8deadSopenharmony_ci    greater than or equal to the number of vertices in the output patch, the
5895bd8deadSopenharmony_ci    resulting values are undefined.  Tessellation evaluation programs do not
5905bd8deadSopenharmony_ci    have an output patch and do not support this attribute binding suffix.
5915bd8deadSopenharmony_ci
5925bd8deadSopenharmony_ci    If an attribute binding prefix matches "primitive.out", the attribute
5935bd8deadSopenharmony_ci    binding refers to a per-patch attribute of the output patch.  These
5945bd8deadSopenharmony_ci    attributes correspond to per-patch result values written by one of the
5955bd8deadSopenharmony_ci    tessellation control program threads.  Tessellation evaluation programs do
5965bd8deadSopenharmony_ci    not have an output patch and do not support this attribute binding suffix.
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci    The following examples illustrate various legal and illegal program
5995bd8deadSopenharmony_ci    bindings and their meanings.
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci      ATTRIB pos = vertex.position;
6025bd8deadSopenharmony_ci      ATTRIB pos2 = vertex.in[2].position;
6035bd8deadSopenharmony_ci      ATTRIB outpos = vertex.out.position; 
6045bd8deadSopenharmony_ci      ATTRIB outpos2 = vertex.out[2].position; 
6055bd8deadSopenharmony_ci      ATTRIB texcoords[] = { vertex.texcoord[0..3] };
6065bd8deadSopenharmony_ci      ATTRIB tcoords1[4] = { vertex[1].texcoord[1..4] };
6075bd8deadSopenharmony_ci      ATTRIB outattr[2] = { vertex.out.attrib[0..1] };
6085bd8deadSopenharmony_ci      INT TEMP A0;
6095bd8deadSopenharmony_ci      ...
6105bd8deadSopenharmony_ci      MOV R0, pos[1];                   # position of input vertex 1
6115bd8deadSopenharmony_ci      MOV R0, vertex[1].position;       # position of input vertex 1
6125bd8deadSopenharmony_ci      MOV R0, pos2;                     # position of input vertex 2
6135bd8deadSopenharmony_ci      MOV R0, outpos;                   # ILLEGAL - needs a vertex number
6145bd8deadSopenharmony_ci      MOV R0, outpos[1];                # position of output vertex 1 (TCP)
6155bd8deadSopenharmony_ci      MOV R0, outpos2;                  # position of output vertex 2 (TCP)
6165bd8deadSopenharmony_ci      MOV R0, texcoords[A0.x][1];       # texcoord 1 of input vertex A0.x
6175bd8deadSopenharmony_ci      MOV R0, texcoords[A0.x][A0.y];    # texcoord A0.y of input vertex A0.x
6185bd8deadSopenharmony_ci      MOV R0, tcoords1[2];              # texcoord 3 of input vertex 1
6195bd8deadSopenharmony_ci      MOV R0, outattr[A0.x][1];         # generic attr 1 of output vertex 
6205bd8deadSopenharmony_ci                                        # A0.x (TCP)
6215bd8deadSopenharmony_ci      MOV R0, vertex[A0.x].texcoord[1]; # ILLEGAL -- vertex number must be 
6225bd8deadSopenharmony_ci                                        # constant or must use variables like
6235bd8deadSopenharmony_ci                                        # "texcoords" using bindings w/o
6245bd8deadSopenharmony_ci                                        # vertex numbers
6255bd8deadSopenharmony_ci
6265bd8deadSopenharmony_ci    Attributes from input patch vertices will be obtained from the per-vertex
6275bd8deadSopenharmony_ci    outputs of the previous program used to generate the vertex in question.
6285bd8deadSopenharmony_ci    For tessellation evaluation programs, that previous program would be the
6295bd8deadSopenharmony_ci    tessellation control program, if enabled, or the vertex program otherwise.
6305bd8deadSopenharmony_ci    For tessellation control programs, the previous program is always the
6315bd8deadSopenharmony_ci    vertex program.  Tessellation control and evaluation program attributes
6325bd8deadSopenharmony_ci    should be read using the same component data type used to write the
6335bd8deadSopenharmony_ci    corresponding vertex program results.  If input patch vertices are
6345bd8deadSopenharmony_ci    specified to come from vertex program outputs but no vertex program is
6355bd8deadSopenharmony_ci    enabled, the values are instead produced from fixed-function vertex
6365bd8deadSopenharmony_ci    processing.  The value of any attribute corresponding to a vertex output
6375bd8deadSopenharmony_ci    not written by the previous program stage is undefined, as are the values
6385bd8deadSopenharmony_ci    of all generic attributes if the vertex was produced by fixed-function
6395bd8deadSopenharmony_ci    vertex processing.
6405bd8deadSopenharmony_ci
6415bd8deadSopenharmony_ci    Attributes from output patch vertices are only available in tessellation
6425bd8deadSopenharmony_ci    control programs, and will be obtained from the per-vertex outputs of the
6435bd8deadSopenharmony_ci    same program.  When executing an instruction, the values of any output
6445bd8deadSopenharmony_ci    patch vertex attribute are undefined unless the corresponding program
6455bd8deadSopenharmony_ci    output was written by a previously executed instruction.
6465bd8deadSopenharmony_ci
6475bd8deadSopenharmony_ci    Per-patch attributes of the input patch are only available in tessellation
6485bd8deadSopenharmony_ci    evaluation and geometry programs.  If a tessellation control program is
6495bd8deadSopenharmony_ci    enabled, they will be obtained from the corresponding per-patch outputs of
6505bd8deadSopenharmony_ci    the tessellation control program producing the patch, and any attributes
6515bd8deadSopenharmony_ci    not written by any thread of the control program are undefined.  If no
6525bd8deadSopenharmony_ci    tessellation control program is enabled, the inner and outer tessellation
6535bd8deadSopenharmony_ci    levels are taken from the default tessellation levels, and all other
6545bd8deadSopenharmony_ci    per-patch attributes are undefined.
6555bd8deadSopenharmony_ci
6565bd8deadSopenharmony_ci    Per-patch attributes of the output patch are available only in
6575bd8deadSopenharmony_ci    tessellation control programs and will be obtained from the per-patch
6585bd8deadSopenharmony_ci    outputs of the same program.  When executing an instruction, the values of
6595bd8deadSopenharmony_ci    any output patch attribute are undefined unless the corresponding program
6605bd8deadSopenharmony_ci    output was written by a previously executed instruction.
6615bd8deadSopenharmony_ci
6625bd8deadSopenharmony_ci    The attributes of the vertices of an input or output patch vertex are
6635bd8deadSopenharmony_ci    selected by an attribute binding suffix, as identified in Table X.3.  All
6645bd8deadSopenharmony_ci    such bindings correspond to one of multiple patch vertices and require a
6655bd8deadSopenharmony_ci    vertex number, either in the binding prefix used in the instruction or as
6665bd8deadSopenharmony_ci    the first array index when using an explicitly declared attribute variable
6675bd8deadSopenharmony_ci    whose bindings have no vertex number.
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci      Vertex Binding Suffix      Components   Description
6705bd8deadSopenharmony_ci      ------------------------   ----------   ----------------------------
6715bd8deadSopenharmony_ci      position                    (x,y,z,w)   clip coordinates
6725bd8deadSopenharmony_ci      color                       (r,g,b,a)   front primary color
6735bd8deadSopenharmony_ci      color.primary               (r,g,b,a)   front primary color
6745bd8deadSopenharmony_ci      color.secondary             (r,g,b,a)   front secondary color
6755bd8deadSopenharmony_ci      color.front                 (r,g,b,a)   front primary color
6765bd8deadSopenharmony_ci      color.front.primary         (r,g,b,a)   front primary color
6775bd8deadSopenharmony_ci      color.front.secondary       (r,g,b,a)   front secondary color
6785bd8deadSopenharmony_ci      color.back                  (r,g,b,a)   back primary color
6795bd8deadSopenharmony_ci      color.back.primary          (r,g,b,a)   back primary color
6805bd8deadSopenharmony_ci      color.back.secondary        (r,g,b,a)   back secondary color
6815bd8deadSopenharmony_ci      fogcoord                    (f,-,-,-)   fog coordinate
6825bd8deadSopenharmony_ci      pointsize                   (s,-,-,-)   point size
6835bd8deadSopenharmony_ci      texcoord                    (s,t,r,q)   texture coordinate, unit 0
6845bd8deadSopenharmony_ci      texcoord[n]                 (s,t,r,q)   texture coordinate, unit n
6855bd8deadSopenharmony_ci      attrib[n]                   (x,y,z,w)   generic interpolant n
6865bd8deadSopenharmony_ci      clip[n]                     (d,-,-,-)   clip plane distance
6875bd8deadSopenharmony_ci      texcoord[n..o]              (s,t,r,q)   array of texture coordinates
6885bd8deadSopenharmony_ci      attrib[n..o]                (x,y,z,w)   array of generic interpolants
6895bd8deadSopenharmony_ci      clip[n..o]                  (d,-,-,-)   array of clip distances
6905bd8deadSopenharmony_ci      id                          (id,-,-,-)  vertex id
6915bd8deadSopenharmony_ci
6925bd8deadSopenharmony_ci      Table X.3, Tessellation Control and Evaluation Program Per-Patch Vertex
6935bd8deadSopenharmony_ci      Attribute Bindings.  <n> and <o> refer to integer constants.
6945bd8deadSopenharmony_ci
6955bd8deadSopenharmony_ci    If an attribute binding suffix matches "position", the "x", "y", "z" and
6965bd8deadSopenharmony_ci    "w" components of the attribute variable are filled with the "x", "y",
6975bd8deadSopenharmony_ci    "z", and "w" components, respectively, of the transformed position of the
6985bd8deadSopenharmony_ci    specified vertex, in clip coordinates.
6995bd8deadSopenharmony_ci
7005bd8deadSopenharmony_ci    If an attribute binding suffix matches any binding in Table X.3 beginning
7015bd8deadSopenharmony_ci    with "color", the "x", "y", "z", and "w" components of the attribute
7025bd8deadSopenharmony_ci    variable are filled with the "r", "g", "b", and "a" components,
7035bd8deadSopenharmony_ci    respectively, of the corresponding color of the specified vertex.
7045bd8deadSopenharmony_ci    Bindings containing "front" and "back" refer to the front and back colors,
7055bd8deadSopenharmony_ci    respectively.  Bindings containing "primary" and "secondary" refer to
7065bd8deadSopenharmony_ci    primary and secondary colors, respectively.  If face or color type is
7075bd8deadSopenharmony_ci    omitted in the binding, the binding is treated as though "front" and
7085bd8deadSopenharmony_ci    "primary", respectively, were specified.
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci    If an attribute binding suffix matches "fogcoord", the "x" component of
7115bd8deadSopenharmony_ci    the attribute variable is filled with the fog coordinate of the specified
7125bd8deadSopenharmony_ci    vertex.  The "y", "z", and "w" components are undefined.
7135bd8deadSopenharmony_ci
7145bd8deadSopenharmony_ci    If an attribute binding suffix matches "pointsize", the "x" component of
7155bd8deadSopenharmony_ci    the attribute variable is filled with the point size of the specified
7165bd8deadSopenharmony_ci    vertex.  If the vertex was produced by fixed-function vertex processing,
7175bd8deadSopenharmony_ci    the point size attribute is undefined.  The "y", "z", and "w" components
7185bd8deadSopenharmony_ci    are always undefined.
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci    If an attribute binding suffix matches "texcoord" or "texcoord[n]", the
7215bd8deadSopenharmony_ci    "x", "y", "z", and "w" coordinates of the attribute variable are filled
7225bd8deadSopenharmony_ci    with the "s", "t", "r", and "q" coordinates of texture coordinate set <n>
7235bd8deadSopenharmony_ci    of the specified vertex.  If <n> is omitted, texture coordinate set zero
7245bd8deadSopenharmony_ci    is used.
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci    If an attribute binding suffix matches "attrib[n]", the "x", "y", "z", and
7275bd8deadSopenharmony_ci    "w" components of the attribute variable are filled with the "x", "y",
7285bd8deadSopenharmony_ci    "z", and "w" coordinates of generic interpolant <n> of the specified.  All
7295bd8deadSopenharmony_ci    generic interpolants will be undefined when the vertex is produced by
7305bd8deadSopenharmony_ci    fixed-function vertex processing.
7315bd8deadSopenharmony_ci
7325bd8deadSopenharmony_ci    If an attribute binding suffix matches "clip[n]", the "x" component of the
7335bd8deadSopenharmony_ci    attribute variable is filled the clip distance of the specified vertex for
7345bd8deadSopenharmony_ci    clip plane <n>, as written by the vertex program.  If the vertex was
7355bd8deadSopenharmony_ci    produced by fixed-function vertex processing or a position-invariant
7365bd8deadSopenharmony_ci    vertex program, the clip distance is obtained by computing the per-clip
7375bd8deadSopenharmony_ci    plane dot product:
7385bd8deadSopenharmony_ci
7395bd8deadSopenharmony_ci      (p_1' p_2' p_3' p_4') dot (x_e y_e z_e w_e),
7405bd8deadSopenharmony_ci
7415bd8deadSopenharmony_ci    at the vertex location, as described in section 2.12.  The clip distance
7425bd8deadSopenharmony_ci    for clip plane <n> is undefined if clip plane <n> is disabled.  The "y",
7435bd8deadSopenharmony_ci    "z", and "w" components of the attribute are undefined.
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci    If an attribute binding suffix matches "texcoord[n..o]", "attrib[n..o]",
7465bd8deadSopenharmony_ci    or "clip[n..o]", a sequence of 1+<o>-<n> texture coordinate, generic
7475bd8deadSopenharmony_ci    attribute, or clip distance bindings is created.  For texture coordinate
7485bd8deadSopenharmony_ci    bindings, it is as though the sequence "vertex[m].texcoord[n],
7495bd8deadSopenharmony_ci    vertex[m].texcoord[n+1], ...  vertex[m].texcoord[o]" were specfied.  These
7505bd8deadSopenharmony_ci    bindings are available only in explicit declarations of array variables.
7515bd8deadSopenharmony_ci    A program will fail to load if <n> is greater than <o>.
7525bd8deadSopenharmony_ci
7535bd8deadSopenharmony_ci    If an attribute binding suffix matches "id", the "x" component is filled
7545bd8deadSopenharmony_ci    with the vertex ID of the specified vertex.  If the vertex was generated
7555bd8deadSopenharmony_ci    by a previous program, the attribute variable is filled with the vertex ID
7565bd8deadSopenharmony_ci    result written by that program.  Otherwise, the vertex ID is undefined.
7575bd8deadSopenharmony_ci    The "y", "z", and "w" components of the attribute are undefined.
7585bd8deadSopenharmony_ci
7595bd8deadSopenharmony_ci    Attribute bindings other than those corresponding to individual vertices
7605bd8deadSopenharmony_ci    in input and output patch are identified in Table X.4.  All of these items
7615bd8deadSopenharmony_ci    except for "vertex.tesscoord" are per-patch attributes, and require one of
7625bd8deadSopenharmony_ci    the prefixes beginning with "primitive".
7635bd8deadSopenharmony_ci
7645bd8deadSopenharmony_ci      Primitive Binding Suffix   Components  Description
7655bd8deadSopenharmony_ci      ------------------------   ----------  ----------------------------
7665bd8deadSopenharmony_ci      id                         (id,-,-,-)  primitive number
7675bd8deadSopenharmony_ci      invocation                 (id,-,-,-)  tess. control invocation
7685bd8deadSopenharmony_ci      vertexcount                (c,-,-,-)   vertices in primitive
7695bd8deadSopenharmony_ci      tessouter[n]               (x,-,-,-)   outer tess. level n
7705bd8deadSopenharmony_ci      tessinner[n]               (x,-,-,-)   inner tess. level n
7715bd8deadSopenharmony_ci      patch.attrib[n]            (x,y,z,w)   generic patch attribute n
7725bd8deadSopenharmony_ci      tessouter[n..o]            (x,-,-,-)   outer tess. levels n to o
7735bd8deadSopenharmony_ci      tessinner[n..o]            (x,-,-,-)   inner tess. levels n to o
7745bd8deadSopenharmony_ci      patch.attrib[n..o]         (x,y,z,w)   generic patch attrib n to o
7755bd8deadSopenharmony_ci      vertex.tesscoord (*)       (u,v,w,-)   tess. coordinate in [0,1]
7765bd8deadSopenharmony_ci
7775bd8deadSopenharmony_ci      Table X.4, Tessellation Control and Evaluation Miscellaneous Attribute
7785bd8deadSopenharmony_ci      Bindings.  <n> and <o> refer to integer constants.
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    If an attribute binding suffix matches "id", the "x" component is filled
7815bd8deadSopenharmony_ci    with the number of primitives received by the GL since the last time Begin
7825bd8deadSopenharmony_ci    was called (directly or indirectly via vertex array functions).  The first
7835bd8deadSopenharmony_ci    primitive generated after a Begin is numbered zero, and the primitive ID
7845bd8deadSopenharmony_ci    counter is incremented after every individual point, line, or polygon
7855bd8deadSopenharmony_ci    primitive is processed.  Restarting a primitive topology using the
7865bd8deadSopenharmony_ci    primitive restart index has no effect on the primitive ID counter.  The
7875bd8deadSopenharmony_ci    "y", "z", and "w" components of the variable are always undefined.  This
7885bd8deadSopenharmony_ci    suffix may only be used with the prefixes "primitive", "primitive.in", or
7895bd8deadSopenharmony_ci    "primitive.out", and produces the same value in all cases.
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci    If a tessellation control program attribute binding suffix matches
7925bd8deadSopenharmony_ci    "invocation", the "x" component is filled with the thread number of the
7935bd8deadSopenharmony_ci    program invocation.  The invocation number identifies the number of the
7945bd8deadSopenharmony_ci    vertex in the output patch whose attributes are produced by this
7955bd8deadSopenharmony_ci    invocation, and is in the range [0..<n>-1], where <n> is given by the
7965bd8deadSopenharmony_ci    VERTICES_OUT declaration.  The "y", "z", and "w" components of the
7975bd8deadSopenharmony_ci    variable are always undefined.  This suffix is not available to
7985bd8deadSopenharmony_ci    tessellation evaluation programs and may only be used with the prefixes
7995bd8deadSopenharmony_ci    "primitive", "primitive.in", or "primitive.out", and produces the same
8005bd8deadSopenharmony_ci    value in all cases.
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci    If an attribute binding suffix matches "vertexcount", the "x" component is
8035bd8deadSopenharmony_ci    filled with the number of vertices in the input primitive being processed.
8045bd8deadSopenharmony_ci    The "y", "z", and "w" components of the variable are always undefined.
8055bd8deadSopenharmony_ci    This suffix is available only with the prefixes "primitive" and
8065bd8deadSopenharmony_ci    "primitive.in".
8075bd8deadSopenharmony_ci
8085bd8deadSopenharmony_ci    If an attribute binding suffix matches "tessouter[n]", the "x" component
8095bd8deadSopenharmony_ci    is filled with the per-patch outer tessellation level numbered <n> of the
8105bd8deadSopenharmony_ci    identified input or output patch.  <n> must be less than four.  The "y",
8115bd8deadSopenharmony_ci    "z", and "w" components are always undefined.  This suffix is available
8125bd8deadSopenharmony_ci    only with the prefixes "primitive", "primitive.in", and "primitive.out".
8135bd8deadSopenharmony_ci    For tessellation control programs, this suffix is available only with
8145bd8deadSopenharmony_ci    "primitive.out".
8155bd8deadSopenharmony_ci
8165bd8deadSopenharmony_ci    If an attribute binding suffix matches "tessinner[n]", the "x" component
8175bd8deadSopenharmony_ci    is filled with the per-patch inner tessellation level numbered <n> of the
8185bd8deadSopenharmony_ci    identified input or output patch.  <n> must be less than two.  The "y",
8195bd8deadSopenharmony_ci    "z", and "w" components are always undefined.  This suffix is available
8205bd8deadSopenharmony_ci    only with the prefixes "primitive", "primitive.in", and "primitive.out".
8215bd8deadSopenharmony_ci    For tessellation control programs, this suffix is available only with
8225bd8deadSopenharmony_ci    "primitive.out".
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ci    If an attribute binding suffix matches "patch.attrib[n]", the "x", "y",
8255bd8deadSopenharmony_ci    "z", and "w" components are filled with the corresponding components of
8265bd8deadSopenharmony_ci    the per-patch generic attribute numbered <n> of the identified input or
8275bd8deadSopenharmony_ci    output patch.  This suffix is available only with the prefixes
8285bd8deadSopenharmony_ci    "primitive", "primitive.in", and "primitive.out".  For tessellation
8295bd8deadSopenharmony_ci    control programs, this suffix is available only with "primitive.out".
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci    If an attribute binding suffix matches "tessouter[n..o]",
8325bd8deadSopenharmony_ci    "tessinner[n..o]", or "patch.attrib[n..o]", a sequence of 1+<o>-<n> outer
8335bd8deadSopenharmony_ci    tessellation level, inner tessellation level, or per-patch generic
8345bd8deadSopenharmony_ci    attribute bindings is created.  For per-patch generic attribute bindings,
8355bd8deadSopenharmony_ci    it is as though the sequence "primitive.patch.attrib[n],
8365bd8deadSopenharmony_ci    primitive.patch.attrib[n+1], ...  primitive.patch.attrib[o]" were
8375bd8deadSopenharmony_ci    specfied.  These bindings are available only in explicit declarations of
8385bd8deadSopenharmony_ci    array variables.  A program will fail to load if <n> is greater than <o>.
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci    If a tessellation evaluation program attribute binding suffix matches
8415bd8deadSopenharmony_ci    "vertex.tesscoord", the "x", "y", and "z" components are filled with the
8425bd8deadSopenharmony_ci    floating-point (u,v,w) values, respectively, corresponding to the vertex
8435bd8deadSopenharmony_ci    being processed by the tessellation evaluation program.  For triangle
8445bd8deadSopenharmony_ci    tessellation, the (u,v,w) values are barycentric coordinates that specify
8455bd8deadSopenharmony_ci    the location of the vertex relative to the three corners of the subdivided
8465bd8deadSopenharmony_ci    triangle.  The (u,v,w) values are in the range [0,1] and sum to one.  For
8475bd8deadSopenharmony_ci    quad and isoline tessellation, the (u,v) values are in the range [0,1] and
8485bd8deadSopenharmony_ci    specify the relative horizontal and vertical position in the subdivided
8495bd8deadSopenharmony_ci    quad.  The third component of the (u,v,w) vector is undefined for quad and
8505bd8deadSopenharmony_ci    isoline tessellation.  The "w" component of the variable is always
8515bd8deadSopenharmony_ci    undefined.  This suffix is not available to tessellation control shaders
8525bd8deadSopenharmony_ci    and may only be used with the prefix "vertex".
8535bd8deadSopenharmony_ci
8545bd8deadSopenharmony_ci
8555bd8deadSopenharmony_ci    (add the following subsection to section 2.X.3.5 of NV_gpu_program4,
8565bd8deadSopenharmony_ci     Program Results.)
8575bd8deadSopenharmony_ci
8585bd8deadSopenharmony_ci    The attributes of individual output vertices are written by tessellation
8595bd8deadSopenharmony_ci    control and evaluation programs.  For tessellation control programs, these
8605bd8deadSopenharmony_ci    attributes are those of the output patch vertex corresponding to the
8615bd8deadSopenharmony_ci    program invocation.  For tessellation evaluation programs, these
8625bd8deadSopenharmony_ci    attributes specify the attributes of the vertex in the tessellated patch
8635bd8deadSopenharmony_ci    corresponding to the program invocation.  The set of allowable per-vertex
8645bd8deadSopenharmony_ci    result variable bindings is the same for tessellation control and
8655bd8deadSopenharmony_ci    evaluation programs correspond to attributes of output vertices and is
8665bd8deadSopenharmony_ci    given in Table X.5.
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci      Binding                        Components  Description
8695bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
8705bd8deadSopenharmony_ci      result.position                (x,y,z,w)   position in clip coordinates
8715bd8deadSopenharmony_ci      result.color                   (r,g,b,a)   front-facing primary color
8725bd8deadSopenharmony_ci      result.color.primary           (r,g,b,a)   front-facing primary color
8735bd8deadSopenharmony_ci      result.color.secondary         (r,g,b,a)   front-facing secondary color
8745bd8deadSopenharmony_ci      result.color.front             (r,g,b,a)   front-facing primary color
8755bd8deadSopenharmony_ci      result.color.front.primary     (r,g,b,a)   front-facing primary color
8765bd8deadSopenharmony_ci      result.color.front.secondary   (r,g,b,a)   front-facing secondary color
8775bd8deadSopenharmony_ci      result.color.back              (r,g,b,a)   back-facing primary color
8785bd8deadSopenharmony_ci      result.color.back.primary      (r,g,b,a)   back-facing primary color
8795bd8deadSopenharmony_ci      result.color.back.secondary    (r,g,b,a)   back-facing secondary color
8805bd8deadSopenharmony_ci      result.fogcoord                (f,*,*,*)   fog coordinate
8815bd8deadSopenharmony_ci      result.pointsize               (s,*,*,*)   point size
8825bd8deadSopenharmony_ci      result.texcoord                (s,t,r,q)   texture coordinate, unit 0
8835bd8deadSopenharmony_ci      result.texcoord[n]             (s,t,r,q)   texture coordinate, unit n
8845bd8deadSopenharmony_ci      result.attrib[n]               (x,y,z,w)   generic interpolant n
8855bd8deadSopenharmony_ci      result.clip[n]                 (d,*,*,*)   clip plane distance
8865bd8deadSopenharmony_ci      result.texcoord[n..o]          (s,t,r,q)   texture coordinates n thru o
8875bd8deadSopenharmony_ci      result.attrib[n..o]            (x,y,z,w)   generic interpolants n thru o
8885bd8deadSopenharmony_ci      result.clip[n..o]              (d,*,*,*)   clip distances n thru o
8895bd8deadSopenharmony_ci
8905bd8deadSopenharmony_ci      Table X.5:  Tessellation Control and Evaluation Program Per-Vertex 
8915bd8deadSopenharmony_ci      Result Variable Bindings.  Components labeled "*" are unused.
8925bd8deadSopenharmony_ci
8935bd8deadSopenharmony_ci    If a result variable binding matches "result.position", updates to the
8945bd8deadSopenharmony_ci    "x", "y", "z", and "w" components of the result variable modify the "x",
8955bd8deadSopenharmony_ci    "y", "z", and "w" components, respectively, of the transformed vertex's
8965bd8deadSopenharmony_ci    clip coordinates.  Final window coordinates of vertices used for
8975bd8deadSopenharmony_ci    rasterization will be generated for the vertex as described in section
8985bd8deadSopenharmony_ci    2.14.4.4.
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    If a result variable binding match begins with "result.color", updates to
9015bd8deadSopenharmony_ci    the "x", "y", "z", and "w" components of the result variable modify the
9025bd8deadSopenharmony_ci    "r", "g", "b", and "a" components, respectively, of the corresponding
9035bd8deadSopenharmony_ci    vertex color attribute in Table X.3.  Color bindings that do not specify
9045bd8deadSopenharmony_ci    "front" or "back" are consided to refer to front-facing colors.  Color
9055bd8deadSopenharmony_ci    bindings that do not specify "primary" or "secondary" are considered to
9065bd8deadSopenharmony_ci    refer to primary colors.
9075bd8deadSopenharmony_ci
9085bd8deadSopenharmony_ci    If a result variable binding matches "result.fogcoord", updates to the "x"
9095bd8deadSopenharmony_ci    component of the result variable set the transformed vertex's fog
9105bd8deadSopenharmony_ci    coordinate.  Updates to the "y", "z", and "w" components of the result
9115bd8deadSopenharmony_ci    variable have no effect.
9125bd8deadSopenharmony_ci
9135bd8deadSopenharmony_ci    If a result variable binding matches "result.pointsize", updates to the
9145bd8deadSopenharmony_ci    "x" component of the result variable set the transformed vertex's point
9155bd8deadSopenharmony_ci    size.  Updates to the "y", "z", and "w" components of the result variable
9165bd8deadSopenharmony_ci    have no effect.
9175bd8deadSopenharmony_ci
9185bd8deadSopenharmony_ci    If a result variable binding matches "result.texcoord" or
9195bd8deadSopenharmony_ci    "result.texcoord[n]", updates to the "x", "y", "z", and "w" components of
9205bd8deadSopenharmony_ci    the result variable set the "s", "t", "r" and "q" components,
9215bd8deadSopenharmony_ci    respectively, of the transformed vertex's texture coordinates for texture
9225bd8deadSopenharmony_ci    unit <n>.  If "[n]" is omitted, texture unit zero is selected.
9235bd8deadSopenharmony_ci
9245bd8deadSopenharmony_ci    If a result variable binding matches "result.attrib[n]", updates to the
9255bd8deadSopenharmony_ci    "x", "y", "z", and "w" components of the result variable set the "x", "y",
9265bd8deadSopenharmony_ci    "z", and "w" components of the generic interpolant <n>.
9275bd8deadSopenharmony_ci
9285bd8deadSopenharmony_ci    If a result variable binding matches "result.clip[n]", updates to the "x"
9295bd8deadSopenharmony_ci    component of the result variable set the clip distance for clip plane <n>.
9305bd8deadSopenharmony_ci
9315bd8deadSopenharmony_ci    If a result variable binding matches "result.texcoord[n..o]",
9325bd8deadSopenharmony_ci    "result.attrib[n..o]", or "result.clip[n..o]", a sequence of 1+<o>-<n>
9335bd8deadSopenharmony_ci    bindings is created.  For texture coordinates, it is as though the
9345bd8deadSopenharmony_ci    sequence "result.texcoord[n], result.texcoord[n+1],
9355bd8deadSopenharmony_ci    ... result.texcoord[o]" were specfied.  These bindings are available only
9365bd8deadSopenharmony_ci    in explicit declarations of array variables.  A program will fail to load
9375bd8deadSopenharmony_ci    if <n> is greater than <o>.
9385bd8deadSopenharmony_ci
9395bd8deadSopenharmony_ci    In addition to per-vertex attribute bindings, a set of per-patch result
9405bd8deadSopenharmony_ci    bindings are available to tessellation control programs, as described in
9415bd8deadSopenharmony_ci    Table X.6.  These bindings are not available to tessellation evaluation
9425bd8deadSopenharmony_ci    programs.
9435bd8deadSopenharmony_ci
9445bd8deadSopenharmony_ci      Binding                        Components  Description
9455bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
9465bd8deadSopenharmony_ci      result.patch.tessouter[n]      (x,*,*,*)   tessctl outer level n
9475bd8deadSopenharmony_ci      result.patch.tessinner[n]      (x,*,*,*)   tessctl inner level n
9485bd8deadSopenharmony_ci      result.patch.attrib[n]         (x,y,z,w)   per-patch generic attrib n
9495bd8deadSopenharmony_ci      result.patch.tessouter[n..o]   (x,*,*,*)   tessctl outer levels n thru o
9505bd8deadSopenharmony_ci      result.patch.tessinner[n..o]   (x,*,*,*)   tessctl inner levels n thru o
9515bd8deadSopenharmony_ci      result.patch.attrib[n..o]      (x,y,z,w)   per-patch attribs n thru o
9525bd8deadSopenharmony_ci
9535bd8deadSopenharmony_ci      Table X.4:  Tessellation Control Per-Patch Result Variable Bindings.  
9545bd8deadSopenharmony_ci      Components labeled "*" are unused.
9555bd8deadSopenharmony_ci
9565bd8deadSopenharmony_ci    If a result variable binding matches "result.patch.tessouter[n]", updates
9575bd8deadSopenharmony_ci    to the "x" component set the outer tessellation level numbered <n> for the
9585bd8deadSopenharmony_ci    output patch.  Updates to the "y", "z", and "w" components have no effect.
9595bd8deadSopenharmony_ci
9605bd8deadSopenharmony_ci    If a result variable binding matches "result.patch.tessinner[n]", updates
9615bd8deadSopenharmony_ci    to the "x" component set the inner tessellation level numbered <n> for the
9625bd8deadSopenharmony_ci    output patch.  Updates to the "y", "z", and "w" components have no effect.
9635bd8deadSopenharmony_ci
9645bd8deadSopenharmony_ci    If a result variable binding matches "result.patch.attrib[n]", updates to
9655bd8deadSopenharmony_ci    the "x", "y", "z", and "w" components of the result variable set the "x",
9665bd8deadSopenharmony_ci    "y", "z", and "w" components of the per-patch generic attribute numbered
9675bd8deadSopenharmony_ci    <n> for the output patch.
9685bd8deadSopenharmony_ci
9695bd8deadSopenharmony_ci    If a result variable binding matches "result.patch.tessouter[n..o]",
9705bd8deadSopenharmony_ci    "result.patch.tessinner[n..o]", or "result.patch.attrib[n..o]", a sequence
9715bd8deadSopenharmony_ci    of 1+<o>-<n> bindings is created.  For per-patch generic attributes, it is
9725bd8deadSopenharmony_ci    as though the sequence "result.patch.attrib[n], result.patch.attrib[n+1],
9735bd8deadSopenharmony_ci    ...  result.patch.attrib[o]" were specfied.  These bindings are available
9745bd8deadSopenharmony_ci    only in explicit declarations of array variables.  A program will fail to
9755bd8deadSopenharmony_ci    load if <n> is greater than <o>.
9765bd8deadSopenharmony_ci
9775bd8deadSopenharmony_ci    
9785bd8deadSopenharmony_ci    Modify Section 2.X.5 of NV_gpu_program4, Program Flow Control
9795bd8deadSopenharmony_ci
9805bd8deadSopenharmony_ci    (modify spec language at the end of the section to account for the
9815bd8deadSopenharmony_ci     different flow control model for tessellation control programs)
9825bd8deadSopenharmony_ci
9835bd8deadSopenharmony_ci    Tessellation Control Program Flow Control
9845bd8deadSopenharmony_ci
9855bd8deadSopenharmony_ci    For tessellation control programs, there are multiple program invocations
9865bd8deadSopenharmony_ci    for each patch processed that run as a group.  Any given program
9875bd8deadSopenharmony_ci    invocation can read per-vertex or per-patch attributes of the output
9885bd8deadSopenharmony_ci    patch, which may be computed during the execution of the program and may
9895bd8deadSopenharmony_ci    be computed by a different program invocation.  To provide defined
9905bd8deadSopenharmony_ci    behavior for such accesses, we specify that all threads for each patch run
9915bd8deadSopenharmony_ci    as a group.  When executing any block of instructions, all active threads
9925bd8deadSopenharmony_ci    will complete the excecution of one instruction before starting the
9935bd8deadSopenharmony_ci    execution of the subsequent instruction.  Flow control instructions may
9945bd8deadSopenharmony_ci    cause the flow of threads in a group to diverge and will modify the set of
9955bd8deadSopenharmony_ci    active threads.  The handling of flow control instructions is described in
9965bd8deadSopenharmony_ci    more detail below.
9975bd8deadSopenharmony_ci
9985bd8deadSopenharmony_ci    A tessellation control program is handled by executing all instructions in
9995bd8deadSopenharmony_ci    a block of instructions corresponding to the main subroutine, with all
10005bd8deadSopenharmony_ci    threads initially active.  This block consists of all instructions between
10015bd8deadSopenharmony_ci    the "main" label and the next subroutine label.  If no "main" label is
10025bd8deadSopenharmony_ci    present, the block starts with the first instruction in the program.  If
10035bd8deadSopenharmony_ci    there is no subroutine label following the beginning of the block, the
10045bd8deadSopenharmony_ci    block ends at the END instruction.  Instructions in the block are executed
10055bd8deadSopenharmony_ci    in order until all threads reach a termination condition.  A thread will
10065bd8deadSopenharmony_ci    terminate:
10075bd8deadSopenharmony_ci
10085bd8deadSopenharmony_ci      * if it executes a RET anywhere within the main subroutine, unless the
10095bd8deadSopenharmony_ci        RET instruction is conditional and the condition code test fails; or
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ci      * if it completes the execution of all instructions in the subroutine
10125bd8deadSopenharmony_ci        block.
10135bd8deadSopenharmony_ci
10145bd8deadSopenharmony_ci    When an individual thread terminates processing of the main subroutine,
10155bd8deadSopenharmony_ci    the thread will become inactive and remain inactive for the remainder of
10165bd8deadSopenharmony_ci    program execution.  When all threads have terminated the main subroutine
10175bd8deadSopenharmony_ci    block, program execution is complete and the output patch is passed to
10185bd8deadSopenharmony_ci    subsequent pipeline stages.
10195bd8deadSopenharmony_ci
10205bd8deadSopenharmony_ci    When a CAL instruction is executed, the current set of active threads will
10215bd8deadSopenharmony_ci    execute a block of instructions corresponding to the specified subroutine
10225bd8deadSopenharmony_ci    label.  This block consists of all instructions between the specified
10235bd8deadSopenharmony_ci    label and the next subroutine label.  If there is no subroutine label
10245bd8deadSopenharmony_ci    following the beginning of the block, the block ends at the END
10255bd8deadSopenharmony_ci    instruction.  Instructions in the block are executed in order until all
10265bd8deadSopenharmony_ci    active threads reach a termination condition.  A thread will complete
10275bd8deadSopenharmony_ci    execution of a subroutine block:
10285bd8deadSopenharmony_ci
10295bd8deadSopenharmony_ci      * if the CAL instruction is conditional and the condition code test
10305bd8deadSopenharmony_ci        fails;
10315bd8deadSopenharmony_ci
10325bd8deadSopenharmony_ci      * if it executes a RET anywhere within the subroutine block, unless the
10335bd8deadSopenharmony_ci        RET instruction is conditional and the condition code test fails; or
10345bd8deadSopenharmony_ci
10355bd8deadSopenharmony_ci      * if it completes the execution of all instructions in the subroutine
10365bd8deadSopenharmony_ci        block.
10375bd8deadSopenharmony_ci
10385bd8deadSopenharmony_ci    When an individual thread terminates processing of a called subroutine,
10395bd8deadSopenharmony_ci    the thread will become inactive and remain inactive until all threads have
10405bd8deadSopenharmony_ci    reached their termination condition.  When all threads have terminated the
10415bd8deadSopenharmony_ci    subroutine, execution continues at the instruction following the CAL
10425bd8deadSopenharmony_ci    instruction.  All threads active for initial CAL instruction become active
10435bd8deadSopenharmony_ci    again; all other threads will remain inactive.
10445bd8deadSopenharmony_ci    
10455bd8deadSopenharmony_ci    When a REP instruction is executed, the current set of active threads will
10465bd8deadSopenharmony_ci    repeatedly execute the instructions between the REP and corresponding
10475bd8deadSopenharmony_ci    ENDREP instruction in order.  Execution of this instruction loop will
10485bd8deadSopenharmony_ci    continue until all threads active when the REP instruction is executed
10495bd8deadSopenharmony_ci    reach a termination condition.  A thread will terminate the processing of
10505bd8deadSopenharmony_ci    a REP/ENDREP block:
10515bd8deadSopenharmony_ci
10525bd8deadSopenharmony_ci      * if the REP instruction specifies a loop count, and the initial loop
10535bd8deadSopenharmony_ci        count is not positive;
10545bd8deadSopenharmony_ci
10555bd8deadSopenharmony_ci      * if the REP instruction specifies a loop count, and the current value
10565bd8deadSopenharmony_ci        of the loop count for the thread reaches zero when decremented by an
10575bd8deadSopenharmony_ci        ENDREP instruction;
10585bd8deadSopenharmony_ci
10595bd8deadSopenharmony_ci      * if a RET instruction is executed anywhere within the REP/ENDREP block,
10605bd8deadSopenharmony_ci        unless the RET instruction is conditional and the condition code test
10615bd8deadSopenharmony_ci        fails; or
10625bd8deadSopenharmony_ci
10635bd8deadSopenharmony_ci      * if a BRK instruction is executed inside the REP/ENDREP block, unless
10645bd8deadSopenharmony_ci        the BRK instruction is contained inside a more-deeply nested
10655bd8deadSopenharmony_ci        REP/ENDREP block or the BRK instruction is conditional and the
10665bd8deadSopenharmony_ci        condition code test fails.
10675bd8deadSopenharmony_ci
10685bd8deadSopenharmony_ci    When an individual thread terminates processing of a REP/ENDREP loop, the
10695bd8deadSopenharmony_ci    thread will become inactive and remain inactive until all threads have
10705bd8deadSopenharmony_ci    terminated the loop.  When all threads have terminated the loop, execution
10715bd8deadSopenharmony_ci    continues at the instruction following the ENDREP instruction.  All
10725bd8deadSopenharmony_ci    threads active for initial REP instruction become active again, unless
10735bd8deadSopenharmony_ci    they executed a RET instruction inside the REP/ENDREP block.  All other
10745bd8deadSopenharmony_ci    threads will be inactive.
10755bd8deadSopenharmony_ci
10765bd8deadSopenharmony_ci    If a conditional CONT instruction is executed inside a REP/ENDREP block,
10775bd8deadSopenharmony_ci    all active threads passing the condition code test will become inactive
10785bd8deadSopenharmony_ci    and remain inactive until the next ENDREP instruction.  If all active
10795bd8deadSopenharmony_ci    threads become inactive following the completion of a CONT instruction,
10805bd8deadSopenharmony_ci    processing continues at the next ENDIF or ENDREP instruction.  An
10815bd8deadSopenharmony_ci    unconditional CONT instruction is treated identically to a conditional
10825bd8deadSopenharmony_ci    CONT instruction where all active threads pass the condition code test.
10835bd8deadSopenharmony_ci
10845bd8deadSopenharmony_ci    When an IF instruction belonging to an IF/ELSE/ENDIF block is executed,
10855bd8deadSopenharmony_ci    the current set of active threads is split into two groups.  The first
10865bd8deadSopenharmony_ci    group consists of all active threads passing the condition code test, and
10875bd8deadSopenharmony_ci    will execute a block of instructions between the IF and ELSE.  The second
10885bd8deadSopenharmony_ci    group consists of all active threads failing the condition code test, and
10895bd8deadSopenharmony_ci    will execute a block of instructions between the ELSE and ENDIF.
10905bd8deadSopenharmony_ci    Instructions within each group are executed in lock-step order.  However,
10915bd8deadSopenharmony_ci    the order of execution of instructions for threads in the first group are
10925bd8deadSopenharmony_ci    undefined relative to those in the second group.
10935bd8deadSopenharmony_ci
10945bd8deadSopenharmony_ci    When executing a block of instructions for either of the two groups in an
10955bd8deadSopenharmony_ci    IF/ELSE/ENDIF block, instructions within the block will be executed in
10965bd8deadSopenharmony_ci    order with only the threads in that group active.  The instructions of the
10975bd8deadSopenharmony_ci    block are executed until all threads in the group reach a block
10985bd8deadSopenharmony_ci    termination condition.  A thread will terminate the processing of its
10995bd8deadSopenharmony_ci    block:
11005bd8deadSopenharmony_ci
11015bd8deadSopenharmony_ci      * if it executes a RET instruction, unless the RET instruction is
11025bd8deadSopenharmony_ci        conditional and the condition code test fails;
11035bd8deadSopenharmony_ci
11045bd8deadSopenharmony_ci      * if it executes a BRK or CONT instruction inside the IF/ENDIF block,
11055bd8deadSopenharmony_ci        unless that instruction is contained in a more-deeply nested
11065bd8deadSopenharmony_ci        REP/ENDREP block or if the instruction is conditional and the
11075bd8deadSopenharmony_ci        condition code test fails; or
11085bd8deadSopenharmony_ci
11095bd8deadSopenharmony_ci      * if it completes the execution of all instructions in the instruction
11105bd8deadSopenharmony_ci        block.
11115bd8deadSopenharmony_ci
11125bd8deadSopenharmony_ci    When both groups have completed their instruction blocks, execution
11135bd8deadSopenharmony_ci    continues at the instruction following the ENDIF.  No instruction
11145bd8deadSopenharmony_ci    following the ENDIF will be executed until both groups have completed.  At
11155bd8deadSopenharmony_ci    that point, any thread active for the IF instruction will become active
11165bd8deadSopenharmony_ci    again unless the execution of its instruction block was terminated due to
11175bd8deadSopenharmony_ci    the execution of a RET, BRK, or CONT instruction.  All other threads will
11185bd8deadSopenharmony_ci    be inactive.
11195bd8deadSopenharmony_ci
11205bd8deadSopenharmony_ci    An IF instruction belonging to an IF/ENDIF block (with no corresponding
11215bd8deadSopenharmony_ci    ELSE) is handled as above, except that only one thread group created.
11225bd8deadSopenharmony_ci    That group will consists of all active threads passing the condition code,
11235bd8deadSopenharmony_ci    and it executes a block of instructions between the IF and ENDIF.
11245bd8deadSopenharmony_ci
11255bd8deadSopenharmony_ci    The order of execution imposed by this flow control model typically
11265bd8deadSopenharmony_ci    produces defined results when a tessellation control shader writes an
11275bd8deadSopenharmony_ci    output patch attribute, and then reads it (possibly on a different thread)
11285bd8deadSopenharmony_ci    for further computation.  There are two cases where undefined instruction
11295bd8deadSopenharmony_ci    execution order will lead to undefined attribute values.  When two or more
11305bd8deadSopenharmony_ci    threads access an attribute in a single executed instruction:
11315bd8deadSopenharmony_ci
11325bd8deadSopenharmony_ci      * the value of the attribute after the instruction completes will be
11335bd8deadSopenharmony_ci        undefined if multiple threads write different values; and
11345bd8deadSopenharmony_ci
11355bd8deadSopenharmony_ci      * the value of the attribute read by one thread will be undefined if the
11365bd8deadSopenharmony_ci        same attribute is written by another thread executing the same
11375bd8deadSopenharmony_ci        instruction.
11385bd8deadSopenharmony_ci
11395bd8deadSopenharmony_ci    Also, when an IF/ELSE/ENDIF block is executed and a thread from each of
11405bd8deadSopenharmony_ci    the two thread groups access an attribute within its block:
11415bd8deadSopenharmony_ci
11425bd8deadSopenharmony_ci      * the value of the attribute after the completion of the block will be
11435bd8deadSopenharmony_ci        undefined if both threads write different values;
11445bd8deadSopenharmony_ci
11455bd8deadSopenharmony_ci      * the value of the attribute read by one thread will be undefined if the
11465bd8deadSopenharmony_ci        same attribute is written by another thread.
11475bd8deadSopenharmony_ci
11485bd8deadSopenharmony_ci    If either thread group in an IF/ELSE/ENDIF block issue CAL instructions,
11495bd8deadSopenharmony_ci    these restrictions also apply to the instructions executed in the called
11505bd8deadSopenharmony_ci    subroutine.
11515bd8deadSopenharmony_ci
11525bd8deadSopenharmony_ci    The additional complexities of this tessellation control program flow
11535bd8deadSopenharmony_ci    control model are not fundamentally incompatible with the simpler flow
11545bd8deadSopenharmony_ci    control rules above.  They are simply intended to provide a useful model
11555bd8deadSopenharmony_ci    allowing for multiple cooperating threads.  In particular, two models are
11565bd8deadSopenharmony_ci    completely equivalent if there is only number of tessellation control
11575bd8deadSopenharmony_ci    program threads per patch is one.
11585bd8deadSopenharmony_ci
11595bd8deadSopenharmony_ci
11605bd8deadSopenharmony_ci    (add the following subsections to section 2.X.6 of NV_gpu_program4,
11615bd8deadSopenharmony_ci     Program Options.)
11625bd8deadSopenharmony_ci
11635bd8deadSopenharmony_ci    Section 2.X.6.Y, Tessellation Control Program Options
11645bd8deadSopenharmony_ci
11655bd8deadSopenharmony_ci    No options are supported at present for tessellation control programs.
11665bd8deadSopenharmony_ci
11675bd8deadSopenharmony_ci
11685bd8deadSopenharmony_ci    Section 2.X.6.Y, Tessellation Evaluation Program Options
11695bd8deadSopenharmony_ci
11705bd8deadSopenharmony_ci    No options are supported at present for tessellation evaluation programs.
11715bd8deadSopenharmony_ci
11725bd8deadSopenharmony_ci
11735bd8deadSopenharmony_ci    (add the following subsections to section 2.X.7 of NV_gpu_program4,
11745bd8deadSopenharmony_ci     Program Declarations.)
11755bd8deadSopenharmony_ci
11765bd8deadSopenharmony_ci    Section 2.X.7.Y, Tessellation Control Program Declarations
11775bd8deadSopenharmony_ci
11785bd8deadSopenharmony_ci    Tessellation control programs support one type of declaration statement,
11795bd8deadSopenharmony_ci    as described below.
11805bd8deadSopenharmony_ci
11815bd8deadSopenharmony_ci    - Output Vertex Count (VERTICES_OUT)
11825bd8deadSopenharmony_ci
11835bd8deadSopenharmony_ci    The VERTICES_OUT statement declares the number of vertices in the output
11845bd8deadSopenharmony_ci    patch produced by the tessellation control program, which also specifies
11855bd8deadSopenharmony_ci    the number of program invocations for each input patch.  The single
11865bd8deadSopenharmony_ci    argument must be a positive integer less than or equal to the value of the
11875bd8deadSopenharmony_ci    implementation-dependent limit MAX_PATCH_VERTICES_NV.  Each program
11885bd8deadSopenharmony_ci    invocation will have the same inputs except for the built-in input
11895bd8deadSopenharmony_ci    variable "primitive.invocation".  This variable will be an integer between
11905bd8deadSopenharmony_ci    0 and <n>-1, where <n> is the declared number of invocations.  A program
11915bd8deadSopenharmony_ci    will fail to load unless it contains exactly one VERTICES_OUT declaration.
11925bd8deadSopenharmony_ci
11935bd8deadSopenharmony_ci
11945bd8deadSopenharmony_ci    Section 2.X.7.Y, Tessellation Evaluation Program Declarations
11955bd8deadSopenharmony_ci
11965bd8deadSopenharmony_ci    Tessellation evaluation programs support several declaration statements.
11975bd8deadSopenharmony_ci    Each of these may be included at most in a tessellation evaluation
11985bd8deadSopenharmony_ci    program.
11995bd8deadSopenharmony_ci
12005bd8deadSopenharmony_ci    - Tessellation Primitive Generation Mode (TESS_MODE)
12015bd8deadSopenharmony_ci
12025bd8deadSopenharmony_ci    The TESS_MODE statement declares the type of subdivision performed by the
12035bd8deadSopenharmony_ci    tessellation primitive generator when the tessellation evaluation program,
12045bd8deadSopenharmony_ci    as described for the TESS_GEN_MODE_NV parameter in Section 2.X.2.  The
12055bd8deadSopenharmony_ci    single argument must be "TRIANGLES", "QUADS", or "ISOLINES".  A
12065bd8deadSopenharmony_ci    tessellation evaluation program will fail to load if it has no primitive
12075bd8deadSopenharmony_ci    generation mode declaration.
12085bd8deadSopenharmony_ci
12095bd8deadSopenharmony_ci    - Tessellation Primitive Spacing (TESS_SPACING)
12105bd8deadSopenharmony_ci
12115bd8deadSopenharmony_ci    The TESS_SPACING statement declares the type of spacing the tessellation
12125bd8deadSopenharmony_ci    primitive generator applies when subdivides primitive edge, as described
12135bd8deadSopenharmony_ci    for the TESS_GEN_SPACING_NV parameter in Section 2.X.2.  The single
12145bd8deadSopenharmony_ci    argument must be "EQUAL", "FRACTIONAL_ODD", or "FRACTIONAL_EVEN".  If a
12155bd8deadSopenharmony_ci    program omits a spacing declaration, "EQUAL" will be used.
12165bd8deadSopenharmony_ci
12175bd8deadSopenharmony_ci    - Tessellation Vertex Order (TESS_VERTEX_ORDER)
12185bd8deadSopenharmony_ci
12195bd8deadSopenharmony_ci    The TESS_VERTEX_ORDER statement declares the order of the vertices in the
12205bd8deadSopenharmony_ci    triangles emitted by the tessellation primitive generator in TRIANGLES or
12215bd8deadSopenharmony_ci    QUADS mode, as described for the TESS_GEN_VERTEX_ORDER_NV parameter in
12225bd8deadSopenharmony_ci    Section 2.X.2.  The single argument must be "CW" or "CCW".  If a program
12235bd8deadSopenharmony_ci    omits a vertex order declaration, "CCW" will be used.
12245bd8deadSopenharmony_ci
12255bd8deadSopenharmony_ci    - Tessellation Point Mode (TESS_POINT_MODE)
12265bd8deadSopenharmony_ci
12275bd8deadSopenharmony_ci    The TESS_POINT_MODE statement declares that the tessellation primitive
12285bd8deadSopenharmony_ci    generator will emit points for each vertex in the subdivided primitive
12295bd8deadSopenharmony_ci    instead of lines or triangles, as described for the TESS_GEN_POINT_MODE_NV
12305bd8deadSopenharmony_ci    parameter in Section 2.X.2.  The declaration takes no arguments.  If a
12315bd8deadSopenharmony_ci    program omits a point mode declaration, the primitives emitted will be
12325bd8deadSopenharmony_ci    lines (for ISOLINES mode) or triangles (for TRIANGLES and QUADS mode).
12335bd8deadSopenharmony_ci
12345bd8deadSopenharmony_ci
12355bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization)
12365bd8deadSopenharmony_ci
12375bd8deadSopenharmony_ci    None.
12385bd8deadSopenharmony_ci
12395bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment
12405bd8deadSopenharmony_ciOperations and the Frame Buffer)
12415bd8deadSopenharmony_ci
12425bd8deadSopenharmony_ci    None.
12435bd8deadSopenharmony_ci
12445bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.5 Specification (Special Functions)
12455bd8deadSopenharmony_ci
12465bd8deadSopenharmony_ci    None.
12475bd8deadSopenharmony_ci
12485bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.5 Specification (State and
12495bd8deadSopenharmony_ciState Requests)
12505bd8deadSopenharmony_ci
12515bd8deadSopenharmony_ci    None.
12525bd8deadSopenharmony_ci
12535bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.5 Specification (Invariance)
12545bd8deadSopenharmony_ci
12555bd8deadSopenharmony_ci    None.
12565bd8deadSopenharmony_ci
12575bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
12585bd8deadSopenharmony_ci
12595bd8deadSopenharmony_ci    None.
12605bd8deadSopenharmony_ci
12615bd8deadSopenharmony_ciGLX Protocol
12625bd8deadSopenharmony_ci
12635bd8deadSopenharmony_ci    None.
12645bd8deadSopenharmony_ci
12655bd8deadSopenharmony_ciErrors
12665bd8deadSopenharmony_ci
12675bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command that
12685bd8deadSopenharmony_ci    implicitly calls Begin, is called when tessellation control programs are
12695bd8deadSopenharmony_ci    enabled and the currently bound tessellation control program object does
12705bd8deadSopenharmony_ci    not contain a valid program.
12715bd8deadSopenharmony_ci
12725bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command that
12735bd8deadSopenharmony_ci    implicitly calls Begin, is called when tessellation evaluation programs
12745bd8deadSopenharmony_ci    are enabled and the currently bound tessellation evaluation program object
12755bd8deadSopenharmony_ci    does not contain a valid program.
12765bd8deadSopenharmony_ci
12775bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command that
12785bd8deadSopenharmony_ci    implicitly calls Begin, is called when tessellation control programs are
12795bd8deadSopenharmony_ci    enabled and <mode> is not PATCHES_NV.
12805bd8deadSopenharmony_ci
12815bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if Begin, or any command that
12825bd8deadSopenharmony_ci    implicitly calls Begin, is called when tessellation evaluation programs
12835bd8deadSopenharmony_ci    are enabled and <mode> is not PATCHES_NV.
12845bd8deadSopenharmony_ci
12855bd8deadSopenharmony_ciNew State
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci    (Modify ARB_vertex_program, Table X.6 -- Program State)
12885bd8deadSopenharmony_ci
12895bd8deadSopenharmony_ci                                                     Initial
12905bd8deadSopenharmony_ci    Get Value                  Type    Get Command    Value  Description              Sec.    Attribute
12915bd8deadSopenharmony_ci    -------------------------  ----    -----------   ------- ------------------------ ------  ---------
12925bd8deadSopenharmony_ci    TESS_CONTROL_PROGRAM_NV     B      IsEnabled      FALSE  Tessellation control     2.14.6  enable
12935bd8deadSopenharmony_ci                                                             program enable
12945bd8deadSopenharmony_ci    TESS_EVALUATION_PROGRAM_NV  B      IsEnabled      FALSE  Tess. evaluation         2.14.6  enable
12955bd8deadSopenharmony_ci                                                             program enable
12965bd8deadSopenharmony_ci
12975bd8deadSopenharmony_ci    TESS_CONTROL_PROGRAM_       Z+     GetIntegerv      0    Active tess control      2.14.1  -
12985bd8deadSopenharmony_ci      PARAMETER_BUFFER_NV                                    program buffer object
12995bd8deadSopenharmony_ci                                                             binding
13005bd8deadSopenharmony_ci    TESS_CONTROL_PROGRAM_       nxZ+   GetInteger-      0    Buffer objects bound for 2.14.1  -
13015bd8deadSopenharmony_ci      PARAMETER_BUFFER_NV              IndexedvEXT           tess. control program use
13025bd8deadSopenharmony_ci
13035bd8deadSopenharmony_ci    TESS_EVALUATION_PROGRAM_    Z+     GetIntegerv      0    Active tess evaluation   2.14.1  -
13045bd8deadSopenharmony_ci      PARAMETER_BUFFER_NV                                    program buffer object
13055bd8deadSopenharmony_ci                                                             binding
13065bd8deadSopenharmony_ci    TESS_EVALUATION_PROGRAM_    nxZ+   GetInteger-      0    Buffer objects bound for 2.14.1  -
13075bd8deadSopenharmony_ci      PARAMETER_BUFFER_NV              IndexedvEXT           tess. eval. program use
13085bd8deadSopenharmony_ci
13095bd8deadSopenharmony_ci
13105bd8deadSopenharmony_ci    Additionally, some tessellation-related state applicable to this extension
13115bd8deadSopenharmony_ci    is added by ARB_tessellation_shader.
13125bd8deadSopenharmony_ci
13135bd8deadSopenharmony_ciNew Implementation Dependent State
13145bd8deadSopenharmony_ci
13155bd8deadSopenharmony_ci                                                             Minimum
13165bd8deadSopenharmony_ci    Get Value                         Type  Get Command       Value   Description             Sec.     Attrib
13175bd8deadSopenharmony_ci    --------------------------------  ----  ---------------  -------  ----------------------- -------- ------
13185bd8deadSopenharmony_ci    MAX_PROGRAM_PATCH_ATTRIBS_NV       Z+   GetProgramivARB     30    number of generic patch 2.X.3.2    -
13195bd8deadSopenharmony_ci                                                                      attribute vectors
13205bd8deadSopenharmony_ci                                                                      supported
13215bd8deadSopenharmony_ci
13225bd8deadSopenharmony_ci    Additionally, some tessellation-related state applicable to this extension
13235bd8deadSopenharmony_ci    is added by ARB_tessellation_shader.
13245bd8deadSopenharmony_ci
13255bd8deadSopenharmony_ci
13265bd8deadSopenharmony_ciDependencies on ARB_tessellation_shader
13275bd8deadSopenharmony_ci
13285bd8deadSopenharmony_ci    This spec incorporates the text of ARB_tessellation_shader in its
13295bd8deadSopenharmony_ci    entirety.  If ARB_tessellation_shader is not supported, language
13305bd8deadSopenharmony_ci    documenting GLSL tessellation control and evaluation shaders should be
13315bd8deadSopenharmony_ci    removed; tessellation would be available only using the assembly
13325bd8deadSopenharmony_ci    interface.  Language describing the operation of patch primitives and the
13335bd8deadSopenharmony_ci    tessellation primitive generator would be retained.
13345bd8deadSopenharmony_ci
13355bd8deadSopenharmony_ciDependencies on NV_parameter_buffer_object
13365bd8deadSopenharmony_ci
13375bd8deadSopenharmony_ci    The NV_parameter_buffer_object (PaBO) extension provides the ability to
13385bd8deadSopenharmony_ci    bind buffer objects to be read by vertex, geometry, and fragment programs.
13395bd8deadSopenharmony_ci
13405bd8deadSopenharmony_ci    If NV_parameter_buffer_object is supported, this extension adds the
13415bd8deadSopenharmony_ci    ability to bind buffer objects to be accessed by tessellation control and
13425bd8deadSopenharmony_ci    evaluation programs.  The NV_parameter_buffer_object should be modified to
13435bd8deadSopenharmony_ci    accept the enums TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV and
13445bd8deadSopenharmony_ci    TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV where the three previously
13455bd8deadSopenharmony_ci    defined enums (for vertex, geometry, and fragment programs) are accepted.
13465bd8deadSopenharmony_ci
13475bd8deadSopenharmony_ci    If NV_parameter_buffer_object is not supported, references to the two new
13485bd8deadSopenharmony_ci    buffer object binding points should be removed.
13495bd8deadSopenharmony_ci
13505bd8deadSopenharmony_ciIssues
13515bd8deadSopenharmony_ci
13525bd8deadSopenharmony_ci    (1) How does tessellation fit into the existing GL pipeline?
13535bd8deadSopenharmony_ci
13545bd8deadSopenharmony_ci      RESOLVED:  See issue (1) in the ARB_tessellation_shader specification,
13555bd8deadSopenharmony_ci      which contains beautifully crafted ASCII art depicting the pipeline.
13565bd8deadSopenharmony_ci
13575bd8deadSopenharmony_ci    (2) What other considerations were involved in the design of the
13585bd8deadSopenharmony_ci        tessellation API?
13595bd8deadSopenharmony_ci
13605bd8deadSopenharmony_ci      RESOLVED:  Go look at the detailed issues section of the GLSL-based
13615bd8deadSopenharmony_ci      ARB_tessellation_shader specification.  There are a good number of
13625bd8deadSopenharmony_ci      issues that apply equally to the assembly APIs that won't be duplicated
13635bd8deadSopenharmony_ci      here.
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci    (3) Should the tessellation-related parameters (e.g., the primitive
13665bd8deadSopenharmony_ci        decomposition, spacing, vertex orientation) be context state or
13675bd8deadSopenharmony_ci        provided with the program?  If the latter, how should they be
13685bd8deadSopenharmony_ci        provided.
13695bd8deadSopenharmony_ci
13705bd8deadSopenharmony_ci      RESOLVED:  We are providing declaration statements to specify each of
13715bd8deadSopenharmony_ci      these parameters in the tessellation evaluation program.  Because they
13725bd8deadSopenharmony_ci      are part of the program text, they can't be changed independently of the
13735bd8deadSopenharmony_ci      program.  We don't think that limitation is serious, and the same
13745bd8deadSopenharmony_ci      limitation applies to GLSL shaders (you need to re-link when changing
13755bd8deadSopenharmony_ci      these parameters).  
13765bd8deadSopenharmony_ci
13775bd8deadSopenharmony_ci      Putting these declarations in the shader means that it wasn't necessary
13785bd8deadSopenharmony_ci      to create a new "tessellation parameter" API to set this state.  Such an
13795bd8deadSopenharmony_ci      API would only apply to assembly programs and could be a source of
13805bd8deadSopenharmony_ci      confusion if developers thought it might apply to GLSL shaders as well.
13815bd8deadSopenharmony_ci
13825bd8deadSopenharmony_ci    (4) The programming model for tessellation control programs supports
13835bd8deadSopenharmony_ci        multiple threads, each providing attributes for a single vertex.  But
13845bd8deadSopenharmony_ci        it also supports the ability to read the per-vertex outputs written by
13855bd8deadSopenharmony_ci        other threads and to read and write shared per-patch attribute
13865bd8deadSopenharmony_ci        outputs.  The latter capabilities require some sort of synchronization
13875bd8deadSopenharmony_ci        to ensure consistently ordered reads and writes whenever possible.
13885bd8deadSopenharmony_ci        How should this be handled?
13895bd8deadSopenharmony_ci
13905bd8deadSopenharmony_ci      RESOLVED:  We will expose a programming model where we run groups of <N>
13915bd8deadSopenharmony_ci      parallel threads in lock-step.  In this model, all <N> threads
13925bd8deadSopenharmony_ci      effectively retire one instruction before starting the next.  This
13935bd8deadSopenharmony_ci      execution model provides a simple abstraction, and provides an obvious
13945bd8deadSopenharmony_ci      instruction order allowing an application to avoid most read-write and
13955bd8deadSopenharmony_ci      write-write hazards.
13965bd8deadSopenharmony_ci
13975bd8deadSopenharmony_ci      There are three places where we have explicitly undefined behavior:
13985bd8deadSopenharmony_ci
13995bd8deadSopenharmony_ci        * If flow control diverges in an IF/ELSE/ENDIF block, the relative
14005bd8deadSopenharmony_ci          order of writes in the "IF" side of the block and those in the
14015bd8deadSopenharmony_ci          "ELSE" side of the block is undefined.
14025bd8deadSopenharmony_ci
14035bd8deadSopenharmony_ci        * If multiple threads write different values to the same per-patch
14045bd8deadSopenharmony_ci          attribute in the same instruction, the order in which the writes
14055bd8deadSopenharmony_ci          land is undefined.
14065bd8deadSopenharmony_ci
14075bd8deadSopenharmony_ci        * If any single instruction has one thread reading a per-vertex output
14085bd8deadSopenharmony_ci          or a per-patch attribute and another thread writing the same output,
14095bd8deadSopenharmony_ci          the order in which the reads and writes land is undefined.
14105bd8deadSopenharmony_ci
14115bd8deadSopenharmony_ci      Implementations need not actually run the threads in this manner, as
14125bd8deadSopenharmony_ci      long as the compiler properly synchronizes threads at the points where
14135bd8deadSopenharmony_ci      execution order dependencies do occur.  Since the NV_gpu_program4
14145bd8deadSopenharmony_ci      programming model uses structured branching (e.g., IF/ELSE/ENDIF
14155bd8deadSopenharmony_ci      blocks), the points at which threads may diverge and converge again are
14165bd8deadSopenharmony_ci      easily identified.  We expect that the number of such synchronization
14175bd8deadSopenharmony_ci      points will be low for most tessellation control programs.
14185bd8deadSopenharmony_ci
14195bd8deadSopenharmony_ci      One other approach considered is to limit the flow control model and the
14205bd8deadSopenharmony_ci      capabilities of the system to result in a minimal number of required
14215bd8deadSopenharmony_ci      synchronization points.  For example, the tessellation control program
14225bd8deadSopenharmony_ci      might be split into phases where the capabilities of each thread to
14235bd8deadSopenharmony_ci      access outputs would be limited.  For example, one might have a
14245bd8deadSopenharmony_ci      three-phase model like the following:
14255bd8deadSopenharmony_ci
14265bd8deadSopenharmony_ci                      Per-Vertex Outputs           Per-Patch Outputs
14275bd8deadSopenharmony_ci         Phase     can read?    can write?      can read?    can write?
14285bd8deadSopenharmony_ci         -----     ---------    ----------      ---------    ----------
14295bd8deadSopenharmony_ci           1          NO           YES             NO           NO
14305bd8deadSopenharmony_ci           2          YES          NO              NO           YES(a)
14315bd8deadSopenharmony_ci           3          YES          NO              YES(a)       YES(b)
14325bd8deadSopenharmony_ci
14335bd8deadSopenharmony_ci     In this model, there would be two explicit synchronization points --
14345bd8deadSopenharmony_ci     between each pair of phases.  The limits on access prevent most cases
14355bd8deadSopenharmony_ci     where conficts could occur (e.g., you can't read any per-vertex outputs
14365bd8deadSopenharmony_ci     until you're completely done writing all).  To further limit conflicts,
14375bd8deadSopenharmony_ci     per-patch attributes might be divided into two sets -- set (a) can be
14385bd8deadSopenharmony_ci     written only in phase 2 and read only in phase (3), and set (b) can be
14395bd8deadSopenharmony_ci     written only in phase 3.
14405bd8deadSopenharmony_ci
14415bd8deadSopenharmony_ci     We decided to expose a general model on the grounds that having the
14425bd8deadSopenharmony_ci     compiler automatically determine possible synchronization points was easy
14435bd8deadSopenharmony_ci     enough.  Optimizing compilers that reorder instructions already have to
14445bd8deadSopenharmony_ci     deal with this exact type of issue -- they can't move instructions that
14455bd8deadSopenharmony_ci     write a variable past subsequent instructions that read it.
14465bd8deadSopenharmony_ci
14475bd8deadSopenharmony_ci     The programming model adopted for GLSL in ARB_tessellation_shader
14485bd8deadSopenharmony_ci     similarly has a set of parallel threads running one executable, but it
14495bd8deadSopenharmony_ci     provides a barrier() call that serves as a synchronization point and can
14505bd8deadSopenharmony_ci     be used to split shader execution into phases.
14515bd8deadSopenharmony_ci
14525bd8deadSopenharmony_ci     Note that while all previous OpenGL programmability extensions exposed a
14535bd8deadSopenharmony_ci     model of completely independent threads (i.e., one thread can't read the
14545bd8deadSopenharmony_ci     outputs of another), threads weren't always completely independent!  In
14555bd8deadSopenharmony_ci     fragment programs/shaders, some texture and all partial derivative
14565bd8deadSopenharmony_ci     built-ins (dFdx, dFdy in GLSL) require screen-space derivatives.  If the
14575bd8deadSopenharmony_ci     quantity used for derivatives is computed by the shader, OpenGL
14585bd8deadSopenharmony_ci     implementations generally run threads in groups arranged by screen-space
14595bd8deadSopenharmony_ci     location and approximate derivatives by computing differences of the
14605bd8deadSopenharmony_ci     inputs between threads.  This approach requires the same sort of
14615bd8deadSopenharmony_ci     automatic synchronization between threads, since derivatives implicitly
14625bd8deadSopenharmony_ci     read values computed by other threads.
14635bd8deadSopenharmony_ci
14645bd8deadSopenharmony_ci
14655bd8deadSopenharmony_ciRevision History
14665bd8deadSopenharmony_ci
14675bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
14685bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------
14695bd8deadSopenharmony_ci     3    12/19/11  pbrown    Clarify that "primitive.tessouter[n]",
14705bd8deadSopenharmony_ci                              "primitive.tessinner[n]", and "primitive.
14715bd8deadSopenharmony_ci                              patch.attrib[n]" are not available on the input
14725bd8deadSopenharmony_ci                              patch for tessellation control programs.  Remove
14735bd8deadSopenharmony_ci                              stray language referring to a non-existent
14745bd8deadSopenharmony_ci                              vector tessellation level.
14755bd8deadSopenharmony_ci
14765bd8deadSopenharmony_ci     2    03/22/10  pbrown    Rename references to ARB_tessellation_shader
14775bd8deadSopenharmony_ci                              (formerly EXT).  Minor other cleanups, including
14785bd8deadSopenharmony_ci                              the issues section.
14795bd8deadSopenharmony_ci
14805bd8deadSopenharmony_ci     1              pbrown    Internal revisions.
14815bd8deadSopenharmony_ci
1482