15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_fragment_program_option
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_fragment_program_option
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:      05/27/2005
205bd8deadSopenharmony_ci    NVIDIA Revision:    4
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNumber
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    303
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciDependencies
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    ARB_fragment_program is required.
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciOverview
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    This extension provides additional fragment program functionality
335bd8deadSopenharmony_ci    to extend the standard ARB_fragment_program language and execution
345bd8deadSopenharmony_ci    environment.  ARB programs wishing to use this added functionality
355bd8deadSopenharmony_ci    need only add:
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci        OPTION NV_fragment_program;
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    to the beginning of their fragment programs.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    The functionality provided by this extension, which is roughly
425bd8deadSopenharmony_ci    equivalent to that provided by the NV_fragment_program extension,
435bd8deadSopenharmony_ci    includes:
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci      * increased control over precision in arithmetic computations and
465bd8deadSopenharmony_ci        storage,
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci      * data-dependent conditional writemasks,
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci      * an absolute value operator on scalar and swizzled operand loads,
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci      * instructions to compute partial derivatives, and perform texture
535bd8deadSopenharmony_ci        lookups using specified partial derivatives,
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci      * fully orthogonal "set on" instructions,
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci      * instructions to compute reflection vector and perform a 2D
585bd8deadSopenharmony_ci        coordinate transform, and
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci      * instructions to pack and unpack multiple quantities into a single
615bd8deadSopenharmony_ci        component.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ciIssues
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    Why is this a separate extension, rather than just an additional
665bd8deadSopenharmony_ci    feature of NV_fragment_program?
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci      RESOLVED:  The NV_fragment_program specification was complete
695bd8deadSopenharmony_ci      (with a published implementation) prior to the completion of
705bd8deadSopenharmony_ci      ARB_fragment_program.  Future NVIDIA fragment program extensions
715bd8deadSopenharmony_ci      should contain extensions to the ARB_fragment_program execution
725bd8deadSopenharmony_ci      environment as a standard feature.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    Should a similar option be provided to expose ARB_fragment_program
755bd8deadSopenharmony_ci    features not found in NV_fragment_program (e.g., state bindings,
765bd8deadSopenharmony_ci    certain "macro" instructions) under the NV_fragment_program
775bd8deadSopenharmony_ci    interface?
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci      RESOLVED:  No.  Why not just write an ARB program?
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    The ARB_fragment_program spec has a minor grammar bug that requires
825bd8deadSopenharmony_ci    that inline scalar constants used as scalar operands include a
835bd8deadSopenharmony_ci    component selector.  In other words, you have to say "11.0.x" to
845bd8deadSopenharmony_ci    use the constant "11.0".  What should we do here?
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci      RESOLVED:  The NV_fragment_program_option grammar will correct
875bd8deadSopenharmony_ci      this problem, which should be fixed in future revisions to the
885bd8deadSopenharmony_ci      ARB language.
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ciNew Procedures and Functions
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci    None.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ciNew Tokens
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    None.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    None.
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    Modify Section 3.11.2 of ARB_fragment_program (Fragment Program
1055bd8deadSopenharmony_ci    Grammar and Restrictions):
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    (mostly add to existing grammar rules, modify a few existing grammar
1085bd8deadSopenharmony_ci    rules -- changes marked with "***")
1095bd8deadSopenharmony_ci    
1105bd8deadSopenharmony_ci    <optionName>            ::= "NV_fragment_program"
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    <TexInstruction>        ::= <TXDop_instruction>
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    <VECTORop>              ::= "DDX"
1155bd8deadSopenharmony_ci                              | "DDY"
1165bd8deadSopenharmony_ci                              | "PK2H"
1175bd8deadSopenharmony_ci                              | "PK2US"
1185bd8deadSopenharmony_ci                              | "PK4B"
1195bd8deadSopenharmony_ci                              | "PK4UB"
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    <SCALARop>              ::= "UP2H"
1225bd8deadSopenharmony_ci                              | "UP2US"
1235bd8deadSopenharmony_ci                              | "UP4B"
1245bd8deadSopenharmony_ci                              | "UP4UB"
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci    <BINop>                 ::= "RFL"
1275bd8deadSopenharmony_ci                              | "SEQ"
1285bd8deadSopenharmony_ci                              | "SFL"
1295bd8deadSopenharmony_ci                              | "SGT"
1305bd8deadSopenharmony_ci                              | "SLE"
1315bd8deadSopenharmony_ci                              | "SNE"
1325bd8deadSopenharmony_ci                              | "STR"
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    <TRIop>                 ::= "X2D"
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    <TXDop_instruction>     ::= <TXDop> <instResult> "," <instOperandV> "," 
1375bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandV> "," 
1385bd8deadSopenharmony_ci                                <texTarget>
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    <TXDop>                 ::= "TXD"
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    <killCond>              ::= <ccTest>
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    <instOperandV>          ::= <instOperandAbsV>
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    <instOperandAbsV>       ::= <optSign> "|" <instOperandBaseV> "|"
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    <instOperandS>          ::= <instOperandAbsS>
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    <instOperandAbsS>       ::= <optSign> "|" <instOperandBaseS> "|"
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    <instResult>            ::= <instResultCC>
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    <instResultCC>          ::= <instResultBase> <ccMask>
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    <TEMP_statement>        ::= <varSize> "TEMP" <varNameList>
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    <OUTPUT_statement>      ::= <varSize> "OUTPUT" <establishName> "=" 
1595bd8deadSopenharmony_ci                                  <resultUseD>
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci    <varSize>               ::= "SHORT"
1625bd8deadSopenharmony_ci                              | "LONG"
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    <paramUseV>             ::= <constantScalar> 
1655bd8deadSopenharmony_ci                                  (*** instead of <constantScalar>
1665bd8deadSopenharmony_ci                                       <swizzleSuffix>)
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    <paramUseS>             ::= <constantScalar> 
1695bd8deadSopenharmony_ci                                  (*** instead of <constantScalar>
1705bd8deadSopenharmony_ci                                       <scalarSuffix>)
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    <ccMask>                ::= "(" <ccTest> ")"
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    <ccTest>                ::= <ccMaskRule> <swizzleSuffix>
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    <ccMaskRule>            ::= "EQ"
1775bd8deadSopenharmony_ci                              | "GE"
1785bd8deadSopenharmony_ci                              | "GT"
1795bd8deadSopenharmony_ci                              | "LE"
1805bd8deadSopenharmony_ci                              | "LT"
1815bd8deadSopenharmony_ci                              | "NE"
1825bd8deadSopenharmony_ci                              | "TR"
1835bd8deadSopenharmony_ci                              | "FL"
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    (modify language describing reserved keywords) The following strings
1865bd8deadSopenharmony_ci    are reserved keywords and may not be used as identifiers:
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci        ALIAS, ATTRIB, END, OPTION, OUTPUT, PARAM, TEMP, fragment,
1895bd8deadSopenharmony_ci        program, result, state, and texture.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    Additionally, all the instruction names (and variants) listed in
1925bd8deadSopenharmony_ci    Table X.5 are reserved.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    Modify Section 3.11.3.3, Fragment Program Temporaries
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    (replace second paragraph) Fragment program temporary variables
1975bd8deadSopenharmony_ci    can be declared explicitly using the <TEMP_statement> grammar
1985bd8deadSopenharmony_ci    rule.  Each such statement can declare one or more temporaries.
1995bd8deadSopenharmony_ci    Temporary declaration can optionally specify a variable size,
2005bd8deadSopenharmony_ci    using the <varSize> grammar rule.  Variables declared as "SHORT"
2015bd8deadSopenharmony_ci    will represented with at least 16 bits per component (5 bits of
2025bd8deadSopenharmony_ci    exponent, 10 bits of mantissa).  Variables declared as "LONG" will be
2035bd8deadSopenharmony_ci    represented with at least 32 bits per component (8 bits of exponent,
2045bd8deadSopenharmony_ci    23 bits of mantissa).  Fragment program temporary variables can not
2055bd8deadSopenharmony_ci    be declared implicitly.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    Modify Section 3.11.3.4, Fragment Program Results
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    (replace second paragraph) Fragment program result variables
2105bd8deadSopenharmony_ci    can be declared explicitly using the <OUTPUT_statement> grammar
2115bd8deadSopenharmony_ci    rule, or implicitly using the <resultBinding> grammar rule in an
2125bd8deadSopenharmony_ci    executable instruction.  Explicit result variable declaration can
2135bd8deadSopenharmony_ci    optionally specify a variable size, using the <varSize> grammar rule.
2145bd8deadSopenharmony_ci    Variables declared as "SHORT" will represented with at least 16
2155bd8deadSopenharmony_ci    bits per component (5 bits of exponent, 10 bits of mantissa).
2165bd8deadSopenharmony_ci    Variables declared as "LONG" will be represented with at least
2175bd8deadSopenharmony_ci    32 bits per component (8 bits of exponent, 23 bits of mantissa).
2185bd8deadSopenharmony_ci    Each fragment program result variable is bound to a fragment attribute
2195bd8deadSopenharmony_ci    used in subsequent back-end processing.  The set of fragment program
2205bd8deadSopenharmony_ci    result variable bindings is given in Table X.3.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    (add to the end of a section) A fragment program will fail to load if
2235bd8deadSopenharmony_ci    contains instructions writing to variables bound to the same result,
2245bd8deadSopenharmony_ci    but declared with different sizes.
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    Add New Section 3.11.3.X, Condition Code Register (insert after
2275bd8deadSopenharmony_ci    Section 3.11.3.4, Fragment Program Results)
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    The fragment program condition code register is a single
2305bd8deadSopenharmony_ci    four-component vector.  Each component of this register is one of four
2315bd8deadSopenharmony_ci    enumerated values: GT (greater than), EQ (equal), LT (less than),
2325bd8deadSopenharmony_ci    or UN (unordered).  The condition code register can be used to mask
2335bd8deadSopenharmony_ci    writes to registers and to evaluate conditional branches.
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    Most fragment program instructions can optionally update the condition
2365bd8deadSopenharmony_ci    code register.  When a fragment program instruction updates the
2375bd8deadSopenharmony_ci    condition code register, a condition code component is set to LT if
2385bd8deadSopenharmony_ci    the corresponding component of the result is less than zero, EQ if it
2395bd8deadSopenharmony_ci    is equal to zero, GT if it is greater than zero, and UN if it is NaN
2405bd8deadSopenharmony_ci    (not a number).
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    The condition code register is initialized to a vector of EQ values
2435bd8deadSopenharmony_ci    each time a fragment program executes.
2445bd8deadSopenharmony_ci    
2455bd8deadSopenharmony_ci    Modify Section 3.11.4, Fragment Program Execution Environment
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    (modify instruction table) There are fifty-two fragment program
2485bd8deadSopenharmony_ci    instructions.  Fragment program instructions may have up to sixteen
2495bd8deadSopenharmony_ci    variants, including a suffix of "R", "H", or "X" to specify arithmetic
2505bd8deadSopenharmony_ci    precision (section 3.11.4.X), a suffix of "C" to allow an update
2515bd8deadSopenharmony_ci    of the condition code register (section 3.11.3.X), and a suffix of
2525bd8deadSopenharmony_ci    "_SAT" to clamp the result vector components to the range [0,1]
2535bd8deadSopenharmony_ci    (section 3.11.4.3).  For example, the sixteen forms of the "ADD"
2545bd8deadSopenharmony_ci    instruction are "ADD", "ADDR", "ADDH", "ADDX", "ADDC", "ADDRC",
2555bd8deadSopenharmony_ci    "ADDHC", "ADDXC", "ADD_SAT", "ADDR_SAT", "ADDH_SAT", "ADDX_SAT",
2565bd8deadSopenharmony_ci    "ADDC_SAT", "ADDRC_SAT", "ADDHC_SAT", and "ADDXC_SAT".The instructions
2575bd8deadSopenharmony_ci    and their respective input and output parameters are summarized in
2585bd8deadSopenharmony_ci    Table X.5.
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci               Modifiers
2615bd8deadSopenharmony_ci      Instr.   R H X C S  Inputs  Output   Description
2625bd8deadSopenharmony_ci      -------  - - - - -  ------  ------   --------------------------------
2635bd8deadSopenharmony_ci      ABS      X X X X X  v       v        absolute value
2645bd8deadSopenharmony_ci      ADD      X X X X X  v,v     v        add
2655bd8deadSopenharmony_ci      CMP      - - - - X  v,v,v   v        compare
2665bd8deadSopenharmony_ci      COS      X X - X X  s       ssss     cosine with reduction to [-PI,PI]
2675bd8deadSopenharmony_ci      DDX      X X - X X  v       v        partial derivative relative to X
2685bd8deadSopenharmony_ci      DDY      X X - X X  v       v        partial derivative relative to Y
2695bd8deadSopenharmony_ci      DP3      X X X X X  v,v     ssss     3-component dot product
2705bd8deadSopenharmony_ci      DP4      X X X X X  v,v     ssss     4-component dot product
2715bd8deadSopenharmony_ci      DPH      X X X X X  v,v     ssss     homogeneous dot product
2725bd8deadSopenharmony_ci      DST      X X - X X  v,v     v        distance vector
2735bd8deadSopenharmony_ci      EX2      X X - X X  s       ssss     exponential base 2
2745bd8deadSopenharmony_ci      FLR      X X X X X  v       v        floor
2755bd8deadSopenharmony_ci      FRC      X X X X X  v       v        fraction
2765bd8deadSopenharmony_ci      KIL      - - - - -  v or c  -        kill fragment
2775bd8deadSopenharmony_ci      LG2      X X - X X  s       ssss     logarithm base 2
2785bd8deadSopenharmony_ci      LIT      X X - X X  v       v        compute light coefficients
2795bd8deadSopenharmony_ci      LRP      X X X X X  v,v,v   v        linear interpolation
2805bd8deadSopenharmony_ci      MAD      X X X X X  v,v,v   v        multiply and add
2815bd8deadSopenharmony_ci      MAX      X X X X X  v,v     v        maximum
2825bd8deadSopenharmony_ci      MIN      X X X X X  v,v     v        minimum
2835bd8deadSopenharmony_ci      MOV      X X X X X  v       v        move
2845bd8deadSopenharmony_ci      MUL      X X X X X  v,v     v        multiply
2855bd8deadSopenharmony_ci      PK2H     - - - - -  v       ssss     pack two 16-bit floats
2865bd8deadSopenharmony_ci      PK2US    - - - - -  v       ssss     pack two unsigned 16-bit scalars
2875bd8deadSopenharmony_ci      PK4B     - - - - -  v       ssss     pack four signed 8-bit scalars
2885bd8deadSopenharmony_ci      PK4UB    - - - - -  v       ssss     pack four unsigned 8-bit scalars
2895bd8deadSopenharmony_ci      POW      X X - X X  s,s     ssss     exponentiate
2905bd8deadSopenharmony_ci      RCP      X X - X X  s       ssss     reciprocal
2915bd8deadSopenharmony_ci      RFL      X X - X X  v,v     v        reflection vector
2925bd8deadSopenharmony_ci      RSQ      X X - X X  s       ssss     reciprocal square root
2935bd8deadSopenharmony_ci      SCS      - - - - X  s       ss--     sine/cosine without reduction
2945bd8deadSopenharmony_ci      SEQ      X X X X X  v,v     v        set on equal
2955bd8deadSopenharmony_ci      SFL      X X X X X  v,v     v        set on false
2965bd8deadSopenharmony_ci      SGE      X X X X X  v,v     v        set on greater than or equal
2975bd8deadSopenharmony_ci      SGT      X X X X X  v,v     v        set on greater than
2985bd8deadSopenharmony_ci      SIN      X X - X X  s       ssss     sine with reduction to [-PI,PI]
2995bd8deadSopenharmony_ci      SLE      X X X X X  v,v     v        set on less than or equal
3005bd8deadSopenharmony_ci      SLT      X X X X X  v,v     v        set on less than
3015bd8deadSopenharmony_ci      SNE      X X X X X  v,v     v        set on not equal
3025bd8deadSopenharmony_ci      STR      X X X X X  v,v     v        set on true
3035bd8deadSopenharmony_ci      SUB      X X X X X  v,v     v        subtract
3045bd8deadSopenharmony_ci      SWZ      - - - - X  v       v        extended swizzle
3055bd8deadSopenharmony_ci      TEX      - - - X X  v       v        texture sample
3065bd8deadSopenharmony_ci      TXB      - - - X X  v       v        texture sample with bias
3075bd8deadSopenharmony_ci      TXD      - - - X X  v,v,v   v        texture sample w/partials      
3085bd8deadSopenharmony_ci      TXP      - - - X X  v       v        texture sample with projection
3095bd8deadSopenharmony_ci      UP2H     - - - X X  s       v        unpack two 16-bit floats
3105bd8deadSopenharmony_ci      UP2US    - - - X X  s       v        unpack two unsigned 16-bit scalars
3115bd8deadSopenharmony_ci      UP4B     - - - X X  s       v        unpack four signed 8-bit scalars
3125bd8deadSopenharmony_ci      UP4UB    - - - X X  s       v        unpack four unsigned 8-bit scalars
3135bd8deadSopenharmony_ci      X2D      X X - X X  v,v,v   v        2D coordinate transformation
3145bd8deadSopenharmony_ci      XPD      - - - - X  v,v     v        cross product
3155bd8deadSopenharmony_ci
3165bd8deadSopenharmony_ci      Table X.5:  Summary of fragment program instructions.  The columns
3175bd8deadSopenharmony_ci      "R", "H", "X", "C", and "S" indicate whether the "R", "H", or "X"
3185bd8deadSopenharmony_ci      precision modifiers, the C condition code update modifier, and the
3195bd8deadSopenharmony_ci      "_SAT" saturation modifier, respectively, are supported for the
3205bd8deadSopenharmony_ci      opcode.  In the input/output columns, "v" indicates a floating-point
3215bd8deadSopenharmony_ci      vector input or output, "s" indicates a floating-point scalar
3225bd8deadSopenharmony_ci      input, "ssss" indicates a scalar output replicated across a
3235bd8deadSopenharmony_ci      4-component result vector, "ss--" indicates two scalar outputs in
3245bd8deadSopenharmony_ci      the first two components, and "c" indicates a condition code test.
3255bd8deadSopenharmony_ci      Instructions describe as "texture sample" also specify a texture
3265bd8deadSopenharmony_ci      image unit identifier and a texture target.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci    Modify Section 3.11.4.1, Fragment Program Operands
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci    (add prior to the discussion of negation) A component-wise absolute
3315bd8deadSopenharmony_ci    value operation can optionally performed on the operand if the operand
3325bd8deadSopenharmony_ci    is surrounded with two "|" characters.  For example, "|src|" indicates
3335bd8deadSopenharmony_ci    that a component-wise absolute value operation should be performed on
3345bd8deadSopenharmony_ci    the variable named "src".  In terms of the grammar, this operation
3355bd8deadSopenharmony_ci    is performed if the <instOperandV> or <instOperandS> grammar rules
3365bd8deadSopenharmony_ci    match <instOperandAbsV> or <instOperandAbsS>, respectively.
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci    (modify operand load pseudo-code) The following pseudo-code spells
3395bd8deadSopenharmony_ci    out the operand generation process.  In the example, "float" is a
3405bd8deadSopenharmony_ci    floating-point scalar type, while "floatVec" is a four-component
3415bd8deadSopenharmony_ci    vector.  "source" refers to the register used for the operand,
3425bd8deadSopenharmony_ci    matching the <srcReg> rule.  "abs" is TRUE if an absolute value
3435bd8deadSopenharmony_ci    operation should be performed on the operand (<instOperandAbsV> or
3445bd8deadSopenharmony_ci    <instOperandAbsS> rules) "negate" is TRUE if the <optionalSign> rule
3455bd8deadSopenharmony_ci    in <scalarSrcReg> or <swizzleSrcReg> matches "-" and FALSE otherwise.
3465bd8deadSopenharmony_ci    The ".c***", ".*c**", ".**c*", ".***c" modifiers refer to the x,
3475bd8deadSopenharmony_ci    y, z, and w components obtained by the swizzle operation; the ".c"
3485bd8deadSopenharmony_ci    modifier refers to the single component selected for a scalar load.
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci      floatVec VectorLoad(floatVec source)
3515bd8deadSopenharmony_ci      {
3525bd8deadSopenharmony_ci          floatVec operand;
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci          operand.x = source.c***;
3555bd8deadSopenharmony_ci          operand.y = source.*c**;
3565bd8deadSopenharmony_ci          operand.z = source.**c*;
3575bd8deadSopenharmony_ci          operand.w = source.***c;
3585bd8deadSopenharmony_ci          if (abs) {
3595bd8deadSopenharmony_ci             operand.x = abs(operand.x);
3605bd8deadSopenharmony_ci             operand.y = abs(operand.y);
3615bd8deadSopenharmony_ci             operand.z = abs(operand.z);
3625bd8deadSopenharmony_ci             operand.w = abs(operand.w);
3635bd8deadSopenharmony_ci          }
3645bd8deadSopenharmony_ci          if (negate) {
3655bd8deadSopenharmony_ci             operand.x = -operand.x;
3665bd8deadSopenharmony_ci             operand.y = -operand.y;
3675bd8deadSopenharmony_ci             operand.z = -operand.z;
3685bd8deadSopenharmony_ci             operand.w = -operand.w;
3695bd8deadSopenharmony_ci          }
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci          return operand;
3725bd8deadSopenharmony_ci      }
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci      float ScalarLoad(floatVec source) 
3755bd8deadSopenharmony_ci      {
3765bd8deadSopenharmony_ci          float operand;
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci          operand = source.c;
3795bd8deadSopenharmony_ci          if (abs) {
3805bd8deadSopenharmony_ci            operand = abs(operand);
3815bd8deadSopenharmony_ci          if (negate) {
3825bd8deadSopenharmony_ci            operand = -operand;
3835bd8deadSopenharmony_ci          }
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci          return operand;
3865bd8deadSopenharmony_ci      }
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ci    Add New Section 3.11.4.X, Fragment Program Operation Precision
3895bd8deadSopenharmony_ci    (insert after Section 3.11.4,2, Fragment Program Parameter Arrays)
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    Fragment program implementations may be able to perform instructions
3925bd8deadSopenharmony_ci    with different levels of arithmetic precision.  The "R", "H", and
3935bd8deadSopenharmony_ci    "X" opcode precision modifiers (Section 3.11.4) specify the minimum
3945bd8deadSopenharmony_ci    precision used to perform arithmetic operations.  Instructions with
3955bd8deadSopenharmony_ci    an "R" precision modifiers will be carried out at no less than
3965bd8deadSopenharmony_ci    IEEE single-precision floating-point (8 bits of exponent, 23 bits
3975bd8deadSopenharmony_ci    of mantissa).  Instructions with an "H" precision modifier will
3985bd8deadSopenharmony_ci    be carried out at no less than 16-bit floating-point precision (5
3995bd8deadSopenharmony_ci    bits of exponent, 10 bits of mantissa).  Instructions with an "X"
4005bd8deadSopenharmony_ci    precision modifier will be carried out at no less than signed 12-bit
4015bd8deadSopenharmony_ci    fixed-point precision (two's complement with 10 fraction bits).
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    If the result of a computation overflows the range of numbers
4045bd8deadSopenharmony_ci    supported by the instruction precision, the result will be +/-INF
4055bd8deadSopenharmony_ci    (infinity) for "R" and "H" precision, or -2048/1024 or +2047/1024 for
4065bd8deadSopenharmony_ci    "X" precision.
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci    If no precision modifier is specified, the instruction will be carried
4095bd8deadSopenharmony_ci    out with at least as much precision as the destination variable.
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    Rewrite Section 3.11.4.3,  Fragment Program Destination Register
4125bd8deadSopenharmony_ci    Update
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci    Most fragment program instructions write a 4-component result vector
4155bd8deadSopenharmony_ci    to a single temporary or fragment result register.  Writes to
4165bd8deadSopenharmony_ci    individual components of the destination register are controlled
4175bd8deadSopenharmony_ci    by individual component write masks specified as part of the
4185bd8deadSopenharmony_ci    instruction.
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ci    The component write mask is specified by the <optionalMask> rule
4215bd8deadSopenharmony_ci    found in the <maskedDstReg> rule.  If the optional mask is "",
4225bd8deadSopenharmony_ci    all components are enabled.  Otherwise, the optional mask names
4235bd8deadSopenharmony_ci    the individual components to enable.  The characters "x", "y",
4245bd8deadSopenharmony_ci    "z", and "w" match the x, y, z, and w components, respectively.
4255bd8deadSopenharmony_ci    For example, an optional mask of ".xzw" indicates that the x, z,
4265bd8deadSopenharmony_ci    and w components should be enabled for writing but the y component
4275bd8deadSopenharmony_ci    should not.  The grammar requires that the destination register mask
4285bd8deadSopenharmony_ci    components must be listed in "xyzw" order.
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    The condition code write mask is specified by the <ccMask> rule found
4315bd8deadSopenharmony_ci    in the <instResultCC> rule.  The condition code register is loaded and
4325bd8deadSopenharmony_ci    swizzled according to the swizzle codes specified by <swizzleSuffix>.
4335bd8deadSopenharmony_ci    Each component of the swizzled condition code is tested according to
4345bd8deadSopenharmony_ci    the rule given by <ccMaskRule>.  <ccMaskRule> may have the values
4355bd8deadSopenharmony_ci    "EQ", "NE", "LT", "GE", LE", or "GT", which mean to enable writes
4365bd8deadSopenharmony_ci    if the corresponding condition code field evaluates to equal,
4375bd8deadSopenharmony_ci    not equal, less than, greater than or equal, less than or equal,
4385bd8deadSopenharmony_ci    or greater than, respectively.  Comparisons involving condition
4395bd8deadSopenharmony_ci    codes of "UN" (unordered) evaluate to true for "NE" and false
4405bd8deadSopenharmony_ci    otherwise.  For example, if the condition code is (GT,LT,EQ,GT)
4415bd8deadSopenharmony_ci    and the condition code mask is "(NE.zyxw)", the swizzle operation
4425bd8deadSopenharmony_ci    will load (EQ,LT,GT,GT) and the mask will thus will enable writes on
4435bd8deadSopenharmony_ci    the y, z, and w components.  In addition, "TR" always enables writes
4445bd8deadSopenharmony_ci    and "FL" always disables writes, regardless of the condition code.
4455bd8deadSopenharmony_ci    If the condition code mask is empty, it is treated as "(TR)".
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    Each component of the destination register is updated with the result
4485bd8deadSopenharmony_ci    of the fragment program instruction if and only if the component is
4495bd8deadSopenharmony_ci    enabled for writes by both the component write mask and the condition
4505bd8deadSopenharmony_ci    code write mask.  Otherwise, the component of the destination register
4515bd8deadSopenharmony_ci    remains unchanged.
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    A fragment program instruction can also optionally update the
4545bd8deadSopenharmony_ci    condition code register.  The condition code is updated if
4555bd8deadSopenharmony_ci    the condition code register update suffix "C" is present in the
4565bd8deadSopenharmony_ci    instruction.  The instruction "ADDC" will update the condition code;
4575bd8deadSopenharmony_ci    the otherwise equivalent instruction "ADD" will not.  If condition
4585bd8deadSopenharmony_ci    code updates are enabled, each component of the destination register
4595bd8deadSopenharmony_ci    enabled for writes is compared to zero.  The corresponding component
4605bd8deadSopenharmony_ci    of the condition code is set to "LT", "EQ", or "GT", if the written
4615bd8deadSopenharmony_ci    component is less than, equal to, or greater than zero, respectively.
4625bd8deadSopenharmony_ci    Condition code components are set to "UN" if the written component is
4635bd8deadSopenharmony_ci    NaN (not a number).  Values of -0.0 and +0.0 both evaluate to "EQ".
4645bd8deadSopenharmony_ci    If a component of the destination register is not enabled for writes,
4655bd8deadSopenharmony_ci    the corresponding condition code component is also unchanged.
4665bd8deadSopenharmony_ci
4675bd8deadSopenharmony_ci    In the following example code,
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ci        # R1=(-2, 0, 2, NaN)              R0                  CC
4705bd8deadSopenharmony_ci        MOVC R0, R1;               # ( -2,  0,   2, NaN) (LT,EQ,GT,UN)
4715bd8deadSopenharmony_ci        MOVC R0.xyz, R1.yzwx;      # (  0,  2, NaN, NaN) (EQ,GT,UN,UN)
4725bd8deadSopenharmony_ci        MOVC R0 (NE), R1.zywx;     # (  0,  0, NaN,  -2) (EQ,EQ,UN,LT)
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    the first instruction writes (-2,0,2,NaN) to R0 and updates the
4755bd8deadSopenharmony_ci    condition code to (LT,EQ,GT,UN).  The second instruction, only the
4765bd8deadSopenharmony_ci    "x", "y", and "z" components of R0 and the condition code are updated,
4775bd8deadSopenharmony_ci    so R0 ends up with (0,2,NaN,NaN) and the condition code ends up with
4785bd8deadSopenharmony_ci    (EQ,GT,UN,UN).  In the third instruction, the condition code mask
4795bd8deadSopenharmony_ci    disables writes to the x component (its condition code field is "EQ"),
4805bd8deadSopenharmony_ci    so R0 ends up with (0,0,NaN,-2) and the condition code ends up with
4815bd8deadSopenharmony_ci    (EQ,EQ,UN,LT).
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    The following pseudocode illustrates the process of writing a result
4845bd8deadSopenharmony_ci    vector to the destination register.  In the pseudocode, "instrmask"
4855bd8deadSopenharmony_ci    refers to the component write mask given by the <optWriteMask>
4865bd8deadSopenharmony_ci    rule.  "ccMaskRule" refers to the condition code mask rule given
4875bd8deadSopenharmony_ci    by <ccMask> and "updatecc" is TRUE if and only if condition code
4885bd8deadSopenharmony_ci    updates are enabled.  "result", "destination", and "cc" refer to
4895bd8deadSopenharmony_ci    the result vector, the register selected by <dstRegister> and the
4905bd8deadSopenharmony_ci    condition code, respectively.  Condition codes do not exist in the
4915bd8deadSopenharmony_ci    VP1 execution environment.
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci      boolean TestCC(CondCode field) {
4945bd8deadSopenharmony_ci          switch (ccMaskRule) {
4955bd8deadSopenharmony_ci          case "EQ":  return (field == "EQ");
4965bd8deadSopenharmony_ci          case "NE":  return (field != "EQ");
4975bd8deadSopenharmony_ci          case "LT":  return (field == "LT");
4985bd8deadSopenharmony_ci          case "GE":  return (field == "GT" || field == "EQ");
4995bd8deadSopenharmony_ci          case "LE":  return (field == "LT" || field == "EQ");
5005bd8deadSopenharmony_ci          case "GT":  return (field == "GT");
5015bd8deadSopenharmony_ci          case "TR":  return TRUE;
5025bd8deadSopenharmony_ci          case "FL":  return FALSE;
5035bd8deadSopenharmony_ci          case "":    return TRUE;
5045bd8deadSopenharmony_ci          }
5055bd8deadSopenharmony_ci      }
5065bd8deadSopenharmony_ci
5075bd8deadSopenharmony_ci      enum GenerateCC(float value) {
5085bd8deadSopenharmony_ci        if (value == NaN) {
5095bd8deadSopenharmony_ci          return UN;
5105bd8deadSopenharmony_ci        } else if (value < 0) {
5115bd8deadSopenharmony_ci          return LT;
5125bd8deadSopenharmony_ci        } else if (value == 0) {
5135bd8deadSopenharmony_ci          return EQ;
5145bd8deadSopenharmony_ci        } else {
5155bd8deadSopenharmony_ci          return GT;
5165bd8deadSopenharmony_ci        }
5175bd8deadSopenharmony_ci      }
5185bd8deadSopenharmony_ci
5195bd8deadSopenharmony_ci      void UpdateDestination(floatVec destination, floatVec result)
5205bd8deadSopenharmony_ci      {
5215bd8deadSopenharmony_ci          floatVec merged;
5225bd8deadSopenharmony_ci          ccVec    mergedCC;
5235bd8deadSopenharmony_ci
5245bd8deadSopenharmony_ci          // Merge the converted result into the destination register, under
5255bd8deadSopenharmony_ci          // control of the compile- and run-time write masks.
5265bd8deadSopenharmony_ci          merged = destination;
5275bd8deadSopenharmony_ci          mergedCC = cc;
5285bd8deadSopenharmony_ci          if (instrMask.x && TestCC(cc.c***)) {
5295bd8deadSopenharmony_ci              merged.x = result.x;
5305bd8deadSopenharmony_ci              if (updatecc) mergedCC.x = GenerateCC(result.x);
5315bd8deadSopenharmony_ci          }
5325bd8deadSopenharmony_ci          if (instrMask.y && TestCC(cc.*c**)) {
5335bd8deadSopenharmony_ci              merged.y = result.y;
5345bd8deadSopenharmony_ci              if (updatecc) mergedCC.y = GenerateCC(result.y);
5355bd8deadSopenharmony_ci          }
5365bd8deadSopenharmony_ci          if (instrMask.z && TestCC(cc.**c*)) {
5375bd8deadSopenharmony_ci              merged.z = result.z;
5385bd8deadSopenharmony_ci              if (updatecc) mergedCC.z = GenerateCC(result.z);
5395bd8deadSopenharmony_ci          }
5405bd8deadSopenharmony_ci          if (instrMask.w && TestCC(cc.***c)) {
5415bd8deadSopenharmony_ci              merged.w = result.w;
5425bd8deadSopenharmony_ci              if (updatecc) mergedCC.w = GenerateCC(result.w);
5435bd8deadSopenharmony_ci          }
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci          // Write out the new destination register and condition code.
5465bd8deadSopenharmony_ci          destination = merged;
5475bd8deadSopenharmony_ci          cc = mergedCC;
5485bd8deadSopenharmony_ci      }
5495bd8deadSopenharmony_ci
5505bd8deadSopenharmony_ci    Add to Section 3.11.4.5 of ARB_fragment_program (Fragment Program
5515bd8deadSopenharmony_ci    Options):
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci    Section 3.11.4.5.3, NV_fragment_program Option
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci    If a fragment program specifies the "NV_fragment_program" option,
5565bd8deadSopenharmony_ci    the grammar will be extended to support the features found in the
5575bd8deadSopenharmony_ci    NV_fragment_program extension not present in the ARB_fragment_program
5585bd8deadSopenharmony_ci    extension, including:
5595bd8deadSopenharmony_ci
5605bd8deadSopenharmony_ci      * the availability of the following instructions:
5615bd8deadSopenharmony_ci
5625bd8deadSopenharmony_ci          - DDX (partial derivative relative to X), 
5635bd8deadSopenharmony_ci          - DDY (partial derivative relative to Y), 
5645bd8deadSopenharmony_ci          - PK2H (pack as two half floats),
5655bd8deadSopenharmony_ci          - PK2US (pack as two unsigned shorts), 
5665bd8deadSopenharmony_ci          - PK4B (pack as four signed bytes),
5675bd8deadSopenharmony_ci          - PK4UB (pack as four unsigned bytes), 
5685bd8deadSopenharmony_ci          - RFL (reflection vector), 
5695bd8deadSopenharmony_ci          - SEQ (set on equal to), 
5705bd8deadSopenharmony_ci          - SFL (set on false), 
5715bd8deadSopenharmony_ci          - SGT (set on greater than),
5725bd8deadSopenharmony_ci          - SLE (set on less than or equal to),
5735bd8deadSopenharmony_ci          - SNE (set on not equal to),
5745bd8deadSopenharmony_ci          - STR (set on true),
5755bd8deadSopenharmony_ci          - TXD (texture lookup with computed partial derivatives),
5765bd8deadSopenharmony_ci          - UP2H (unpack two half floats),
5775bd8deadSopenharmony_ci          - UP2US (unpack two unsigned shorts),
5785bd8deadSopenharmony_ci          - UP4B (unpack four signed bytes),
5795bd8deadSopenharmony_ci          - UP4UB (unpack four unsigned bytes), and
5805bd8deadSopenharmony_ci          - X2D (2D coordinate transformation),
5815bd8deadSopenharmony_ci
5825bd8deadSopenharmony_ci      * opcode precision suffixes "R", "H", and "X", to specify
5835bd8deadSopenharmony_ci        the precision of arithmetic operations ("R" specifies 32-bit
5845bd8deadSopenharmony_ci        floating-point computations, "H" specifies 16-bit floating-point
5855bd8deadSopenharmony_ci        computations, and "X" specifies 12-bit signed fixed-point
5865bd8deadSopenharmony_ci        computations with 10 fraction bits),
5875bd8deadSopenharmony_ci
5885bd8deadSopenharmony_ci      * the availability of the "SHORT" and "LONG" variable precision
5895bd8deadSopenharmony_ci        keywords to control the size of a variable's components,
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci      * a four-component condition code register to hold the sign of
5925bd8deadSopenharmony_ci        result vector components (useful for comparisons),
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci      * a condition code update opcode suffix "C", where the results of
5955bd8deadSopenharmony_ci        the instruction are used to update the condition code register,
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ci      * a condition code write mask operator, where the condition code
5985bd8deadSopenharmony_ci        register is swizzled and tested, and the test results are used
5995bd8deadSopenharmony_ci        to mask register writes,
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci      * an absolute value operator on scalar and swizzled source inputs
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    The added functionality is identical to that provided by the
6045bd8deadSopenharmony_ci    NV_fragment_program extension specification.
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci    Modify Section 3.11.5,  Fragment Program ALU Instruction Set
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ci    Section 3.11.5.30,  DDX:  Derivative Relative to X
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci    The DDX instruction computes approximate partial derivatives of the
6115bd8deadSopenharmony_ci    four components of the single operand with respect to the X window
6125bd8deadSopenharmony_ci    coordinate to yield a result vector.  The partial derivatives are
6135bd8deadSopenharmony_ci    evaluated at the center of the pixel.
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ci      f = VectorLoad(op0);
6165bd8deadSopenharmony_ci      result = ComputePartialX(f);
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    Note that the partial derivates obtained by this instruction are
6195bd8deadSopenharmony_ci    approximate, and derivative-of-derivate instruction sequences may
6205bd8deadSopenharmony_ci    not yield accurate second derivatives.
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci    Section 3.11.5.31,  DDY:  Derivative Relative to Y
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci    The DDY instruction computes approximate partial derivatives of the
6255bd8deadSopenharmony_ci    four components of the single operand with respect to the Y window
6265bd8deadSopenharmony_ci    coordinate to yield a result vector.  The partial derivatives are
6275bd8deadSopenharmony_ci    evaluated at the center of the pixel.
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci      f = VectorLoad(op0);
6305bd8deadSopenharmony_ci      result = ComputePartialY(f);
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ci    Note that the partial derivates obtained by this instruction are
6335bd8deadSopenharmony_ci    approximate, and derivative-of-derivate instruction sequences may
6345bd8deadSopenharmony_ci    not yield accurate second derivatives.
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci    Section 3.11.5.32,  PK2H:  Pack Two 16-bit Floats
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ci    The PK2H instruction converts the "x" and "y" components of
6395bd8deadSopenharmony_ci    the single operand into 16-bit floating-point format, packs the
6405bd8deadSopenharmony_ci    bit representation of these two floats into a 32-bit value, and
6415bd8deadSopenharmony_ci    replicates that value to all four components of the result vector.
6425bd8deadSopenharmony_ci    The PK2H instruction can be reversed by the UP2H instruction below.
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
6455bd8deadSopenharmony_ci      /* result obtained by combining raw bits of tmp0.x, tmp0.y */
6465bd8deadSopenharmony_ci      result.x = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
6475bd8deadSopenharmony_ci      result.y = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
6485bd8deadSopenharmony_ci      result.z = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
6495bd8deadSopenharmony_ci      result.w = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
6505bd8deadSopenharmony_ci
6515bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a PK2H instruction
6525bd8deadSopenharmony_ci    that writes its results to a variable declared as "SHORT".
6535bd8deadSopenharmony_ci
6545bd8deadSopenharmony_ci    Section 3.11.5.33,  PK2US:  Pack Two Unsigned 16-bit Scalars
6555bd8deadSopenharmony_ci
6565bd8deadSopenharmony_ci    The PK2US instruction converts the "x" and "y" components of the
6575bd8deadSopenharmony_ci    single operand into a packed pair of 16-bit unsigned scalars.
6585bd8deadSopenharmony_ci    The scalars are represented in a bit pattern where all '0' bits
6595bd8deadSopenharmony_ci    corresponds to 0.0 and all '1' bits corresponds to 1.0.  The bit
6605bd8deadSopenharmony_ci    representations of the two converted components are packed into a
6615bd8deadSopenharmony_ci    32-bit value, and that value is replicated to all four components
6625bd8deadSopenharmony_ci    of the result vector.  The PK2US instruction can be reversed by the
6635bd8deadSopenharmony_ci    UP2US instruction below.
6645bd8deadSopenharmony_ci
6655bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
6665bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
6675bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
6685bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
6695bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
6705bd8deadSopenharmony_ci      us.x = round(65535.0 * tmp0.x);  /* us is a ushort vector */
6715bd8deadSopenharmony_ci      us.y = round(65535.0 * tmp0.y);
6725bd8deadSopenharmony_ci      /* result obtained by combining raw bits of us. */
6735bd8deadSopenharmony_ci      result.x = ((us.x) | (us.y << 16));
6745bd8deadSopenharmony_ci      result.y = ((us.x) | (us.y << 16));
6755bd8deadSopenharmony_ci      result.z = ((us.x) | (us.y << 16));
6765bd8deadSopenharmony_ci      result.w = ((us.x) | (us.y << 16));
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a PK2S instruction
6795bd8deadSopenharmony_ci    that writes its results to a variable declared as "SHORT".
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    Section 3.11.5.34,  PK4B:  Pack Four Signed 8-bit Scalars
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ci    The PK4B instruction converts the four components of the single
6845bd8deadSopenharmony_ci    operand into 8-bit signed quantities.  The signed quantities
6855bd8deadSopenharmony_ci    are represented in a bit pattern where all '0' bits corresponds
6865bd8deadSopenharmony_ci    to -128/127 and all '1' bits corresponds to +127/127.  The bit
6875bd8deadSopenharmony_ci    representations of the four converted components are packed into a
6885bd8deadSopenharmony_ci    32-bit value, and that value is replicated to all four components
6895bd8deadSopenharmony_ci    of the result vector.  The PK4B instruction can be reversed by the
6905bd8deadSopenharmony_ci    UP4B instruction below.
6915bd8deadSopenharmony_ci
6925bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
6935bd8deadSopenharmony_ci      if (tmp0.x < -128/127) tmp0.x = -128/127;
6945bd8deadSopenharmony_ci      if (tmp0.y < -128/127) tmp0.y = -128/127;
6955bd8deadSopenharmony_ci      if (tmp0.z < -128/127) tmp0.z = -128/127;
6965bd8deadSopenharmony_ci      if (tmp0.w < -128/127) tmp0.w = -128/127;
6975bd8deadSopenharmony_ci      if (tmp0.x > +127/127) tmp0.x = +127/127;
6985bd8deadSopenharmony_ci      if (tmp0.y > +127/127) tmp0.y = +127/127;
6995bd8deadSopenharmony_ci      if (tmp0.z > +127/127) tmp0.z = +127/127;
7005bd8deadSopenharmony_ci      if (tmp0.w > +127/127) tmp0.w = +127/127;
7015bd8deadSopenharmony_ci      ub.x = round(127.0 * tmp0.x + 128.0);  /* ub is a ubyte vector */
7025bd8deadSopenharmony_ci      ub.y = round(127.0 * tmp0.y + 128.0);
7035bd8deadSopenharmony_ci      ub.z = round(127.0 * tmp0.z + 128.0);
7045bd8deadSopenharmony_ci      ub.w = round(127.0 * tmp0.w + 128.0);
7055bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
7065bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7075bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7085bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7095bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7105bd8deadSopenharmony_ci
7115bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a PK4B instruction
7125bd8deadSopenharmony_ci    that writes its results to a variable declared as "SHORT".
7135bd8deadSopenharmony_ci
7145bd8deadSopenharmony_ci    Section 3.11.5.35,  PK4UB:  Pack Four Unsigned 8-bit Scalars
7155bd8deadSopenharmony_ci
7165bd8deadSopenharmony_ci    The PK4UB instruction converts the four components of the single
7175bd8deadSopenharmony_ci    operand into a packed grouping of 8-bit unsigned scalars.  The scalars
7185bd8deadSopenharmony_ci    are represented in a bit pattern where all '0' bits corresponds to
7195bd8deadSopenharmony_ci    0.0 and all '1' bits corresponds to 1.0.  The bit representations
7205bd8deadSopenharmony_ci    of the four converted components are packed into a 32-bit value, and
7215bd8deadSopenharmony_ci    that value is replicated to all four components of the result vector.
7225bd8deadSopenharmony_ci    The PK4UB instruction can be reversed by the UP4UB instruction below.
7235bd8deadSopenharmony_ci
7245bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
7255bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
7265bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
7275bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
7285bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
7295bd8deadSopenharmony_ci      if (tmp0.z < 0.0) tmp0.z = 0.0;
7305bd8deadSopenharmony_ci      if (tmp0.z > 1.0) tmp0.z = 1.0;
7315bd8deadSopenharmony_ci      if (tmp0.w < 0.0) tmp0.w = 0.0;
7325bd8deadSopenharmony_ci      if (tmp0.w > 1.0) tmp0.w = 1.0;
7335bd8deadSopenharmony_ci      ub.x = round(255.0 * tmp0.x);  /* ub is a ubyte vector */
7345bd8deadSopenharmony_ci      ub.y = round(255.0 * tmp0.y);
7355bd8deadSopenharmony_ci      ub.z = round(255.0 * tmp0.z);
7365bd8deadSopenharmony_ci      ub.w = round(255.0 * tmp0.w);
7375bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
7385bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7395bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7405bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7415bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a PK4UB
7445bd8deadSopenharmony_ci    instruction that writes its results to a variable declared as
7455bd8deadSopenharmony_ci    "SHORT".
7465bd8deadSopenharmony_ci
7475bd8deadSopenharmony_ci    Section 3.11.5.36,  RFL:  Reflection Vector
7485bd8deadSopenharmony_ci
7495bd8deadSopenharmony_ci    The RFL instruction computes the reflection of the second vector
7505bd8deadSopenharmony_ci    operand (the "direction" vector) about the vector specified by the
7515bd8deadSopenharmony_ci    first vector operand (the "axis" vector).  Both operands are treated
7525bd8deadSopenharmony_ci    as 3D vectors (the w components are ignored).  The result vector is
7535bd8deadSopenharmony_ci    another 3D vector (the "reflected direction" vector).  The length
7545bd8deadSopenharmony_ci    of the result vector, ignoring rounding errors, should equal that
7555bd8deadSopenharmony_ci    of the second operand.
7565bd8deadSopenharmony_ci
7575bd8deadSopenharmony_ci      axis = VectorLoad(op0);
7585bd8deadSopenharmony_ci      direction = VectorLoad(op1);
7595bd8deadSopenharmony_ci      tmp.w = (axis.x * axis.x + axis.y * axis.y +
7605bd8deadSopenharmony_ci               axis.z * axis.z);
7615bd8deadSopenharmony_ci      tmp.x = (axis.x * direction.x + axis.y * direction.y + 
7625bd8deadSopenharmony_ci               axis.z * direction.z);
7635bd8deadSopenharmony_ci      tmp.x = 2.0 * tmp.x;
7645bd8deadSopenharmony_ci      tmp.x = tmp.x / tmp.w;
7655bd8deadSopenharmony_ci      result.x = tmp.x * axis.x - direction.x;
7665bd8deadSopenharmony_ci      result.y = tmp.x * axis.y - direction.y;
7675bd8deadSopenharmony_ci      result.z = tmp.x * axis.z - direction.z;
7685bd8deadSopenharmony_ci
7695bd8deadSopenharmony_ci    A fragment program will fail to load if the w component of the result
7705bd8deadSopenharmony_ci    is enabled in the component write mask.
7715bd8deadSopenharmony_ci
7725bd8deadSopenharmony_ci    Section 3.11.5.37,  SEQ:  Set on Equal
7735bd8deadSopenharmony_ci
7745bd8deadSopenharmony_ci    The SEQ instruction performs a component-wise comparison of the
7755bd8deadSopenharmony_ci    two operands.  Each component of the result vector is 1.0 if the
7765bd8deadSopenharmony_ci    corresponding component of the first operand is equal to that of
7775bd8deadSopenharmony_ci    the second, and 0.0 otherwise.
7785bd8deadSopenharmony_ci
7795bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
7805bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
7815bd8deadSopenharmony_ci      result.x = (tmp0.x == tmp1.x) ? 1.0 : 0.0;
7825bd8deadSopenharmony_ci      result.y = (tmp0.y == tmp1.y) ? 1.0 : 0.0;
7835bd8deadSopenharmony_ci      result.z = (tmp0.z == tmp1.z) ? 1.0 : 0.0;
7845bd8deadSopenharmony_ci      result.w = (tmp0.w == tmp1.w) ? 1.0 : 0.0;
7855bd8deadSopenharmony_ci
7865bd8deadSopenharmony_ci    Section 3.11.5.38,  SFL:  Set on False
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    The SFL instruction is a degenerate case of the other "Set on"
7895bd8deadSopenharmony_ci    instructions that sets all components of the result vector to 0.0.
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci      result.x = 0.0;
7925bd8deadSopenharmony_ci      result.y = 0.0;
7935bd8deadSopenharmony_ci      result.z = 0.0;
7945bd8deadSopenharmony_ci      result.w = 0.0;
7955bd8deadSopenharmony_ci
7965bd8deadSopenharmony_ci    Section 3.11.5.39,  SGT:  Set on Greater Than
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci    The SGT instruction performs a component-wise comparison of the
7995bd8deadSopenharmony_ci    two operands.  Each component of the result vector is 1.0 if the
8005bd8deadSopenharmony_ci    corresponding component of the first operands is greater than that
8015bd8deadSopenharmony_ci    of the second, and 0.0 otherwise.
8025bd8deadSopenharmony_ci
8035bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
8045bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
8055bd8deadSopenharmony_ci      result.x = (tmp0.x > tmp1.x) ? 1.0 : 0.0;
8065bd8deadSopenharmony_ci      result.y = (tmp0.y > tmp1.y) ? 1.0 : 0.0;
8075bd8deadSopenharmony_ci      result.z = (tmp0.z > tmp1.z) ? 1.0 : 0.0;
8085bd8deadSopenharmony_ci      result.w = (tmp0.w > tmp1.w) ? 1.0 : 0.0;
8095bd8deadSopenharmony_ci
8105bd8deadSopenharmony_ci    Section 3.11.5.40,  SLE:  Set on Less Than or Equal
8115bd8deadSopenharmony_ci
8125bd8deadSopenharmony_ci    The SLE instruction performs a component-wise comparison of the
8135bd8deadSopenharmony_ci    two operands.  Each component of the result vector is 1.0 if the
8145bd8deadSopenharmony_ci    corresponding component of the first operand is less than or equal
8155bd8deadSopenharmony_ci    to that of the second, and 0.0 otherwise.
8165bd8deadSopenharmony_ci
8175bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
8185bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
8195bd8deadSopenharmony_ci      result.x = (tmp0.x <= tmp1.x) ? 1.0 : 0.0;
8205bd8deadSopenharmony_ci      result.y = (tmp0.y <= tmp1.y) ? 1.0 : 0.0;
8215bd8deadSopenharmony_ci      result.z = (tmp0.z <= tmp1.z) ? 1.0 : 0.0;
8225bd8deadSopenharmony_ci      result.w = (tmp0.w <= tmp1.w) ? 1.0 : 0.0;
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ci    Section 3.11.5.41,  SNE:  Set on Not Equal
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ci    The SNE instruction performs a component-wise comparison of the
8275bd8deadSopenharmony_ci    two operands.  Each component of the result vector is 1.0 if the
8285bd8deadSopenharmony_ci    corresponding component of the first operand is not equal to that
8295bd8deadSopenharmony_ci    of the second, and 0.0 otherwise.
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
8325bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
8335bd8deadSopenharmony_ci      result.x = (tmp0.x != tmp1.x) ? 1.0 : 0.0;
8345bd8deadSopenharmony_ci      result.y = (tmp0.y != tmp1.y) ? 1.0 : 0.0;
8355bd8deadSopenharmony_ci      result.z = (tmp0.z != tmp1.z) ? 1.0 : 0.0;
8365bd8deadSopenharmony_ci      result.w = (tmp0.w != tmp1.w) ? 1.0 : 0.0;
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci    Section 3.11.5.42,  STR:  Set on True
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci    The STR instruction is a degenerate case of the other "Set on"
8415bd8deadSopenharmony_ci    instructions that sets all components of the result vector to 1.0.
8425bd8deadSopenharmony_ci
8435bd8deadSopenharmony_ci      result.x = 1.0;
8445bd8deadSopenharmony_ci      result.y = 1.0;
8455bd8deadSopenharmony_ci      result.z = 1.0;
8465bd8deadSopenharmony_ci      result.w = 1.0;
8475bd8deadSopenharmony_ci
8485bd8deadSopenharmony_ci    Section 3.11.5.43,  UP2H:  Unpack Two 16-Bit Floats
8495bd8deadSopenharmony_ci
8505bd8deadSopenharmony_ci    The UP2H instruction unpacks two 16-bit floats stored together in
8515bd8deadSopenharmony_ci    a 32-bit scalar operand.  The first 16-bit float (stored in the 16
8525bd8deadSopenharmony_ci    least significant bits) is written into the "x" and "z" components
8535bd8deadSopenharmony_ci    of the result vector; the second is written into the "y" and "w"
8545bd8deadSopenharmony_ci    components of the result vector.
8555bd8deadSopenharmony_ci
8565bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
8575bd8deadSopenharmony_ci    the PK2H instruction.
8585bd8deadSopenharmony_ci
8595bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
8605bd8deadSopenharmony_ci      result.x = (fp16) (RawBits(tmp) & 0xFFFF);
8615bd8deadSopenharmony_ci      result.y = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
8625bd8deadSopenharmony_ci      result.z = (fp16) (RawBits(tmp) & 0xFFFF);
8635bd8deadSopenharmony_ci      result.w = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
8645bd8deadSopenharmony_ci    
8655bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a UP2H instruction
8665bd8deadSopenharmony_ci    whose operand is a variable declared as "SHORT".
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    Section 3.11.5.44,  UP2US:  Unpack Two Unsigned 16-Bit Scalars
8695bd8deadSopenharmony_ci
8705bd8deadSopenharmony_ci    The UP2US instruction unpacks two 16-bit unsigned values packed
8715bd8deadSopenharmony_ci    together in a 32-bit scalar operand.  The unsigned quantities are
8725bd8deadSopenharmony_ci    encoded where a bit pattern of all '0' bits corresponds to 0.0 and
8735bd8deadSopenharmony_ci    a pattern of all '1' bits corresponds to 1.0.  The "x" and "z"
8745bd8deadSopenharmony_ci    components of the result vector are obtained from the 16 least
8755bd8deadSopenharmony_ci    significant bits of the operand; the "y" and "w" components are
8765bd8deadSopenharmony_ci    obtained from the 16 most significant bits.
8775bd8deadSopenharmony_ci
8785bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
8795bd8deadSopenharmony_ci    the PK2US instruction.
8805bd8deadSopenharmony_ci
8815bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
8825bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
8835bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
8845bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
8855bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a UP2S instruction
8885bd8deadSopenharmony_ci    whose operand is a variable declared as "SHORT".
8895bd8deadSopenharmony_ci
8905bd8deadSopenharmony_ci    Section 3.11.5.45,  UP4B:  Unpack Four Signed 8-Bit Values
8915bd8deadSopenharmony_ci
8925bd8deadSopenharmony_ci    The UP4B instruction unpacks four 8-bit signed values packed together
8935bd8deadSopenharmony_ci    in a 32-bit scalar operand.  The signed quantities are encoded where
8945bd8deadSopenharmony_ci    a bit pattern of all '0' bits corresponds to -128/127 and a pattern
8955bd8deadSopenharmony_ci    of all '1' bits corresponds to +127/127.  The "x" component of the
8965bd8deadSopenharmony_ci    result vector is the converted value corresponding to the 8 least
8975bd8deadSopenharmony_ci    significant bits of the operand; the "w" component corresponds to
8985bd8deadSopenharmony_ci    the 8 most significant bits.
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
9015bd8deadSopenharmony_ci    the PK4B instruction.
9025bd8deadSopenharmony_ci
9035bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
9045bd8deadSopenharmony_ci      result.x = (((RawBits(tmp) >> 0) & 0xFF) - 128) / 127.0;
9055bd8deadSopenharmony_ci      result.y = (((RawBits(tmp) >> 8) & 0xFF) - 128) / 127.0;
9065bd8deadSopenharmony_ci      result.z = (((RawBits(tmp) >> 16) & 0xFF) - 128) / 127.0;
9075bd8deadSopenharmony_ci      result.w = (((RawBits(tmp) >> 24) & 0xFF) - 128) / 127.0;
9085bd8deadSopenharmony_ci
9095bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a UP4B instruction
9105bd8deadSopenharmony_ci    whose operand is a variable declared as "SHORT".
9115bd8deadSopenharmony_ci
9125bd8deadSopenharmony_ci    Section 3.11.5.46,  UP4UB:  Unpack Four Unsigned 8-Bit Scalars
9135bd8deadSopenharmony_ci
9145bd8deadSopenharmony_ci    The UP4UB instruction unpacks four 8-bit unsigned values packed
9155bd8deadSopenharmony_ci    together in a 32-bit scalar operand.  The unsigned quantities are
9165bd8deadSopenharmony_ci    encoded where a bit pattern of all '0' bits corresponds to 0.0 and a
9175bd8deadSopenharmony_ci    pattern of all '1' bits corresponds to 1.0.  The "x" component of the
9185bd8deadSopenharmony_ci    result vector is obtained from the 8 least significant bits of the
9195bd8deadSopenharmony_ci    operand; the "w" component is obtained from the 8 most significant
9205bd8deadSopenharmony_ci    bits.
9215bd8deadSopenharmony_ci
9225bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
9235bd8deadSopenharmony_ci    the PK4UB instruction.
9245bd8deadSopenharmony_ci
9255bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
9265bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFF) / 255.0;
9275bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 8)  & 0xFF) / 255.0;
9285bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 16) & 0xFF) / 255.0;
9295bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 24) & 0xFF) / 255.0;
9305bd8deadSopenharmony_ci
9315bd8deadSopenharmony_ci    A fragment program will fail to load if it contains a UP4UB
9325bd8deadSopenharmony_ci    instruction whose operand is a variable declared as "SHORT".
9335bd8deadSopenharmony_ci
9345bd8deadSopenharmony_ci    Section 3.11.5.47,  X2D:  2D Coordinate Transformation
9355bd8deadSopenharmony_ci
9365bd8deadSopenharmony_ci    The X2D instruction multiplies the 2D offset vector specified by the
9375bd8deadSopenharmony_ci    "x" and "y" components of the second vector operand by the 2x2 matrix
9385bd8deadSopenharmony_ci    specified by the four components of the third vector operand, and adds
9395bd8deadSopenharmony_ci    the transformed offset vector to the 2D vector specified by the "x"
9405bd8deadSopenharmony_ci    and "y" components of the first vector operand.  The first component
9415bd8deadSopenharmony_ci    of the sum is written to the "x" and "z" components of the result;
9425bd8deadSopenharmony_ci    the second component is written to the "y" and "w" components of
9435bd8deadSopenharmony_ci    the result.
9445bd8deadSopenharmony_ci
9455bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
9465bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
9475bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
9485bd8deadSopenharmony_ci      result.x = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
9495bd8deadSopenharmony_ci      result.y = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
9505bd8deadSopenharmony_ci      result.z = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
9515bd8deadSopenharmony_ci      result.w = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
9525bd8deadSopenharmony_ci
9535bd8deadSopenharmony_ci    Modify Section, 3.11.6.4 KIL: Kill fragment
9545bd8deadSopenharmony_ci
9555bd8deadSopenharmony_ci    Rather than mapping a coordinate set to a color, this function
9565bd8deadSopenharmony_ci    prevents a fragment from receiving any future processing.  If any
9575bd8deadSopenharmony_ci    component of its source vector is negative, the processing of this
9585bd8deadSopenharmony_ci    fragment will be discontinued and no further outputs to this fragment
9595bd8deadSopenharmony_ci    will occur.  Subsequent stages of the GL pipeline will be skipped
9605bd8deadSopenharmony_ci    for this fragment.
9615bd8deadSopenharmony_ci
9625bd8deadSopenharmony_ci    A KIL instruction may be specified using either a vector operand
9635bd8deadSopenharmony_ci    or a condition code test.  If a vector operand is specified, the
9645bd8deadSopenharmony_ci    following is performed:
9655bd8deadSopenharmony_ci
9665bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
9675bd8deadSopenharmony_ci      if ((tmp.x < 0) || (tmp.y < 0) || 
9685bd8deadSopenharmony_ci          (tmp.z < 0) || (tmp.w < 0))
9695bd8deadSopenharmony_ci      {
9705bd8deadSopenharmony_ci          exit;
9715bd8deadSopenharmony_ci      }
9725bd8deadSopenharmony_ci
9735bd8deadSopenharmony_ci    If a condition code is specified, the following is performed:
9745bd8deadSopenharmony_ci
9755bd8deadSopenharmony_ci      if (TestCC(rc.c***) || TestCC(rc.*c**) || 
9765bd8deadSopenharmony_ci          TestCC(rc.**c*) || TestCC(rc.***c)) 
9775bd8deadSopenharmony_ci      {
9785bd8deadSopenharmony_ci         exit;
9795bd8deadSopenharmony_ci      }
9805bd8deadSopenharmony_ci
9815bd8deadSopenharmony_ci
9825bd8deadSopenharmony_ci    Add Section 3.11.6.5, TXD: Texture Lookup with Derivatives
9835bd8deadSopenharmony_ci
9845bd8deadSopenharmony_ci    The TXD instruction takes the first three components of its first
9855bd8deadSopenharmony_ci    vector operand and maps them to s, t, and r.  These coordinates are
9865bd8deadSopenharmony_ci    used to sample from the specified texture target on the specified
9875bd8deadSopenharmony_ci    texture image unit in a manner consistent with its parameters.
9885bd8deadSopenharmony_ci
9895bd8deadSopenharmony_ci    The level of detail is computed as specified in section 3.8.
9905bd8deadSopenharmony_ci    In this calculation, ds/dx, dt/dx, and dr/dx are given by the x,
9915bd8deadSopenharmony_ci    y, and z components, respectively, of the second vector operand.
9925bd8deadSopenharmony_ci    ds/dy, dt/dy, and dr/dy are given by the x, y, and z components of
9935bd8deadSopenharmony_ci    the third vector operand.
9945bd8deadSopenharmony_ci    
9955bd8deadSopenharmony_ci    The resulting sample is mapped to RGBA as described in table 3.21
9965bd8deadSopenharmony_ci    and written to the result vector.
9975bd8deadSopenharmony_ci
9985bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
9995bd8deadSopenharmony_ci      result = TextureSample(tmp.x, tmp.y, tmp.z, 0.0, op1, op2);
10005bd8deadSopenharmony_ci
10015bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
10025bd8deadSopenharmony_ciOperations and the Frame Buffer)
10035bd8deadSopenharmony_ci
10045bd8deadSopenharmony_ci    None.
10055bd8deadSopenharmony_ci
10065bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special
10075bd8deadSopenharmony_ciFunctions)
10085bd8deadSopenharmony_ci
10095bd8deadSopenharmony_ci    None.
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
10125bd8deadSopenharmony_ciState Requests)
10135bd8deadSopenharmony_ci
10145bd8deadSopenharmony_ci    None.
10155bd8deadSopenharmony_ci
10165bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
10175bd8deadSopenharmony_ci
10185bd8deadSopenharmony_ci    None.
10195bd8deadSopenharmony_ci
10205bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
10215bd8deadSopenharmony_ci
10225bd8deadSopenharmony_ci    None.
10235bd8deadSopenharmony_ci
10245bd8deadSopenharmony_ciDependencies on ARB_fragment_program
10255bd8deadSopenharmony_ci
10265bd8deadSopenharmony_ci    This specification is based on a modified version of the grammar
10275bd8deadSopenharmony_ci    published in the ARB_fragment_program specification.  This modified
10285bd8deadSopenharmony_ci    grammar (see below) includes a few structural changes to better
10295bd8deadSopenharmony_ci    accommodate new functionality from this and other extensions,
10305bd8deadSopenharmony_ci    but should be functionally equivalent to the ARB_fragment_program
10315bd8deadSopenharmony_ci    grammar.
10325bd8deadSopenharmony_ci
10335bd8deadSopenharmony_ci    <program>               ::= <optionSequence> <statementSequence> "END"
10345bd8deadSopenharmony_ci
10355bd8deadSopenharmony_ci    <optionSequence>        ::= <optionSequence> <option>
10365bd8deadSopenharmony_ci                              | /* empty */
10375bd8deadSopenharmony_ci
10385bd8deadSopenharmony_ci    <option>                ::= "OPTION" <optionName> ";"
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    <optionName>            ::= "ARB_fog_exp"
10415bd8deadSopenharmony_ci                              | "ARB_fog_exp2"
10425bd8deadSopenharmony_ci                              | "ARB_fog_linear"
10435bd8deadSopenharmony_ci                              | "ARB_precision_hint_fastest"
10445bd8deadSopenharmony_ci                              | "ARB_precision_hint_nicest"
10455bd8deadSopenharmony_ci
10465bd8deadSopenharmony_ci    <statementSequence>     ::= <statement> <statementSequence>
10475bd8deadSopenharmony_ci                              | /* empty */
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    <statement>             ::= <instruction> ";"
10505bd8deadSopenharmony_ci                              | <namingStatement> ";"
10515bd8deadSopenharmony_ci
10525bd8deadSopenharmony_ci    <instruction>           ::= <ALUInstruction>
10535bd8deadSopenharmony_ci                              | <TexInstruction>
10545bd8deadSopenharmony_ci
10555bd8deadSopenharmony_ci    <ALUInstruction>        ::= <VECTORop_instruction>
10565bd8deadSopenharmony_ci                              | <SCALARop_instruction>
10575bd8deadSopenharmony_ci                              | <BINSCop_instruction>
10585bd8deadSopenharmony_ci                              | <BINop_instruction>
10595bd8deadSopenharmony_ci                              | <TRIop_instruction>
10605bd8deadSopenharmony_ci                              | <SWZop_instruction>
10615bd8deadSopenharmony_ci
10625bd8deadSopenharmony_ci    <TexInstruction>        ::= <TEXop_instruction>
10635bd8deadSopenharmony_ci                              | <KILop_instruction>
10645bd8deadSopenharmony_ci
10655bd8deadSopenharmony_ci    <VECTORop_instruction>  ::= <VECTORop> <instResult> "," <instOperandV>
10665bd8deadSopenharmony_ci
10675bd8deadSopenharmony_ci    <VECTORop>              ::= "ABS"
10685bd8deadSopenharmony_ci                              | "FLR"
10695bd8deadSopenharmony_ci                              | "FRC"
10705bd8deadSopenharmony_ci                              | "LIT"
10715bd8deadSopenharmony_ci                              | "MOV"
10725bd8deadSopenharmony_ci
10735bd8deadSopenharmony_ci    <SCALARop_instruction>  ::= <SCALARop> <instResult> "," <instOperandS>
10745bd8deadSopenharmony_ci
10755bd8deadSopenharmony_ci    <SCALARop>              ::= "COS"
10765bd8deadSopenharmony_ci                              | "EX2"
10775bd8deadSopenharmony_ci                              | "LG2"
10785bd8deadSopenharmony_ci                              | "RCP"
10795bd8deadSopenharmony_ci                              | "RSQ"
10805bd8deadSopenharmony_ci                              | "SCS"
10815bd8deadSopenharmony_ci                              | "SIN"
10825bd8deadSopenharmony_ci
10835bd8deadSopenharmony_ci    <BINSCop_instruction>   ::= <BINSCop> <instResult> "," <instOperandS> "," 
10845bd8deadSopenharmony_ci                                <instOperandS>
10855bd8deadSopenharmony_ci
10865bd8deadSopenharmony_ci    <BINSCop>               ::= "POW"
10875bd8deadSopenharmony_ci
10885bd8deadSopenharmony_ci    <BINop_instruction>     ::= <BINop> <instResult> "," <instOperandV> "," 
10895bd8deadSopenharmony_ci                                <instOperandV>
10905bd8deadSopenharmony_ci
10915bd8deadSopenharmony_ci    <BINop>                 ::= "ADD"
10925bd8deadSopenharmony_ci                              | "DP3"
10935bd8deadSopenharmony_ci                              | "DP4"
10945bd8deadSopenharmony_ci                              | "DPH"
10955bd8deadSopenharmony_ci                              | "DST"
10965bd8deadSopenharmony_ci                              | "MAX"
10975bd8deadSopenharmony_ci                              | "MIN"
10985bd8deadSopenharmony_ci                              | "MUL"
10995bd8deadSopenharmony_ci                              | "SGE"
11005bd8deadSopenharmony_ci                              | "SLT"
11015bd8deadSopenharmony_ci                              | "SUB"
11025bd8deadSopenharmony_ci                              | "XPD"
11035bd8deadSopenharmony_ci
11045bd8deadSopenharmony_ci    <TRIop_instruction>     ::= <TRIop> <instResult> "," <instOperandV> "," 
11055bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandV>
11065bd8deadSopenharmony_ci
11075bd8deadSopenharmony_ci    <TRIop>                 ::= "CMP"
11085bd8deadSopenharmony_ci                              | "MAD"
11095bd8deadSopenharmony_ci                              | "LRP"
11105bd8deadSopenharmony_ci
11115bd8deadSopenharmony_ci    <SWZop_instruction>     ::= <SWZop> <instResult> "," <instOperandVNS> "," 
11125bd8deadSopenharmony_ci                                <extendedSwizzle>
11135bd8deadSopenharmony_ci
11145bd8deadSopenharmony_ci    <SWZop>                 ::= "SWZ"
11155bd8deadSopenharmony_ci
11165bd8deadSopenharmony_ci    <TEXop_instruction>     ::= <TEXop> <instResult> "," <instOperandV> "," 
11175bd8deadSopenharmony_ci                                <texTarget>
11185bd8deadSopenharmony_ci
11195bd8deadSopenharmony_ci    <TEXop>                 ::= "TEX"
11205bd8deadSopenharmony_ci                              | "TXP"
11215bd8deadSopenharmony_ci                              | "TXB"
11225bd8deadSopenharmony_ci
11235bd8deadSopenharmony_ci    <KILop_instruction>     ::= <KILop> <killCond>
11245bd8deadSopenharmony_ci
11255bd8deadSopenharmony_ci    <KILop>                 ::= "KIL"
11265bd8deadSopenharmony_ci
11275bd8deadSopenharmony_ci    <texTarget>             ::= <texImageUnit> "," <texTargetType>
11285bd8deadSopenharmony_ci
11295bd8deadSopenharmony_ci    <texImageUnit>          ::= "texture" <optTexImageUnitNum>
11305bd8deadSopenharmony_ci
11315bd8deadSopenharmony_ci    <optTexImageUnitNum>    ::= /* empty */
11325bd8deadSopenharmony_ci                              | "[" <texImageUnitNum> "]"
11335bd8deadSopenharmony_ci
11345bd8deadSopenharmony_ci    <texImageUnitNum>       ::= <integer> 
11355bd8deadSopenharmony_ci                                /*[0,MAX_TEXTURE_IMAGE_UNITS_ARB-1]*/
11365bd8deadSopenharmony_ci
11375bd8deadSopenharmony_ci    <texTargetType>         ::= "1D"
11385bd8deadSopenharmony_ci                              | "2D"
11395bd8deadSopenharmony_ci                              | "3D"
11405bd8deadSopenharmony_ci                              | "CUBE"
11415bd8deadSopenharmony_ci                              | "RECT"
11425bd8deadSopenharmony_ci
11435bd8deadSopenharmony_ci    <killCond>              ::= <instOperandV>
11445bd8deadSopenharmony_ci
11455bd8deadSopenharmony_ci    <instOperandV>          ::= <instOperandBaseV>
11465bd8deadSopenharmony_ci
11475bd8deadSopenharmony_ci    <instOperandBaseV>      ::= <optSign> <attribUseV>
11485bd8deadSopenharmony_ci                              | <optSign> <tempUseV>
11495bd8deadSopenharmony_ci                              | <optSign> <paramUseV>
11505bd8deadSopenharmony_ci
11515bd8deadSopenharmony_ci    <instOperandS>          ::= <instOperandBaseS>
11525bd8deadSopenharmony_ci
11535bd8deadSopenharmony_ci    <instOperandBaseS>      ::= <optSign> <attribUseS>
11545bd8deadSopenharmony_ci                              | <optSign> <tempUseS>
11555bd8deadSopenharmony_ci                              | <optSign> <paramUseS>
11565bd8deadSopenharmony_ci
11575bd8deadSopenharmony_ci    <instOperandVNS>        ::= <attribUseVNS>
11585bd8deadSopenharmony_ci                              | <tempUseVNS>
11595bd8deadSopenharmony_ci                              | <paramUseVNS>
11605bd8deadSopenharmony_ci
11615bd8deadSopenharmony_ci    <instResult>            ::= <instResultBase>
11625bd8deadSopenharmony_ci
11635bd8deadSopenharmony_ci    <instResultBase>        ::= <tempUseW>
11645bd8deadSopenharmony_ci                              | <resultUseW>
11655bd8deadSopenharmony_ci
11665bd8deadSopenharmony_ci    <namingStatement>       ::= <ATTRIB_statement>
11675bd8deadSopenharmony_ci                              | <PARAM_statement>
11685bd8deadSopenharmony_ci                              | <TEMP_statement>
11695bd8deadSopenharmony_ci                              | <OUTPUT_statement>
11705bd8deadSopenharmony_ci                              | <ALIAS_statement>
11715bd8deadSopenharmony_ci
11725bd8deadSopenharmony_ci    <ATTRIB_statement>      ::= "ATTRIB" <establishName> "=" <attribUseD>
11735bd8deadSopenharmony_ci
11745bd8deadSopenharmony_ci    <PARAM_statement>       ::= <PARAM_singleStmt>
11755bd8deadSopenharmony_ci                              | <PARAM_multipleStmt>
11765bd8deadSopenharmony_ci
11775bd8deadSopenharmony_ci    <PARAM_singleStmt>      ::= "PARAM" <establishName> <paramSingleInit>
11785bd8deadSopenharmony_ci
11795bd8deadSopenharmony_ci    <PARAM_multipleStmt>    ::= "PARAM" <establishName> "[" <optArraySize> "]" 
11805bd8deadSopenharmony_ci                                <paramMultipleInit>
11815bd8deadSopenharmony_ci
11825bd8deadSopenharmony_ci    <optArraySize>          ::= /* empty */
11835bd8deadSopenharmony_ci                              | <integer> /* [1,MAX_PROGRAM_PARAMETERS_ARB]*/
11845bd8deadSopenharmony_ci
11855bd8deadSopenharmony_ci    <paramSingleInit>       ::= "=" <paramUseDB>
11865bd8deadSopenharmony_ci
11875bd8deadSopenharmony_ci    <paramMultipleInit>     ::= "=" "{" <paramMultInitList> "}"
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci    <paramMultInitList>     ::= <paramUseDM>
11905bd8deadSopenharmony_ci                              | <paramUseDM> "," <paramMultInitList>
11915bd8deadSopenharmony_ci
11925bd8deadSopenharmony_ci    <TEMP_statement>        ::= "TEMP" <varNameList>
11935bd8deadSopenharmony_ci
11945bd8deadSopenharmony_ci    <OUTPUT_statement>      ::= "OUTPUT" <establishName> "=" <resultUseD>
11955bd8deadSopenharmony_ci
11965bd8deadSopenharmony_ci    <ALIAS_statement>       ::= "ALIAS" <establishName> "=" <establishedName>
11975bd8deadSopenharmony_ci
11985bd8deadSopenharmony_ci    <establishedName>       ::= <tempVarName>
11995bd8deadSopenharmony_ci                              | <addrVarName>
12005bd8deadSopenharmony_ci                              | <attribVarName>
12015bd8deadSopenharmony_ci                              | <paramArrayVarName>
12025bd8deadSopenharmony_ci                              | <paramSingleVarName>
12035bd8deadSopenharmony_ci                              | <resultVarName>
12045bd8deadSopenharmony_ci
12055bd8deadSopenharmony_ci    <varNameList>           ::= <establishName>
12065bd8deadSopenharmony_ci                              | <establishName> "," <varNameList>
12075bd8deadSopenharmony_ci
12085bd8deadSopenharmony_ci    <establishName>         ::= <identifier>
12095bd8deadSopenharmony_ci
12105bd8deadSopenharmony_ci    <attribUseV>            ::= <attribBasic> <swizzleSuffix>
12115bd8deadSopenharmony_ci                              | <attribVarName> <swizzleSuffix>
12125bd8deadSopenharmony_ci                              | <attribColor> <swizzleSuffix>
12135bd8deadSopenharmony_ci                              | <attribColor> "." <colorType> <swizzleSuffix>
12145bd8deadSopenharmony_ci
12155bd8deadSopenharmony_ci    <attribUseS>            ::= <attribBasic> <scalarSuffix>
12165bd8deadSopenharmony_ci                              | <attribVarName> <scalarSuffix>
12175bd8deadSopenharmony_ci                              | <attribColor> <scalarSuffix>
12185bd8deadSopenharmony_ci                              | <attribColor> "." <colorType> <scalarSuffix>
12195bd8deadSopenharmony_ci
12205bd8deadSopenharmony_ci    <attribUseVNS>          ::= <attribBasic>
12215bd8deadSopenharmony_ci                              | <attribVarName>
12225bd8deadSopenharmony_ci                              | <attribColor>
12235bd8deadSopenharmony_ci                              | <attribColor> "." <colorType>
12245bd8deadSopenharmony_ci
12255bd8deadSopenharmony_ci    <attribUseD>            ::= <attribBasic>
12265bd8deadSopenharmony_ci                              | <attribColor>
12275bd8deadSopenharmony_ci                              | <attribColor> "." <colorType>
12285bd8deadSopenharmony_ci
12295bd8deadSopenharmony_ci    <attribBasic>           ::= "fragment" "." <attribFragBasic>
12305bd8deadSopenharmony_ci
12315bd8deadSopenharmony_ci    <attribFragBasic>       ::= "texcoord" <optTexCoordNum>
12325bd8deadSopenharmony_ci                              | "fogcoord"
12335bd8deadSopenharmony_ci                              | "position"
12345bd8deadSopenharmony_ci
12355bd8deadSopenharmony_ci    <attribColor>           ::= "fragment" "." "color"
12365bd8deadSopenharmony_ci
12375bd8deadSopenharmony_ci    <paramUseV>             ::= <paramSingleVarName> <swizzleSuffix>
12385bd8deadSopenharmony_ci                              | <paramArrayVarName> "[" <arrayMem> "]" 
12395bd8deadSopenharmony_ci                                <swizzleSuffix>
12405bd8deadSopenharmony_ci                              | <stateSingleItem> <swizzleSuffix>
12415bd8deadSopenharmony_ci                              | <programSingleItem> <swizzleSuffix>
12425bd8deadSopenharmony_ci                              | <constantVector> <swizzleSuffix>
12435bd8deadSopenharmony_ci                              | <constantScalar> <swizzleSuffix>
12445bd8deadSopenharmony_ci
12455bd8deadSopenharmony_ci    <paramUseS>             ::= <paramSingleVarName> <scalarSuffix>
12465bd8deadSopenharmony_ci                              | <paramArrayVarName> "[" <arrayMem> "]" 
12475bd8deadSopenharmony_ci                                <scalarSuffix>
12485bd8deadSopenharmony_ci                              | <stateSingleItem> <scalarSuffix>
12495bd8deadSopenharmony_ci                              | <programSingleItem> <scalarSuffix>
12505bd8deadSopenharmony_ci                              | <constantVector> <scalarSuffix>
12515bd8deadSopenharmony_ci                              | <constantScalar> <scalarSuffix>
12525bd8deadSopenharmony_ci
12535bd8deadSopenharmony_ci    <paramUseVNS>           ::= <paramSingleVarName>
12545bd8deadSopenharmony_ci                              | <paramArrayVarName> "[" <arrayMem> "]"
12555bd8deadSopenharmony_ci                              | <stateSingleItem>
12565bd8deadSopenharmony_ci                              | <programSingleItem>
12575bd8deadSopenharmony_ci                              | <constantVector>
12585bd8deadSopenharmony_ci                              | <constantScalar>
12595bd8deadSopenharmony_ci
12605bd8deadSopenharmony_ci    <paramUseDB>            ::= <stateSingleItem>
12615bd8deadSopenharmony_ci                              | <programSingleItem>
12625bd8deadSopenharmony_ci                              | <constantVector>
12635bd8deadSopenharmony_ci                              | <signedConstantScalar>
12645bd8deadSopenharmony_ci
12655bd8deadSopenharmony_ci    <paramUseDM>            ::= <stateMultipleItem>
12665bd8deadSopenharmony_ci                              | <programMultipleItem>
12675bd8deadSopenharmony_ci                              | <constantVector>
12685bd8deadSopenharmony_ci                              | <signedConstantScalar>
12695bd8deadSopenharmony_ci
12705bd8deadSopenharmony_ci    <stateMultipleItem>     ::= <stateSingleItem>
12715bd8deadSopenharmony_ci                              | "state" "." <stateMatrixRows>
12725bd8deadSopenharmony_ci
12735bd8deadSopenharmony_ci    <stateSingleItem>       ::= "state" "." <stateMaterialItem>
12745bd8deadSopenharmony_ci                              | "state" "." <stateLightItem>
12755bd8deadSopenharmony_ci                              | "state" "." <stateLightModelItem>
12765bd8deadSopenharmony_ci                              | "state" "." <stateLightProdItem>
12775bd8deadSopenharmony_ci                              | "state" "." <stateFogItem>
12785bd8deadSopenharmony_ci                              | "state" "." <stateMatrixRow>
12795bd8deadSopenharmony_ci                              | "state" "." <stateTexEnvItem>
12805bd8deadSopenharmony_ci                              | "state" "." <stateDepthItem>
12815bd8deadSopenharmony_ci
12825bd8deadSopenharmony_ci    <stateMaterialItem>     ::= "material" "." <stateMatProperty>
12835bd8deadSopenharmony_ci                              | "material" "." <faceType> "." 
12845bd8deadSopenharmony_ci                                <stateMatProperty>
12855bd8deadSopenharmony_ci
12865bd8deadSopenharmony_ci    <stateMatProperty>      ::= "ambient"
12875bd8deadSopenharmony_ci                              | "diffuse"
12885bd8deadSopenharmony_ci                              | "specular"
12895bd8deadSopenharmony_ci                              | "emission"
12905bd8deadSopenharmony_ci                              | "shininess"
12915bd8deadSopenharmony_ci
12925bd8deadSopenharmony_ci    <stateLightItem>        ::= "light" "[" <stateLightNumber> "]" "." 
12935bd8deadSopenharmony_ci                                <stateLightProperty>
12945bd8deadSopenharmony_ci
12955bd8deadSopenharmony_ci    <stateLightProperty>    ::= "ambient"
12965bd8deadSopenharmony_ci                              | "diffuse"
12975bd8deadSopenharmony_ci                              | "specular"
12985bd8deadSopenharmony_ci                              | "position"
12995bd8deadSopenharmony_ci                              | "attenuation"
13005bd8deadSopenharmony_ci                              | "spot" "." <stateSpotProperty>
13015bd8deadSopenharmony_ci                              | "half"
13025bd8deadSopenharmony_ci
13035bd8deadSopenharmony_ci    <stateSpotProperty>     ::= "direction"
13045bd8deadSopenharmony_ci
13055bd8deadSopenharmony_ci    <stateLightModelItem>   ::= "lightmodel" <stateLModProperty>
13065bd8deadSopenharmony_ci
13075bd8deadSopenharmony_ci    <stateLModProperty>     ::= "." "ambient"
13085bd8deadSopenharmony_ci                              | "." "scenecolor"
13095bd8deadSopenharmony_ci                              | "." <faceType> "." "scenecolor"
13105bd8deadSopenharmony_ci
13115bd8deadSopenharmony_ci    <stateLightProdItem>    ::= "lightprod" "[" <stateLightNumber> "]" "." 
13125bd8deadSopenharmony_ci                                <stateLProdProperty>
13135bd8deadSopenharmony_ci                              | "lightprod" "[" <stateLightNumber> "]" "." 
13145bd8deadSopenharmony_ci                                <faceType> "." <stateLProdProperty>
13155bd8deadSopenharmony_ci
13165bd8deadSopenharmony_ci    <stateLProdProperty>    ::= "ambient"
13175bd8deadSopenharmony_ci                              | "diffuse"
13185bd8deadSopenharmony_ci                              | "specular"
13195bd8deadSopenharmony_ci
13205bd8deadSopenharmony_ci    <stateLightNumber>      ::= <integer> /* [0,MAX_LIGHTS-1] */
13215bd8deadSopenharmony_ci
13225bd8deadSopenharmony_ci    <stateFogItem>          ::= "fog" "." <stateFogProperty>
13235bd8deadSopenharmony_ci
13245bd8deadSopenharmony_ci    <stateFogProperty>      ::= "color"
13255bd8deadSopenharmony_ci                              | "params"
13265bd8deadSopenharmony_ci
13275bd8deadSopenharmony_ci    <stateMatrixRows>       ::= <stateMatrixItem>
13285bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier>
13295bd8deadSopenharmony_ci                              | <stateMatrixItem> "." "row" "[" 
13305bd8deadSopenharmony_ci                                <stateMatrixRowNum> ".." <stateMatrixRowNum> 
13315bd8deadSopenharmony_ci                                "]"
13325bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier> "." 
13335bd8deadSopenharmony_ci                                "row" "[" <stateMatrixRowNum> ".." 
13345bd8deadSopenharmony_ci                                <stateMatrixRowNum> "]"
13355bd8deadSopenharmony_ci
13365bd8deadSopenharmony_ci    <stateMatrixRow>        ::= <stateMatrixItem> "." "row" "[" 
13375bd8deadSopenharmony_ci                                <stateMatrixRowNum> "]"
13385bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier> "." 
13395bd8deadSopenharmony_ci                                "row" "[" <stateMatrixRowNum> "]"
13405bd8deadSopenharmony_ci
13415bd8deadSopenharmony_ci    <stateMatrixItem>       ::= "matrix" "." <stateMatrixName>
13425bd8deadSopenharmony_ci
13435bd8deadSopenharmony_ci    <stateMatModifier>      ::= "inverse"
13445bd8deadSopenharmony_ci                              | "transpose"
13455bd8deadSopenharmony_ci                              | "invtrans"
13465bd8deadSopenharmony_ci
13475bd8deadSopenharmony_ci    <stateMatrixName>       ::= "modelview" <stateOptModMatNum>
13485bd8deadSopenharmony_ci                              | "projection"
13495bd8deadSopenharmony_ci                              | "mvp"
13505bd8deadSopenharmony_ci                              | "texture" <optTexCoordNum>
13515bd8deadSopenharmony_ci                              | "palette" "[" <statePaletteMatNum> "]"
13525bd8deadSopenharmony_ci                              | "program" "[" <stateProgramMatNum> "]"
13535bd8deadSopenharmony_ci
13545bd8deadSopenharmony_ci    <stateMatrixRowNum>     ::= <integer> /* [0,3] */
13555bd8deadSopenharmony_ci
13565bd8deadSopenharmony_ci    <stateOptModMatNum>     ::= /* empty */
13575bd8deadSopenharmony_ci                              | "[" <stateModMatNum> "]"
13585bd8deadSopenharmony_ci
13595bd8deadSopenharmony_ci    <stateModMatNum>        ::= <integer> /*[0,MAX_VERTEX_UNITS_ARB-1]*/
13605bd8deadSopenharmony_ci
13615bd8deadSopenharmony_ci    <statePaletteMatNum>    ::= <integer> /*[0,MAX_PALETTE_MATRICES_ARB-1]*/
13625bd8deadSopenharmony_ci
13635bd8deadSopenharmony_ci    <stateProgramMatNum>    ::= <integer> /*[0,MAX_PROGRAM_MATRICES_ARB-1]*/
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci    <stateTexEnvItem>       ::= "texenv" <optLegacyTexUnitNum> "." 
13665bd8deadSopenharmony_ci                                <stateTexEnvProperty>
13675bd8deadSopenharmony_ci
13685bd8deadSopenharmony_ci    <stateTexEnvProperty>   ::= "color"
13695bd8deadSopenharmony_ci
13705bd8deadSopenharmony_ci    <stateDepthItem>        ::= "depth" "." <stateDepthProperty>
13715bd8deadSopenharmony_ci
13725bd8deadSopenharmony_ci    <stateDepthProperty>    ::= "range"
13735bd8deadSopenharmony_ci
13745bd8deadSopenharmony_ci    <programSingleItem>     ::= <progEnvParam>
13755bd8deadSopenharmony_ci                              | <progLocalParam>
13765bd8deadSopenharmony_ci
13775bd8deadSopenharmony_ci    <programMultipleItem>   ::= <progEnvParams>
13785bd8deadSopenharmony_ci                              | <progLocalParams>
13795bd8deadSopenharmony_ci
13805bd8deadSopenharmony_ci    <progEnvParams>         ::= "program" "." "env" "[" <progEnvParamNums> "]"
13815bd8deadSopenharmony_ci
13825bd8deadSopenharmony_ci    <progEnvParamNums>      ::= <progEnvParamNum>
13835bd8deadSopenharmony_ci                              | <progEnvParamNum> ".." <progEnvParamNum>
13845bd8deadSopenharmony_ci
13855bd8deadSopenharmony_ci    <progEnvParam>          ::= "program" "." "env" "[" <progEnvParamNum> "]"
13865bd8deadSopenharmony_ci
13875bd8deadSopenharmony_ci    <progLocalParams>       ::= "program" "." "local" "[" <progLocalParamNums> 
13885bd8deadSopenharmony_ci                                "]"
13895bd8deadSopenharmony_ci
13905bd8deadSopenharmony_ci    <progLocalParamNums>    ::= <progLocalParamNum>
13915bd8deadSopenharmony_ci                              | <progLocalParamNum> ".." <progLocalParamNum>
13925bd8deadSopenharmony_ci
13935bd8deadSopenharmony_ci    <progLocalParam>        ::= "program" "." "local" "[" <progLocalParamNum> 
13945bd8deadSopenharmony_ci                                "]"
13955bd8deadSopenharmony_ci
13965bd8deadSopenharmony_ci    <progEnvParamNum>       ::= <integer> 
13975bd8deadSopenharmony_ci                                /*[0,MAX_PROGRAM_ENV_PARAMETERS_ARB-1]*/
13985bd8deadSopenharmony_ci
13995bd8deadSopenharmony_ci    <progLocalParamNum>     ::= <integer> 
14005bd8deadSopenharmony_ci                                /*[0,MAX_PROGRAM_LOCAL_PARAMETERS_ARB-1]*/
14015bd8deadSopenharmony_ci
14025bd8deadSopenharmony_ci    <constantVector>        ::= "{" <constantVectorList> "}"
14035bd8deadSopenharmony_ci
14045bd8deadSopenharmony_ci    <constantVectorList>    ::= <signedConstantScalar>
14055bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
14065bd8deadSopenharmony_ci                                <signedConstantScalar>
14075bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
14085bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
14095bd8deadSopenharmony_ci                                <signedConstantScalar>
14105bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
14115bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
14125bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
14135bd8deadSopenharmony_ci                                <signedConstantScalar>
14145bd8deadSopenharmony_ci
14155bd8deadSopenharmony_ci    <signedConstantScalar>  ::= <optSign> <constantScalar>
14165bd8deadSopenharmony_ci
14175bd8deadSopenharmony_ci    <constantScalar>        ::= <floatConstant>
14185bd8deadSopenharmony_ci
14195bd8deadSopenharmony_ci    <floatConstant>         ::= <float>
14205bd8deadSopenharmony_ci
14215bd8deadSopenharmony_ci    <tempUseV>              ::= <tempVarName> <swizzleSuffix>
14225bd8deadSopenharmony_ci
14235bd8deadSopenharmony_ci    <tempUseS>              ::= <tempVarName> <scalarSuffix>
14245bd8deadSopenharmony_ci
14255bd8deadSopenharmony_ci    <tempUseVNS>            ::= <tempVarName>
14265bd8deadSopenharmony_ci
14275bd8deadSopenharmony_ci    <tempUseW>              ::= <tempVarName> <optWriteMask>
14285bd8deadSopenharmony_ci
14295bd8deadSopenharmony_ci    <resultUseW>            ::= <resultBasic> <optWriteMask>
14305bd8deadSopenharmony_ci                              | <resultVarName> <optWriteMask>
14315bd8deadSopenharmony_ci
14325bd8deadSopenharmony_ci    <resultUseD>            ::= <resultBasic>
14335bd8deadSopenharmony_ci
14345bd8deadSopenharmony_ci    <resultBasic>           ::= "result" "." <resultFragBasic>
14355bd8deadSopenharmony_ci
14365bd8deadSopenharmony_ci    <resultFragBasic>       ::= "color" <resultOptColorNum>
14375bd8deadSopenharmony_ci                              | "depth"
14385bd8deadSopenharmony_ci
14395bd8deadSopenharmony_ci    <resultOptColorNum>     ::= /* empty */
14405bd8deadSopenharmony_ci
14415bd8deadSopenharmony_ci    <arrayMem>              ::= <arrayMemAbs>
14425bd8deadSopenharmony_ci
14435bd8deadSopenharmony_ci    <arrayMemAbs>           ::= <integer>
14445bd8deadSopenharmony_ci
14455bd8deadSopenharmony_ci    <optWriteMask>          ::= /* empty */
14465bd8deadSopenharmony_ci                              | <xyzwMask>
14475bd8deadSopenharmony_ci                              | <rgbaMask>
14485bd8deadSopenharmony_ci
14495bd8deadSopenharmony_ci    <xyzwMask>              ::= "." "x"
14505bd8deadSopenharmony_ci                              | "." "y"
14515bd8deadSopenharmony_ci                              | "." "xy"
14525bd8deadSopenharmony_ci                              | "." "z"
14535bd8deadSopenharmony_ci                              | "." "xz"
14545bd8deadSopenharmony_ci                              | "." "yz"
14555bd8deadSopenharmony_ci                              | "." "xyz"
14565bd8deadSopenharmony_ci                              | "." "w"
14575bd8deadSopenharmony_ci                              | "." "xw"
14585bd8deadSopenharmony_ci                              | "." "yw"
14595bd8deadSopenharmony_ci                              | "." "xyw"
14605bd8deadSopenharmony_ci                              | "." "zw"
14615bd8deadSopenharmony_ci                              | "." "xzw"
14625bd8deadSopenharmony_ci                              | "." "yzw"
14635bd8deadSopenharmony_ci                              | "." "xyzw"
14645bd8deadSopenharmony_ci
14655bd8deadSopenharmony_ci    <rgbaMask>              ::= "." "r"
14665bd8deadSopenharmony_ci                              | "." "g"
14675bd8deadSopenharmony_ci                              | "." "rg"
14685bd8deadSopenharmony_ci                              | "." "b"
14695bd8deadSopenharmony_ci                              | "." "rb"
14705bd8deadSopenharmony_ci                              | "." "gb"
14715bd8deadSopenharmony_ci                              | "." "rgb"
14725bd8deadSopenharmony_ci                              | "." "a"
14735bd8deadSopenharmony_ci                              | "." "ra"
14745bd8deadSopenharmony_ci                              | "." "ga"
14755bd8deadSopenharmony_ci                              | "." "rga"
14765bd8deadSopenharmony_ci                              | "." "ba"
14775bd8deadSopenharmony_ci                              | "." "rba"
14785bd8deadSopenharmony_ci                              | "." "gba"
14795bd8deadSopenharmony_ci                              | "." "rgba"
14805bd8deadSopenharmony_ci
14815bd8deadSopenharmony_ci    <swizzleSuffix>         ::= /* empty */
14825bd8deadSopenharmony_ci                              | "." <component>
14835bd8deadSopenharmony_ci                              | "." <xyzwComponent> <xyzwComponent> 
14845bd8deadSopenharmony_ci                                <xyzwComponent> <xyzwComponent>
14855bd8deadSopenharmony_ci                              | "." <rgbaComponent> <rgbaComponent> 
14865bd8deadSopenharmony_ci                                <rgbaComponent> <rgbaComponent>
14875bd8deadSopenharmony_ci
14885bd8deadSopenharmony_ci    <extendedSwizzle>       ::= <extSwizComp> "," <extSwizComp> "," 
14895bd8deadSopenharmony_ci                                <extSwizComp> "," <extSwizComp>
14905bd8deadSopenharmony_ci
14915bd8deadSopenharmony_ci    <extSwizComp>           ::= <optSign> <xyzwExtSwizSel>
14925bd8deadSopenharmony_ci                              | <optSign> <rgbaExtSwizSel>
14935bd8deadSopenharmony_ci
14945bd8deadSopenharmony_ci    <xyzwExtSwizSel>        ::= "0"
14955bd8deadSopenharmony_ci                              | "1"
14965bd8deadSopenharmony_ci                              | <xyzwComponent>
14975bd8deadSopenharmony_ci
14985bd8deadSopenharmony_ci    <rgbaExtSwizSel>        ::= <rgbaComponent>
14995bd8deadSopenharmony_ci
15005bd8deadSopenharmony_ci    <scalarSuffix>          ::= "." <component>
15015bd8deadSopenharmony_ci
15025bd8deadSopenharmony_ci    <component>             ::= <xyzwComponent>
15035bd8deadSopenharmony_ci                              | <rgbaComponent>
15045bd8deadSopenharmony_ci
15055bd8deadSopenharmony_ci    <xyzwComponent>         ::= "x"
15065bd8deadSopenharmony_ci                              | "y"
15075bd8deadSopenharmony_ci                              | "z"
15085bd8deadSopenharmony_ci                              | "w"
15095bd8deadSopenharmony_ci
15105bd8deadSopenharmony_ci    <rgbaComponent>         ::= "r"
15115bd8deadSopenharmony_ci                              | "g"
15125bd8deadSopenharmony_ci                              | "b"
15135bd8deadSopenharmony_ci                              | "a"
15145bd8deadSopenharmony_ci
15155bd8deadSopenharmony_ci    <optSign>               ::= /* empty */
15165bd8deadSopenharmony_ci                              | "-"
15175bd8deadSopenharmony_ci                              | "+"
15185bd8deadSopenharmony_ci
15195bd8deadSopenharmony_ci    <faceType>              ::= "front"
15205bd8deadSopenharmony_ci                              | "back"
15215bd8deadSopenharmony_ci
15225bd8deadSopenharmony_ci    <colorType>             ::= "primary"
15235bd8deadSopenharmony_ci                              | "secondary"
15245bd8deadSopenharmony_ci
15255bd8deadSopenharmony_ci    <optTexCoordNum>        ::= /* empty */
15265bd8deadSopenharmony_ci                              | "[" <texCoordNum> "]"
15275bd8deadSopenharmony_ci
15285bd8deadSopenharmony_ci    <texCoordNum>           ::= <integer> /*[0,MAX_TEXTURE_COORDS_ARB-1]*/
15295bd8deadSopenharmony_ci
15305bd8deadSopenharmony_ci    <optLegacyTexUnitNum>   ::= /* empty */
15315bd8deadSopenharmony_ci                              | "[" <legacyTexUnitNum> "]"
15325bd8deadSopenharmony_ci
15335bd8deadSopenharmony_ci    <legacyTexUnitNum>      ::= <integer> /*[0,MAX_TEXTURE_UNITS-1]*/
15345bd8deadSopenharmony_ci
15355bd8deadSopenharmony_ci    The <integer>, <float>, and <identifier> grammar rules match
15365bd8deadSopenharmony_ci    integer constants, floating point constants, and identifier names
15375bd8deadSopenharmony_ci    as described in the ARB_vertex_program specification.  The <float>
15385bd8deadSopenharmony_ci    grammar rule here is identical to the <floatConstant> grammar rule
15395bd8deadSopenharmony_ci    in ARB_vertex_program.
15405bd8deadSopenharmony_ci
15415bd8deadSopenharmony_ci    The grammar rules <tempVarName>, <addrVarName>, <attribVarName>,
15425bd8deadSopenharmony_ci    <paramArrayVarName>, <paramSingleVarName>, <resultVarName> refer
15435bd8deadSopenharmony_ci    to the names of temporary, address register, attribute, program
15445bd8deadSopenharmony_ci    parameter array, program parameter, and result variables declared
15455bd8deadSopenharmony_ci    in the program text.
15465bd8deadSopenharmony_ci
15475bd8deadSopenharmony_ciGLX Protocol
15485bd8deadSopenharmony_ci
15495bd8deadSopenharmony_ci    None.
15505bd8deadSopenharmony_ci
15515bd8deadSopenharmony_ciErrors
15525bd8deadSopenharmony_ci
15535bd8deadSopenharmony_ci    None.
15545bd8deadSopenharmony_ci
15555bd8deadSopenharmony_ciNew State
15565bd8deadSopenharmony_ci
15575bd8deadSopenharmony_ci    None.
15585bd8deadSopenharmony_ci
15595bd8deadSopenharmony_ciRevision History
15605bd8deadSopenharmony_ci
15615bd8deadSopenharmony_ci    Rev.  Date      Author   Changes
15625bd8deadSopenharmony_ci    ----  --------  -------  --------------------------------------------
15635bd8deadSopenharmony_ci    4     05/27/05  pbrown   Removed required NV_fragment_program dependency;
15645bd8deadSopenharmony_ci                             that extension actually isn't needed although the
15655bd8deadSopenharmony_ci                             functionality it provides obviously is.
15665bd8deadSopenharmony_ci
15675bd8deadSopenharmony_ci    3     07/08/04  pbrown   Fixed entries for KIL and RFL in the opcode
15685bd8deadSopenharmony_ci                             table.
15695bd8deadSopenharmony_ci
15705bd8deadSopenharmony_ci    2     05/16/04  pbrown   Documented terminals in modified fragment program
15715bd8deadSopenharmony_ci                             grammar. 
15725bd8deadSopenharmony_ci
15735bd8deadSopenharmony_ci    1     --------  pbrown   Internal pre-release revisions.
1574