15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_vertex_program3
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_vertex_program3
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 Data:         10/12/2009
205bd8deadSopenharmony_ci    NVIDIA Revision:            7
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNumber
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    306
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciDependencies
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    ARB_vertex_program is required.
295bd8deadSopenharmony_ci    NV_vertex_program2_option is required.
305bd8deadSopenharmony_ci    This extension interacts with ARB_fragment_program_shadow.
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciOverview
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    This extension, like the NV_vertex_program2_option extension,
355bd8deadSopenharmony_ci    provides additional vertex program functionality to extend the
365bd8deadSopenharmony_ci    standard ARB_vertex_program language and execution environment.
375bd8deadSopenharmony_ci    ARB programs wishing to use this added functionality need only add:
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci        OPTION NV_vertex_program3;
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    to the beginning of their vertex programs.
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    New functionality provided by this extension, above and beyond that
445bd8deadSopenharmony_ci    already provided by NV_vertex_program2_option extension, includes: 
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci        * texture lookups in vertex programs,
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci        * ability to push and pop address registers on the stack,
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci        * address register-relative addressing for vertex attribute and
515bd8deadSopenharmony_ci          result arrays, and
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci        * a second four-component condition code.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ciIssues
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Should we provided a separate "!!VP3.0" program type, like the
585bd8deadSopenharmony_ci    "!!VP2.0" type defined in NV_vertex_program2?
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci      RESOLVED:  No.  Since ARB_vertex_program has been fully defined
615bd8deadSopenharmony_ci      (it wasn't in the !!VP2.0 time-frame), we will simply define
625bd8deadSopenharmony_ci      language extensions to !!ARBvp1.0 that expose new functionality.
635bd8deadSopenharmony_ci      The NV_vertex_program2_option specification followed this same
645bd8deadSopenharmony_ci      pattern for the NV3X family (GeForce FX, Quadro FX).
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    Should this be called "NV_vertex_program3_option"?
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci      RESOLVED:  No.  The similar extension to !!ARBvp1.0 called
695bd8deadSopenharmony_ci      "NV_vertex_program2_option" got that name only because the simpler
705bd8deadSopenharmony_ci      "NV_vertex_program2" name had already been used.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    Is there a limit on the number of texture units that can be accessed
735bd8deadSopenharmony_ci    by a vertex program?
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci      RESOLVED:  Yes.  The limit may be lower than the total number of texture
765bd8deadSopenharmony_ci      image units available and is given by the implementation-dependent
775bd8deadSopenharmony_ci      constant MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB.  Any program that attempts
785bd8deadSopenharmony_ci      to use more unique texture image units will fail to load.  Programs can
795bd8deadSopenharmony_ci      use any texture image unit number, as long as they don't use too many
805bd8deadSopenharmony_ci      simultaneously.  As an example, the GeForce 6 series of GPUs provides 16
815bd8deadSopenharmony_ci      texture image units accessible to vertex programs, but no more than four
825bd8deadSopenharmony_ci      can be used simultaneously.  It is not an error to use texture image
835bd8deadSopenharmony_ci      units 12-15 in a program.
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci      This limitation is identical to the one in the ARB_vertex_shader
865bd8deadSopenharmony_ci      extensions -- both extensions use the same enum to query the number of
875bd8deadSopenharmony_ci      available image units.  Violating this limit in GLSL results in a link
885bd8deadSopenharmony_ci      error.
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    Is there a restriction on the texture targets that can be accessed by a
915bd8deadSopenharmony_ci    vertex program?
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci      RESOLVED:  Yes -- for any texture image unit, vertex and fragment
945bd8deadSopenharmony_ci      processing can not use different targets.  If they do, an
955bd8deadSopenharmony_ci      INVALID_OPERATION is generated at Begin-time.  This resolution is
965bd8deadSopenharmony_ci      consistent with resultion of the same issue in the ARB_vertex_shader
975bd8deadSopenharmony_ci      extension and OpenGL 2.0.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    Since vertices don't have screen space partial derivatives, how is
1005bd8deadSopenharmony_ci    the LOD used for texture accesses defined?
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci      RESOLVED:  The TXL instruction allows a program to explicitly
1035bd8deadSopenharmony_ci      set an LOD; the LOD for all other texture instructions is zero.
1045bd8deadSopenharmony_ci      The texture LOD bias specified in the texture object and environment
1055bd8deadSopenharmony_ci      do apply to all vertex texture lookups.
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ciNew Procedures and Functions
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    None.
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ciNew Tokens
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1155bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci        MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB              0x8B4C
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    Modify Section 2.14.2, Vertex Program Grammar and Restrictions
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    (mostly add to existing grammar rules, as extended by
1245bd8deadSopenharmony_ci    NV_vertex_program2_option)
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci    <optionName>            ::= "NV_vertex_program3"
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    <instruction>           ::= <TexInstruction>
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci    <ALUInstruction>        ::= <ASTACKop_instruction>
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    <TexInstruction>        ::= <TEXop_instruction>
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    <ASTACKop_instruction>  ::= <PUSHAop> <instOperandAddrVNS>
1355bd8deadSopenharmony_ci                              | <POPAop> <instResultAddr>
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    <PUSHAop>               ::= "PUSHA"
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    <POPAop>                ::= "POPA"
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    <TEXop_instruction>     ::= <TEXop> <instResult> "," <instOperandV> "," 
1425bd8deadSopenharmony_ci                                <texTarget>
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    <TEXop>                 ::= "TEX"
1455bd8deadSopenharmony_ci                              | "TXP"
1465bd8deadSopenharmony_ci                              | "TXB"
1475bd8deadSopenharmony_ci                              | "TXL"
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    <texTarget>             ::= <texImageUnit> "," <texTargetType>
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    <texImageUnit>          ::= "texture" <optTexImageUnitNum>
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    <optTexImageUnitNum>    ::= /* empty */
1545bd8deadSopenharmony_ci                              | "[" <texImageUnitNum> "]"
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    <texImageUnitNum>       ::= <integer> 
1575bd8deadSopenharmony_ci                                /*[0,MAX_TEXTURE_IMAGE_UNITS_ARB-1]*/
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    <texTargetType>         ::= "1D"
1605bd8deadSopenharmony_ci                              | "2D"
1615bd8deadSopenharmony_ci                              | "3D"
1625bd8deadSopenharmony_ci                              | "CUBE"
1635bd8deadSopenharmony_ci                              | "RECT"
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci    <attribVtxBasic>        ::= "texcoord" "[" <arrayMemRel> "]"
1665bd8deadSopenharmony_ci                              | "attrib" "[" <arrayMemRel> "]"
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    <resultVtxBasic>        ::= "texcoord" "[" <arrayMemRel> "]"
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    <ccMaskRule>            ::= "EQ0"
1715bd8deadSopenharmony_ci                              | "GE0"
1725bd8deadSopenharmony_ci                              | "GT0"
1735bd8deadSopenharmony_ci                              | "LE0"
1745bd8deadSopenharmony_ci                              | "LT0"
1755bd8deadSopenharmony_ci                              | "NE0"
1765bd8deadSopenharmony_ci                              | "TR0"
1775bd8deadSopenharmony_ci                              | "FL0"
1785bd8deadSopenharmony_ci                              | "EQ1"
1795bd8deadSopenharmony_ci                              | "GE1"
1805bd8deadSopenharmony_ci                              | "GT1"
1815bd8deadSopenharmony_ci                              | "LE1"
1825bd8deadSopenharmony_ci                              | "LT1"
1835bd8deadSopenharmony_ci                              | "NE1"
1845bd8deadSopenharmony_ci                              | "TR1"
1855bd8deadSopenharmony_ci                              | "FL1"
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    (modify description of reserved identifiers)
1885bd8deadSopenharmony_ci    
1895bd8deadSopenharmony_ci    ... The following strings are reserved keywords and may not be used
1905bd8deadSopenharmony_ci    as identifiers:
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci        ABS, ADD, ADDRESS, ALIAS, ARA, ARL, ARR, ATTRIB, BRA, CAL, COS,
1935bd8deadSopenharmony_ci        DP3, DP4, DPH, DST, END, EX2, EXP, FLR, FRC, LG2, LIT, LOG, MAD,
1945bd8deadSopenharmony_ci        MAX, MIN, MOV, MUL, OPTION, OUTPUT, PARAM, POPA, POW, PUSHA, RCC,
1955bd8deadSopenharmony_ci        RCP, RET, RSQ, SEQ, SFL, SGE, SGT, SIN, SLE, SLT, SNE, SUB, SSG,
1965bd8deadSopenharmony_ci        STR, SWZ, TEMP, TEX, TXB, TXL, TXP, XPD, program, result, state,
1975bd8deadSopenharmony_ci        and vertex.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    Modify Section 2.14.3.1, Vertex Attributes
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    (add new bindings to binding table)
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci      Vertex Attribute Binding  Components  Underlying State
2045bd8deadSopenharmony_ci      ------------------------  ----------  --------------------------------
2055bd8deadSopenharmony_ci      ...
2065bd8deadSopenharmony_ci      vertex.texcoord[A+n]      (s,t,r,q)   indexed texture coordinate
2075bd8deadSopenharmony_ci      vertex.attrib[A+n]        (x,y,z,w)   indexed generic vertex attribute
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    If a vertex attribute binding matches "vertex.texcoord[A+n]", where
2105bd8deadSopenharmony_ci    "A" is a component of an address register (Section 2.14.3.5), a
2115bd8deadSopenharmony_ci    texture coordinate number <c> is computed by adding the current
2125bd8deadSopenharmony_ci    value of the address register component and <n>.  The "x", "y",
2135bd8deadSopenharmony_ci    "z", and "w" components of the vertex attribute variable are
2145bd8deadSopenharmony_ci    filled with the "s", "t", "r", and "q" components, respectively,
2155bd8deadSopenharmony_ci    of the vertex texture coordinates for texture unit <c>.  If <c>
2165bd8deadSopenharmony_ci    is negative or greater than or equal to MAX_TEXTURE_COORDS_ARB,
2175bd8deadSopenharmony_ci    the vertex attribute variable is undefined.
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci    If a vertex attribute binding matches "vertex.attrib[A+n]", where
2205bd8deadSopenharmony_ci    "A" is a component of an address register (Section 2.14.3.5), a
2215bd8deadSopenharmony_ci    vertex attribute number <a> is computed by adding the current value
2225bd8deadSopenharmony_ci    of the address register component and <n>.  The "x", "y", "z", and
2235bd8deadSopenharmony_ci    "w" components of the vertex attribute variable are filled with the
2245bd8deadSopenharmony_ci    "x", "y", "z", and "w" components, respectively, of generic vertex
2255bd8deadSopenharmony_ci    attribute <a>.  If <a> is negative or greater than or equal to
2265bd8deadSopenharmony_ci    MAX_VERTEX_ATTRIBS_ARB, the vertex attribute variable is undefined.
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    Modify Section 2.14.3.4, Vertex Program Results
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    (add new binding to binding table)
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci      Binding                        Components  Description
2335bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
2345bd8deadSopenharmony_ci      ...
2355bd8deadSopenharmony_ci      result.texcoord[A+n]           (s,t,r,q)   indexed texture coordinate
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    If a result variable binding matches "result.texcoord[A+n]", where "A"
2385bd8deadSopenharmony_ci    is a component of an address register (Section 2.14.3.5), a texture
2395bd8deadSopenharmony_ci    coordinate number <c> is computed by adding the current value of
2405bd8deadSopenharmony_ci    the address register component and <n>.  Updates to the "x", "y",
2415bd8deadSopenharmony_ci    "z", and "w" components of the result variable set the "s", "t",
2425bd8deadSopenharmony_ci    "r" and "q" components, respectively, of the transformed vertex's
2435bd8deadSopenharmony_ci    texture coordinates for texture unit <c>.  If <c> is negative or
2445bd8deadSopenharmony_ci    greater than or equal to MAX_TEXTURE_COORDS_ARB, the effects of
2455bd8deadSopenharmony_ci    updates to vertex attribute variable are undefined and may overwrite
2465bd8deadSopenharmony_ci    other programs results.
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    Modify Section 2.14.3.X, Condition Code Registers (added in
2495bd8deadSopenharmony_ci    NV_Vertex_program2_option)
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    The vertex program condition code registers are two four-component
2525bd8deadSopenharmony_ci    vectors, called CC0 and CC1.  Each component of this register is one
2535bd8deadSopenharmony_ci    of four enumerated values: GT (greater than), EQ (equal), LT (less
2545bd8deadSopenharmony_ci    than), or UN (unordered).  The condition code register can be used
2555bd8deadSopenharmony_ci    to mask writes to registers and to evaluate conditional branches.
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    Most vertex program instructions can optionally update one of the
2585bd8deadSopenharmony_ci    two condition code registers.  When a vertex program instruction
2595bd8deadSopenharmony_ci    updates a condition code register, a condition code component is set
2605bd8deadSopenharmony_ci    to LT if the corresponding component of the result is less than zero,
2615bd8deadSopenharmony_ci    EQ if it is equal to zero, GT if it is greater than zero, and UN if
2625bd8deadSopenharmony_ci    it is NaN (not a number).
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    The condition code registers are initialized to vectors of EQ values
2655bd8deadSopenharmony_ci    each time a vertex program executes.
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    Modify Section 2.14.3.7, Vertex Program Resource Limits
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    (add new paragraph to end of section) In addition to the previous limits,
2705bd8deadSopenharmony_ci    the number of unique texture image units that can be accessed
2715bd8deadSopenharmony_ci    simultaneously by a vertex program is limited.  The limit is given by the
2725bd8deadSopenharmony_ci    implementation-dependent constant MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, and
2735bd8deadSopenharmony_ci    may be lower than the total number of texture image units provided.  If
2745bd8deadSopenharmony_ci    the number of texture image units referenced by a vertex program exceeds
2755bd8deadSopenharmony_ci    this limit, the program will fail to load.
2765bd8deadSopenharmony_ci    
2775bd8deadSopenharmony_ci    Modify Section 2.14.4, Vertex Program Execution Environment
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci    (modify Begin-time error language for vertex program execution to cover
2805bd8deadSopenharmony_ci    invalid texture uses)
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    If vertex program mode is enabled and the currently bound program object
2835bd8deadSopenharmony_ci    does not contain a valid vertex program, the error INVALID_OPERATION will
2845bd8deadSopenharmony_ci    be generated by Begin, RasterPos, and any command that implicitly calls
2855bd8deadSopenharmony_ci    Begin (e.g., DrawArrays).
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    If vertex program mode is enabled and the currently bound program object
2885bd8deadSopenharmony_ci    accesses a texture image unit, the texture target used must be consistent
2895bd8deadSopenharmony_ci    with the target (if any) used for fragment processing.  If vertex and
2905bd8deadSopenharmony_ci    fragment processing require the use of different texture targets on the
2915bd8deadSopenharmony_ci    same texture image unit, the error INVALID_OPERATION will be generated by
2925bd8deadSopenharmony_ci    Begin, RasterPos, and any command that implicitly calls Begin.
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    (modify instruction table) There are forty-eight vertex program
2955bd8deadSopenharmony_ci    instructions.  Vertex program instructions may have up to eight
2965bd8deadSopenharmony_ci    variants, including a suffix of "C" or "C0" to allow an update of
2975bd8deadSopenharmony_ci    condition code register zero (section 2.14.3.X), a suffix of "C1"
2985bd8deadSopenharmony_ci    to allow an update of condition code register one, and a suffix of
2995bd8deadSopenharmony_ci    "_SAT" to clamp the result vector components to the range [0,1].
3005bd8deadSopenharmony_ci    For example, the eight forms of the "ADD" instruction are "ADD",
3015bd8deadSopenharmony_ci    "ADDC", "ADDC0", "ADDC1", "ADD_SAT", "ADDC_SAT", "ADDC0_SAT", and
3025bd8deadSopenharmony_ci    "ADDC1_SAT".  The instructions and their respective input and output
3035bd8deadSopenharmony_ci    parameters are summarized in Table X.5.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci                  Modifiers
3065bd8deadSopenharmony_ci      Instruction   C S   Inputs  Output   Description
3075bd8deadSopenharmony_ci      -----------   - -   ------  ------   --------------------------------
3085bd8deadSopenharmony_ci      ABS           X X   v       v        absolute value
3095bd8deadSopenharmony_ci      ADD           X X   v,v     v        add
3105bd8deadSopenharmony_ci      ARA           X -   a       a        address register add
3115bd8deadSopenharmony_ci      ARL           X -   s       a        address register load
3125bd8deadSopenharmony_ci      ARR           X -   v       a        address register load (round)
3135bd8deadSopenharmony_ci      BRA           - -   c       -        branch
3145bd8deadSopenharmony_ci      CAL           - -   c       -        subroutine call
3155bd8deadSopenharmony_ci      COS           X X   s       ssss     cosine
3165bd8deadSopenharmony_ci      DP3           X X   v,v     ssss     3-component dot product
3175bd8deadSopenharmony_ci      DP4           X X   v,v     ssss     4-component dot product
3185bd8deadSopenharmony_ci      DPH           X X   v,v     ssss     homogeneous dot product
3195bd8deadSopenharmony_ci      DST           X X   v,v     v        distance vector
3205bd8deadSopenharmony_ci      EX2           X X   s       ssss     exponential base 2
3215bd8deadSopenharmony_ci      EXP           X X   s       v        exponential base 2 (approximate)
3225bd8deadSopenharmony_ci      FLR           X X   v       v        floor
3235bd8deadSopenharmony_ci      FRC           X X   v       v        fraction
3245bd8deadSopenharmony_ci      LG2           X X   s       ssss     logarithm base 2
3255bd8deadSopenharmony_ci      LIT           X X   v       v        compute light coefficients
3265bd8deadSopenharmony_ci      LOG           X X   s       v        logarithm base 2 (approximate)
3275bd8deadSopenharmony_ci      MAD           X X   v,v,v   v        multiply and add
3285bd8deadSopenharmony_ci      MAX           X X   v,v     v        maximum
3295bd8deadSopenharmony_ci      MIN           X X   v,v     v        minimum
3305bd8deadSopenharmony_ci      MOV           X X   v       v        move
3315bd8deadSopenharmony_ci      MUL           X X   v,v     v        multiply
3325bd8deadSopenharmony_ci      POPA          - -   -       a        pop address register
3335bd8deadSopenharmony_ci      POW           X X   s,s     ssss     exponentiate
3345bd8deadSopenharmony_ci      PUSHA         - -   a       -        push address register
3355bd8deadSopenharmony_ci      RCC           X X   s       ssss     reciprocal (clamped)
3365bd8deadSopenharmony_ci      RCP           X X   s       ssss     reciprocal
3375bd8deadSopenharmony_ci      RET           - -   c       -        subroutine return
3385bd8deadSopenharmony_ci      RSQ           X X   s       ssss     reciprocal square root
3395bd8deadSopenharmony_ci      SEQ           X X   v,v     v        set on equal
3405bd8deadSopenharmony_ci      SFL           X X   v,v     v        set on false
3415bd8deadSopenharmony_ci      SGE           X X   v,v     v        set on greater than or equal
3425bd8deadSopenharmony_ci      SGT           X X   v,v     v        set on greater than
3435bd8deadSopenharmony_ci      SIN           X X   s       ssss     sine
3445bd8deadSopenharmony_ci      SLE           X X   v,v     v        set on less than or equal
3455bd8deadSopenharmony_ci      SLT           X X   v,v     v        set on less than
3465bd8deadSopenharmony_ci      SNE           X X   v,v     v        set on not equal
3475bd8deadSopenharmony_ci      SSG           X X   v       v        set sign
3485bd8deadSopenharmony_ci      STR           X X   v,v     v        set on true
3495bd8deadSopenharmony_ci      SUB           X X   v,v     v        subtract
3505bd8deadSopenharmony_ci      SWZ           X X   v       v        extended swizzle
3515bd8deadSopenharmony_ci      TEX           X X   v       v        texture lookup
3525bd8deadSopenharmony_ci      TXB           X X   v       v        texture lookup with LOD bias
3535bd8deadSopenharmony_ci      TXL           X X   v       v        texture lookup with explicit LOD
3545bd8deadSopenharmony_ci      TXP           X X   v       v        projective texture lookup
3555bd8deadSopenharmony_ci      XPD           X X   v,v     v        cross product
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci      Table X.5:  Summary of vertex program instructions.  The columns
3585bd8deadSopenharmony_ci      "C" and "S" indicate whether the "C", "C0", and "C1" condition code
3595bd8deadSopenharmony_ci      update modifiers, and the "_SAT" saturation modifiers, respectively,
3605bd8deadSopenharmony_ci      are supported for the opcode.  "v" indicates a floating-point vector
3615bd8deadSopenharmony_ci      input or output, "s" indicates a floating-point scalar input,
3625bd8deadSopenharmony_ci      "ssss" indicates a scalar output replicated across a 4-component
3635bd8deadSopenharmony_ci      result vector, "a" indicates a vector address register, and "c"
3645bd8deadSopenharmony_ci      indicates a condition code test.
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci    Rewrite Section 2.14.4.3,  Vertex Program Destination Register Update
3675bd8deadSopenharmony_ci
3685bd8deadSopenharmony_ci    A vertex program instruction can optionally clamp the results of
3695bd8deadSopenharmony_ci    a floating-point result vector to the range [0,1].  The components
3705bd8deadSopenharmony_ci    of the result vector are clamped to [0,1] if the saturation suffix
3715bd8deadSopenharmony_ci    "_SAT" is present in the instruction.
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    Most vertex program instructions write a 4-component result vector to
3745bd8deadSopenharmony_ci    a single temporary or vertex result register.  Writes to individual
3755bd8deadSopenharmony_ci    components of the destination register are controlled by individual
3765bd8deadSopenharmony_ci    component write masks specified as part of the instruction.
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    The component write mask is specified by the <optionalMask> rule
3795bd8deadSopenharmony_ci    found in the <maskedDstReg> rule.  If the optional mask is "",
3805bd8deadSopenharmony_ci    all components are enabled.  Otherwise, the optional mask names
3815bd8deadSopenharmony_ci    the individual components to enable.  The characters "x", "y",
3825bd8deadSopenharmony_ci    "z", and "w" match the x, y, z, and w components respectively.
3835bd8deadSopenharmony_ci    For example, an optional mask of ".xzw" indicates that the x, z,
3845bd8deadSopenharmony_ci    and w components should be enabled for writing but the y component
3855bd8deadSopenharmony_ci    should not.  The grammar requires that the destination register mask
3865bd8deadSopenharmony_ci    components must be listed in "xyzw" order.  The condition code write
3875bd8deadSopenharmony_ci    mask is specified by the <ccMask> rule found in the <instResultCC>
3885bd8deadSopenharmony_ci    and <instResultAddrCC> rules.  Otherwise, the selected condition
3895bd8deadSopenharmony_ci    code register is loaded and swizzled according to the swizzle
3905bd8deadSopenharmony_ci    codes specified by <swizzleSuffix>.  Each component of the swizzled
3915bd8deadSopenharmony_ci    condition code is tested according to the rule given by <ccMaskRule>.
3925bd8deadSopenharmony_ci    <ccMaskRule> may have the values "EQ", "NE", "LT", "GE", LE", or "GT",
3935bd8deadSopenharmony_ci    which mean to enable writes if the corresponding condition code field
3945bd8deadSopenharmony_ci    evaluates to equal, not equal, less than, greater than or equal, less
3955bd8deadSopenharmony_ci    than or equal, or greater than, respectively.  Comparisons involving
3965bd8deadSopenharmony_ci    condition codes of "UN" (unordered) evaluate to true for "NE" and
3975bd8deadSopenharmony_ci    false otherwise.  For example, if the condition code is (GT,LT,EQ,GT)
3985bd8deadSopenharmony_ci    and the condition code mask is "(NE.zyxw)", the swizzle operation
3995bd8deadSopenharmony_ci    will load (EQ,LT,GT,GT) and the mask will thus will enable writes on
4005bd8deadSopenharmony_ci    the y, z, and w components.  In addition, "TR" always enables writes
4015bd8deadSopenharmony_ci    and "FL" always disables writes, regardless of the condition code.
4025bd8deadSopenharmony_ci    If the condition code mask is empty, it is treated as "(TR)".
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci    Each component of the destination register is updated with the result
4055bd8deadSopenharmony_ci    of the vertex program instruction if and only if the component is
4065bd8deadSopenharmony_ci    enabled for writes by both the component write mask and the condition
4075bd8deadSopenharmony_ci    code write mask.  Otherwise, the component of the destination register
4085bd8deadSopenharmony_ci    remains unchanged.
4095bd8deadSopenharmony_ci
4105bd8deadSopenharmony_ci    A vertex program instruction can also optionally update the condition
4115bd8deadSopenharmony_ci    code register.  The condition code is updated if the condition
4125bd8deadSopenharmony_ci    code register update suffix "C" is present in the instruction.
4135bd8deadSopenharmony_ci    The instruction "ADDC" will update the condition code; the otherwise
4145bd8deadSopenharmony_ci    equivalent instruction "ADD" will not.  If condition code updates
4155bd8deadSopenharmony_ci    are enabled, each component of the destination register enabled
4165bd8deadSopenharmony_ci    for writes is compared to zero.  The corresponding component of
4175bd8deadSopenharmony_ci    the condition code is set to "LT", "EQ", or "GT", if the written
4185bd8deadSopenharmony_ci    component is less than, equal to, or greater than zero, respectively.
4195bd8deadSopenharmony_ci    Condition code components are set to "UN" if the written component is
4205bd8deadSopenharmony_ci    NaN (not a number).  Values of -0.0 and +0.0 both evaluate to "EQ".
4215bd8deadSopenharmony_ci    If a component of the destination register is not enabled for writes,
4225bd8deadSopenharmony_ci    the corresponding condition code component is also unchanged.
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    In the following example code,
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci        # R1=(-2, 0, 2, NaN)              R0                  CC
4275bd8deadSopenharmony_ci        MOVC R0, R1;               # ( -2,  0,   2, NaN) (LT,EQ,GT,UN)
4285bd8deadSopenharmony_ci        MOVC R0.xyz, R1.yzwx;      # (  0,  2, NaN, NaN) (EQ,GT,UN,UN)
4295bd8deadSopenharmony_ci        MOVC R0 (NE), R1.zywx;     # (  0,  0, NaN,  -2) (EQ,EQ,UN,LT)
4305bd8deadSopenharmony_ci
4315bd8deadSopenharmony_ci    the first instruction writes (-2,0,2,NaN) to R0 and updates the
4325bd8deadSopenharmony_ci    condition code to (LT,EQ,GT,UN).  The second instruction, only the
4335bd8deadSopenharmony_ci    "x", "y", and "z" components of R0 and the condition code are updated,
4345bd8deadSopenharmony_ci    so R0 ends up with (0,2,NaN,NaN) and the condition code ends up with
4355bd8deadSopenharmony_ci    (EQ,GT,UN,UN).  In the third instruction, the condition code mask
4365bd8deadSopenharmony_ci    disables writes to the x component (its condition code field is "EQ"),
4375bd8deadSopenharmony_ci    so R0 ends up with (0,0,NaN,-2) and the condition code ends up with
4385bd8deadSopenharmony_ci    (EQ,EQ,UN,LT).
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci    The following pseudocode illustrates the process of writing a
4415bd8deadSopenharmony_ci    result vector to the destination register.  In the pseudocode,
4425bd8deadSopenharmony_ci    "instrSaturate" is TRUE if and only if result saturation is
4435bd8deadSopenharmony_ci    enabled, "instrMask" refers to the component write mask given by
4445bd8deadSopenharmony_ci    the <optWriteMask> rule.  "ccMaskRule" refers to the condition code
4455bd8deadSopenharmony_ci    mask rule given by <ccMask> and "updatecc" is TRUE if and only if
4465bd8deadSopenharmony_ci    condition code updates are enabled.  "result", "destination", and "cc"
4475bd8deadSopenharmony_ci    refer to the result vector, the register selected by <dstRegister>
4485bd8deadSopenharmony_ci    and the condition code, respectively.  Condition codes do not exist
4495bd8deadSopenharmony_ci    in the VP1 execution environment.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci      boolean TestCC(CondCode field) {
4525bd8deadSopenharmony_ci          switch (ccMaskRule) {
4535bd8deadSopenharmony_ci          case "EQ":  return (field == "EQ");
4545bd8deadSopenharmony_ci          case "NE":  return (field != "EQ");
4555bd8deadSopenharmony_ci          case "LT":  return (field == "LT");
4565bd8deadSopenharmony_ci          case "GE":  return (field == "GT" || field == "EQ");
4575bd8deadSopenharmony_ci          case "LE":  return (field == "LT" || field == "EQ");
4585bd8deadSopenharmony_ci          case "GT":  return (field == "GT");
4595bd8deadSopenharmony_ci          case "TR":  return TRUE;
4605bd8deadSopenharmony_ci          case "FL":  return FALSE;
4615bd8deadSopenharmony_ci          case "":    return TRUE;
4625bd8deadSopenharmony_ci          }
4635bd8deadSopenharmony_ci      }
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci      enum GenerateCC(float value) {
4665bd8deadSopenharmony_ci        if (value == NaN) {
4675bd8deadSopenharmony_ci          return UN;
4685bd8deadSopenharmony_ci        } else if (value < 0) {
4695bd8deadSopenharmony_ci          return LT;
4705bd8deadSopenharmony_ci        } else if (value == 0) {
4715bd8deadSopenharmony_ci          return EQ;
4725bd8deadSopenharmony_ci        } else {
4735bd8deadSopenharmony_ci          return GT;
4745bd8deadSopenharmony_ci        }
4755bd8deadSopenharmony_ci      }
4765bd8deadSopenharmony_ci
4775bd8deadSopenharmony_ci      void UpdateDestination(floatVec destination, floatVec result)
4785bd8deadSopenharmony_ci      {
4795bd8deadSopenharmony_ci          floatVec merged;
4805bd8deadSopenharmony_ci          ccVec    mergedCC;
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci          // Clamp result components to [0,1] if requested in the instruction.
4835bd8deadSopenharmony_ci          if (instrSaturate) {
4845bd8deadSopenharmony_ci              if (result.x < 0)      result.x = 0;
4855bd8deadSopenharmony_ci              else if (result.x > 1) result.x = 1;
4865bd8deadSopenharmony_ci              if (result.y < 0)      result.y = 0;
4875bd8deadSopenharmony_ci              else if (result.y > 1) result.y = 1;
4885bd8deadSopenharmony_ci              if (result.z < 0)      result.z = 0;
4895bd8deadSopenharmony_ci              else if (result.z > 1) result.z = 1;
4905bd8deadSopenharmony_ci              if (result.w < 0)      result.w = 0;
4915bd8deadSopenharmony_ci              else if (result.w > 1) result.w = 1;
4925bd8deadSopenharmony_ci          }
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci          // Merge the converted result into the destination register, under
4955bd8deadSopenharmony_ci          // control of the compile- and run-time write masks.
4965bd8deadSopenharmony_ci          merged = destination;
4975bd8deadSopenharmony_ci          mergedCC = cc;
4985bd8deadSopenharmony_ci          if (instrMask.x && TestCC(cc.c***)) {
4995bd8deadSopenharmony_ci              merged.x = result.x;
5005bd8deadSopenharmony_ci              if (updatecc) mergedCC.x = GenerateCC(result.x);
5015bd8deadSopenharmony_ci          }
5025bd8deadSopenharmony_ci          if (instrMask.y && TestCC(cc.*c**)) {
5035bd8deadSopenharmony_ci              merged.y = result.y;
5045bd8deadSopenharmony_ci              if (updatecc) mergedCC.y = GenerateCC(result.y);
5055bd8deadSopenharmony_ci          }
5065bd8deadSopenharmony_ci          if (instrMask.z && TestCC(cc.**c*)) {
5075bd8deadSopenharmony_ci              merged.z = result.z;
5085bd8deadSopenharmony_ci              if (updatecc) mergedCC.z = GenerateCC(result.z);
5095bd8deadSopenharmony_ci          }
5105bd8deadSopenharmony_ci          if (instrMask.w && TestCC(cc.***c)) {
5115bd8deadSopenharmony_ci              merged.w = result.w;
5125bd8deadSopenharmony_ci              if (updatecc) mergedCC.w = GenerateCC(result.w);
5135bd8deadSopenharmony_ci          }
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci          // Write out the new destination register and condition code.
5165bd8deadSopenharmony_ci          destination = merged;
5175bd8deadSopenharmony_ci          cc = mergedCC;
5185bd8deadSopenharmony_ci      }
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci    While this rule describes floating-point results, the same logic
5215bd8deadSopenharmony_ci    applies to the integer results generated by the ARA, ARL, and ARR
5225bd8deadSopenharmony_ci    instructions.
5235bd8deadSopenharmony_ci
5245bd8deadSopenharmony_ci    Add to Section 2.14.4.5, Vertex Program Options
5255bd8deadSopenharmony_ci
5265bd8deadSopenharmony_ci    Section 2.14.4.5.3, NV_vertex_program3 Program Option
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci    If a vertex program specifies the "NV_vertex_program3" option, the
5295bd8deadSopenharmony_ci    ARB_vertex_program grammar and execution environment are extended
5305bd8deadSopenharmony_ci    to take advantage of all the features of the "NV_vertex_program2"
5315bd8deadSopenharmony_ci    option, plus the following features:
5325bd8deadSopenharmony_ci
5335bd8deadSopenharmony_ci        * several new instructions:
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci          * POPA -- pop address register off stack        
5365bd8deadSopenharmony_ci          * PUSHA -- push address register onto stack
5375bd8deadSopenharmony_ci          * TEX -- texture lookup
5385bd8deadSopenharmony_ci          * TXB -- texture lookup w/LOD bias
5395bd8deadSopenharmony_ci          * TXL -- texture lookup w/explicit LOD
5405bd8deadSopenharmony_ci          * TXP -- projective texture lookup
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci        * address register-relative addressing for vertex texture
5435bd8deadSopenharmony_ci          coordinate and generic attribute arrays,
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci        * address register-relative addressing for vertex texture
5465bd8deadSopenharmony_ci          coordinate result array, and
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci        * a second four-component condition code.
5495bd8deadSopenharmony_ci
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci    Modify Section 2.14.5.34,  RET:  Subroutine Call Return
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci    The RET instruction conditionally returns from a subroutine initiated
5545bd8deadSopenharmony_ci    by a CAL instruction by popping an instruction reference off the
5555bd8deadSopenharmony_ci    top of the call stack and transferring control to the referenced
5565bd8deadSopenharmony_ci    instruction.  The following pseudocode describes the operation of
5575bd8deadSopenharmony_ci    the instruction:
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
5605bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
5615bd8deadSopenharmony_ci        if (callStackDepth <= 0) {
5625bd8deadSopenharmony_ci          // terminate vertex program normally
5635bd8deadSopenharmony_ci        } else {
5645bd8deadSopenharmony_ci          callStackDepth--;
5655bd8deadSopenharmony_ci          if (callStack[callStackDepth] is a instruction reference) {
5665bd8deadSopenharmony_ci            instruction = callStack[callStackDepth];
5675bd8deadSopenharmony_ci          } else {
5685bd8deadSopenharmony_ci            // terminate vertex program abnormally
5695bd8deadSopenharmony_ci          }
5705bd8deadSopenharmony_ci        }
5715bd8deadSopenharmony_ci
5725bd8deadSopenharmony_ci        // continue execution at <instruction>
5735bd8deadSopenharmony_ci      } else {
5745bd8deadSopenharmony_ci        // do nothing
5755bd8deadSopenharmony_ci      }
5765bd8deadSopenharmony_ci
5775bd8deadSopenharmony_ci    In the pseudocode, <callStackDepth> is the depth of the call stack,
5785bd8deadSopenharmony_ci    <callStack> is an array holding the call stack, and <instruction> is
5795bd8deadSopenharmony_ci    a reference to an instruction previously pushed onto the call stack.
5805bd8deadSopenharmony_ci
5815bd8deadSopenharmony_ci    If the call stack is empty when RET executes, the vertex program
5825bd8deadSopenharmony_ci    terminates normally.
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci    The vertex program terminates abnormally if the entry at the top of the
5855bd8deadSopenharmony_ci    call stack is not an instruction reference pushed by CAL.  When a vertex
5865bd8deadSopenharmony_ci    program terminates abnormally, all of the vertex program results are
5875bd8deadSopenharmony_ci    undefined.
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci    Add to Section 2.14.5,  Vertex Program Instruction Set
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci    Section 2.14.5.43, POPA:  Pop Address Register Stack    
5925bd8deadSopenharmony_ci
5935bd8deadSopenharmony_ci    The POPA instruction generates a integer result vector by popping
5945bd8deadSopenharmony_ci    an entry off of the call stack.
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci      if (callStackDepth <= 0) {
5975bd8deadSopenharmony_ci        terminate vertex program;
5985bd8deadSopenharmony_ci      } else {
5995bd8deadSopenharmony_ci        callStackDepth--;
6005bd8deadSopenharmony_ci        if (callStack[callStackDepth] is an address register) {
6015bd8deadSopenharmony_ci          iresult = callStack[callStackDepth];
6025bd8deadSopenharmony_ci        } else {
6035bd8deadSopenharmony_ci          terminate vertex program;
6045bd8deadSopenharmony_ci        }
6055bd8deadSopenharmony_ci      }
6065bd8deadSopenharmony_ci
6075bd8deadSopenharmony_ci    POPA does not support non-default write masks; a program will fail to load
6085bd8deadSopenharmony_ci    if it includes a component write mask other than ".xyzw" or a condition
6095bd8deadSopenharmony_ci    code write mask test other than "TR".
6105bd8deadSopenharmony_ci
6115bd8deadSopenharmony_ci    In the pseudocode, <callStackDepth> is the current depth of the call
6125bd8deadSopenharmony_ci    stack and <callStack> is an array holding the call stack.  
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci    The vertex program terminates abnormally if it executes a POPA instruction
6155bd8deadSopenharmony_ci    when the call stack is empty, or when the entry at the top of the call
6165bd8deadSopenharmony_ci    stack is not an address register pushed by PUSHA.  When a vertex program
6175bd8deadSopenharmony_ci    terminates abnormally, all of the vertex program results are undefined.
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    Section 2.14.5.44, PUSHA:  Push Address Register Stack    
6205bd8deadSopenharmony_ci
6215bd8deadSopenharmony_ci    The PUSHA instruction pushes the address register operand onto the
6225bd8deadSopenharmony_ci    call stack, which is also used for subroutine calls.  The PUSHA
6235bd8deadSopenharmony_ci    instruction does not generate a result vector.
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci      tmp = AddrVectorLoad(op0);
6265bd8deadSopenharmony_ci      if (callStackDepth >= MAX_PROGRAM_CALL_DEPTH_NV) {
6275bd8deadSopenharmony_ci        terminate vertex program;
6285bd8deadSopenharmony_ci      } else {
6295bd8deadSopenharmony_ci        callStack[callStackDepth] = tmp;
6305bd8deadSopenharmony_ci        callStackDepth++;
6315bd8deadSopenharmony_ci      }
6325bd8deadSopenharmony_ci
6335bd8deadSopenharmony_ci    In the pseudocode, <callStackDepth> is the current depth of the call
6345bd8deadSopenharmony_ci    stack and <callStack> is an array holding the call stack.
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci    The vertex program terminates abnormally if it executes a PUSHA
6375bd8deadSopenharmony_ci    instruction when the call stack is full.  When a vertex program terminates
6385bd8deadSopenharmony_ci    abnormally, all of the vertex program results are undefined.
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ci    Component swizzling is not supported when the operand is loaded.
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ci    Section 2.14.5.45, TEX:  Texture Lookup
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    The TEX instruction uses the single vector operand to perform a
6455bd8deadSopenharmony_ci    lookup in the specified texture map, yielding a 4-component result
6465bd8deadSopenharmony_ci    vector containing filtered texel values.  The (s,t,r,q) coordinates
6475bd8deadSopenharmony_ci    used for the texture lookup are (x,y,z,1), where x, y, and z are
6485bd8deadSopenharmony_ci    components of the vector operand.
6495bd8deadSopenharmony_ci
6505bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
6515bd8deadSopenharmony_ci      result = TextureSample(tmp.x, tmp.y, tmp.z, 1.0, 0.0, unit, target);
6525bd8deadSopenharmony_ci
6535bd8deadSopenharmony_ci    where <unit> and <target> are the texture image unit number and
6545bd8deadSopenharmony_ci    target type, matching the <texImageUnitNum> and <texTargetType>
6555bd8deadSopenharmony_ci    grammar rules.
6565bd8deadSopenharmony_ci
6575bd8deadSopenharmony_ci    The resulting sample is mapped to RGBA as described in Table 3.21,
6585bd8deadSopenharmony_ci    and the R, G, B, and A values are written to the x, y, z, and w
6595bd8deadSopenharmony_ci    components, respectively, of the result vector.
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    Since partial derivatives of the texture coordinates are not defined,
6625bd8deadSopenharmony_ci    the base LOD value for vertex texture lookups is defined to be
6635bd8deadSopenharmony_ci    zero.  The value of lambda' used in equation 3.16 will be simply
6645bd8deadSopenharmony_ci    clamp(texobj_bias + texunit_bias).
6655bd8deadSopenharmony_ci
6665bd8deadSopenharmony_ci    Section 2.14.5.46, TXB:  Texture Lookup (With LOD Bias)
6675bd8deadSopenharmony_ci
6685bd8deadSopenharmony_ci    The TXB instruction uses the single vector operand to perform a
6695bd8deadSopenharmony_ci    lookup in the specified texture map, yielding a 4-component result
6705bd8deadSopenharmony_ci    vector containing filtered texel values.  The (s,t,r,q) coordinates
6715bd8deadSopenharmony_ci    used for the texture lookup are (x,y,z,1), where x, y, and z are
6725bd8deadSopenharmony_ci    components of the vector operand.  The w component of the operand
6735bd8deadSopenharmony_ci    is used as an additional LOD bias.
6745bd8deadSopenharmony_ci
6755bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
6765bd8deadSopenharmony_ci      result = TextureSample(tmp.x, tmp.y, tmp.z, 1.0, tmp.w, unit, target);
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    where <unit> and <target> are the texture image unit number and
6795bd8deadSopenharmony_ci    target type, matching the <texImageUnitNum> and <texTargetType>
6805bd8deadSopenharmony_ci    grammar rules.
6815bd8deadSopenharmony_ci
6825bd8deadSopenharmony_ci    The resulting sample is mapped to RGBA as described in Table 3.21,
6835bd8deadSopenharmony_ci    and the R, G, B, and A values are written to the x, y, z, and w
6845bd8deadSopenharmony_ci    components, respectively, of the result vector.
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci    Since partial derivatives of the texture coordinates are not defined,
6875bd8deadSopenharmony_ci    the base LOD value for vertex texture lookups is defined to be
6885bd8deadSopenharmony_ci    zero.  The value of lambda' used in equation 3.16 will be simply
6895bd8deadSopenharmony_ci    clamp(texobj_bias + texunit_bias + tmp.w).  
6905bd8deadSopenharmony_ci
6915bd8deadSopenharmony_ci    Since the base LOD value is zero, the TXB instruction is completely
6925bd8deadSopenharmony_ci    equivalent to the TXL instruction, where the w component contains
6935bd8deadSopenharmony_ci    an explicit base LOD value.
6945bd8deadSopenharmony_ci
6955bd8deadSopenharmony_ci    Section 2.14.5.47, TXL:  Texture Lookup (With Explicit LOD)
6965bd8deadSopenharmony_ci
6975bd8deadSopenharmony_ci    The TXL instruction uses the single vector operand to perform a
6985bd8deadSopenharmony_ci    lookup in the specified texture map, yielding a 4-component result
6995bd8deadSopenharmony_ci    vector containing filtered texel values.  The (s,t,r,q) coordinates
7005bd8deadSopenharmony_ci    used for the texture lookup are (x,y,z,1), where x, y, and z are
7015bd8deadSopenharmony_ci    components of the vector operand.  The w component of the operand
7025bd8deadSopenharmony_ci    is used as the base LOD for the texture lookup.
7035bd8deadSopenharmony_ci
7045bd8deadSopenharmony_ci      tmp = VectorLoad(op0); 
7055bd8deadSopenharmony_ci      result = TextureSampleLOD(tmp.x, tmp.y, tmp.z, 1.0, tmp.w, unit, target);
7065bd8deadSopenharmony_ci
7075bd8deadSopenharmony_ci    where <unit> and <target> are the texture image unit number and
7085bd8deadSopenharmony_ci    target type, matching the <texImageUnitNum> and <texTargetType>
7095bd8deadSopenharmony_ci    grammar rules.
7105bd8deadSopenharmony_ci
7115bd8deadSopenharmony_ci    The resulting sample is mapped to RGBA as described in Table 3.21,
7125bd8deadSopenharmony_ci    and the R, G, B, and A values are written to the x, y, z, and w
7135bd8deadSopenharmony_ci    components, respectively, of the result vector.
7145bd8deadSopenharmony_ci
7155bd8deadSopenharmony_ci    The value of lambda' used in equation 3.16 will be simply tmp.w +
7165bd8deadSopenharmony_ci    clamp(texobj_bias + texunit_bias), where tmp.w is the base LOD.
7175bd8deadSopenharmony_ci
7185bd8deadSopenharmony_ci    Section 2.14.5.48, TXP:  Texture Lookup (Projective)
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci    The TXP instruction uses the single vector operand to perform a
7215bd8deadSopenharmony_ci    lookup in the specified texture map, yielding a 4-component result
7225bd8deadSopenharmony_ci    vector containing filtered texel values.  The (s,t,r,q) coordinates
7235bd8deadSopenharmony_ci    used for the texture lookup are (x,y,z,w), where x, y, z, and w are
7245bd8deadSopenharmony_ci    the four components of the vector operand.
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
7275bd8deadSopenharmony_ci      result = TextureSample(tmp.x, tmp.y, tmp.z, tmp.w, 0.0, unit, target);
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    where <unit> and <target> are the texture image unit number and
7305bd8deadSopenharmony_ci    target type, matching the <texImageUnitNum> and <texTargetType>
7315bd8deadSopenharmony_ci    grammar rules.
7325bd8deadSopenharmony_ci
7335bd8deadSopenharmony_ci    The resulting sample is mapped to RGBA as described in Table 3.21,
7345bd8deadSopenharmony_ci    and the R, G, B, and A values are written to the x, y, z, and w
7355bd8deadSopenharmony_ci    components, respectively, of the result vector.
7365bd8deadSopenharmony_ci
7375bd8deadSopenharmony_ci    Since partial derivatives of the texture coordinates are not defined,
7385bd8deadSopenharmony_ci    the base LOD value for vertex texture lookups is defined to be
7395bd8deadSopenharmony_ci    zero.  The value of lambda' used in equation 3.16 will be simply
7405bd8deadSopenharmony_ci    clamp(texobj_bias + texunit_bias).
7415bd8deadSopenharmony_ci
7425bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
7435bd8deadSopenharmony_ci
7445bd8deadSopenharmony_ci    None.
7455bd8deadSopenharmony_ci
7465bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
7475bd8deadSopenharmony_ciOperations and the Frame Buffer)
7485bd8deadSopenharmony_ci
7495bd8deadSopenharmony_ci    None.
7505bd8deadSopenharmony_ci
7515bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
7525bd8deadSopenharmony_ci
7535bd8deadSopenharmony_ci    None.
7545bd8deadSopenharmony_ci
7555bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.4 Specification (State and
7565bd8deadSopenharmony_ciState Requests)
7575bd8deadSopenharmony_ci
7585bd8deadSopenharmony_ci    None.
7595bd8deadSopenharmony_ci
7605bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.4 Specification (Invariance)
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci    None.
7635bd8deadSopenharmony_ci
7645bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
7655bd8deadSopenharmony_ci
7665bd8deadSopenharmony_ci    None.
7675bd8deadSopenharmony_ci
7685bd8deadSopenharmony_ciDependencies on ARB_vertex_program
7695bd8deadSopenharmony_ci
7705bd8deadSopenharmony_ci    ARB_vertex_program is required.
7715bd8deadSopenharmony_ci
7725bd8deadSopenharmony_ci    This specification and NV_vertex_program2_option are based on a
7735bd8deadSopenharmony_ci    modified version of the grammar published in the ARB_vertex_program
7745bd8deadSopenharmony_ci    specification.  This modified grammar includes a few structural
7755bd8deadSopenharmony_ci    changes to better accommodate new functionality from this and
7765bd8deadSopenharmony_ci    other extensions, but should be functionally equivalent to the
7775bd8deadSopenharmony_ci    ARB_vertex_program grammar.  See NV_vertex_program2_option for
7785bd8deadSopenharmony_ci    details on the base grammar.
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ciDependencies on NV_vertex_program2_option
7815bd8deadSopenharmony_ci
7825bd8deadSopenharmony_ci    NV_vertex_program2_option is required.  
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ci    If the NV_vertex_program3 program option is specified, all
7855bd8deadSopenharmony_ci    the functionality described in both this extension and the
7865bd8deadSopenharmony_ci    NV_vertex_program2_option specification is available.
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ciDependencies on ARB_fragment_program_shadow
7895bd8deadSopenharmony_ci
7905bd8deadSopenharmony_ci    If this extension and ARB_fragment_program shadow are both supported,
7915bd8deadSopenharmony_ci    vertex programs may include the option statement:
7925bd8deadSopenharmony_ci
7935bd8deadSopenharmony_ci      OPTION ARB_fragment_program_shadow;
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci    which enables the use of SHADOW1D, SHADOW2D, and SHADOWRECT texture
7965bd8deadSopenharmony_ci    targets in texture lookup instructions, as described in the
7975bd8deadSopenharmony_ci    ARB_fragment_program_shadow specification.
7985bd8deadSopenharmony_ci
7995bd8deadSopenharmony_ci    NVIDIA NOTE:  Drivers prior to September 2006 do not support the use of
8005bd8deadSopenharmony_ci    this option, and will not accept texture lookups with SHADOW1D, SHADOW2D,
8015bd8deadSopenharmony_ci    and SHADOWRECT targets.  Shadow mapping in vertex programs will result in
8025bd8deadSopenharmony_ci    software fallbacks on GeForce 6 and GeForce 7 series GPUs, but may be done
8035bd8deadSopenharmony_ci    in hardware on future GPUs.
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ciErrors
8065bd8deadSopenharmony_ci
8075bd8deadSopenharmony_ci    None.
8085bd8deadSopenharmony_ci
8095bd8deadSopenharmony_ciNew State
8105bd8deadSopenharmony_ci
8115bd8deadSopenharmony_ci    None.
8125bd8deadSopenharmony_ci
8135bd8deadSopenharmony_ciNew Implementation Dependent State:
8145bd8deadSopenharmony_ci
8155bd8deadSopenharmony_ci                                             Minimum
8165bd8deadSopenharmony_ci    Get Value             Type  Get Command   Value   Description                 Section   Attr.
8175bd8deadSopenharmony_ci    ---------             ----  -----------  -------  --------------------------  --------  -----
8185bd8deadSopenharmony_ci    MAX_VERTEX_TEXTURE_    Z+   GetIntegerv     1     Number of separate texture  2.14.3.7  -
8195bd8deadSopenharmony_ci      IMAGE_UNITS_ARB                                 image units that can be
8205bd8deadSopenharmony_ci                                                      accessed by a vertex program
8215bd8deadSopenharmony_ci
8225bd8deadSopenharmony_ciRevision History
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
8255bd8deadSopenharmony_ci    ----  --------  --------  --------------------------------------------
8265bd8deadSopenharmony_ci    7     10/12/09  pbrown    Update grammar/documentation of PUSHA/POPA to
8275bd8deadSopenharmony_ci                              reflect the implementation.  <instResultAddr> is
8285bd8deadSopenharmony_ci                              used for POPA with some semantic checks.  Note
8295bd8deadSopenharmony_ci                              that some driver versions erroneously allowed
8305bd8deadSopenharmony_ci                              conditional write masks on POPA.  Also clarify
8315bd8deadSopenharmony_ci                              that ARB_fragment_program_shadow includes
8325bd8deadSopenharmony_ci                              support for "SHADOWRECT".
8335bd8deadSopenharmony_ci
8345bd8deadSopenharmony_ci    6     09/27/06  pbrown    Document that ARB_fragment_program_shadow is
8355bd8deadSopenharmony_ci                              allowed, to enable the use of "SHADOW1D" and
8365bd8deadSopenharmony_ci                              "SHADOW2D" targets for texture lookups.
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci    5     11/07/05  pbrown    Fix PUSHA documentation to specify the right
8395bd8deadSopenharmony_ci                              constant name used for overflow testing.
8405bd8deadSopenharmony_ci
8415bd8deadSopenharmony_ci    4     09/01/05  pbrown    Fix spec language to document that a vertex
8425bd8deadSopenharmony_ci                              program will fail to compile if it uses "too
8435bd8deadSopenharmony_ci                              many" textures -- previously only documented
8445bd8deadSopenharmony_ci                              in the issues section.
8455bd8deadSopenharmony_ci
8465bd8deadSopenharmony_ci    3     08/25/05  pbrown    Document that using a different texture target
8475bd8deadSopenharmony_ci                              than fragment processing on the same texture
8485bd8deadSopenharmony_ci                              unit results in an INVALID_OPERATION error at
8495bd8deadSopenharmony_ci                              Begin time.  This is consistent with GLSL
8505bd8deadSopenharmony_ci                              language in the ARB_shader_objects and OpenGL
8515bd8deadSopenharmony_ci                              2.0 specifications.  The implementation has
8525bd8deadSopenharmony_ci                              always done this, but it was overlooked in
8535bd8deadSopenharmony_ci                              the spec language.
8545bd8deadSopenharmony_ci
8555bd8deadSopenharmony_ci    2     06/23/04  pbrown    Documented that vertex results are undefined
8565bd8deadSopenharmony_ci                              when a vertex program terminates abnormally
8575bd8deadSopenharmony_ci                              (e.g., PUSHA/POPA stack overflow/underflow).
8585bd8deadSopenharmony_ci                              Documented error in RET if the top of the call
8595bd8deadSopenharmony_ci                              stack contains a value written by PUSHA.
8605bd8deadSopenharmony_ci
8615bd8deadSopenharmony_ci    1     --------  pbrown    Initial pre-release revisions.
8625bd8deadSopenharmony_ci
863