15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci    
35bd8deadSopenharmony_ci    NV_fragment_program
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_fragment_program
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci    Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciNotice
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Copyright NVIDIA Corporation, 2001-2002.
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciIP Status
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    NVIDIA Proprietary.
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciStatus
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Implemented in CineFX (NV30) Emulation driver, August 2002.
255bd8deadSopenharmony_ci    Shipping in Release 40 NVIDIA driver for CineFX hardware, January 2003.
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciVersion
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    Last Modified Date:  2005/05/24
305bd8deadSopenharmony_ci    NVIDIA Revision:     73
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciNumber
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    282
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciDependencies
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.2.1 specification and
395bd8deadSopenharmony_ci    requires OpenGL 1.2.1.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Requires support for the ARB_multitexture extension with at least
425bd8deadSopenharmony_ci    two texture units.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    NV_vertex_program affects the definition of this extension.  The only
455bd8deadSopenharmony_ci    dependency is that both extensions use the same mechanisms for defining
465bd8deadSopenharmony_ci    and binding programs.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    NV_texture_shader trivially affects the definition of this extension.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    NV_texture_rectangle trivially affects the definition of this extension.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    ARB_texture_cube_map trivially affects the definition of this extension.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    EXT_fog_coord trivially affects the definition of this extension.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    NV_depth_clamp affects the definition of this extension.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    ARB_depth_texture and SGIX_depth_texture affect the definition of this
595bd8deadSopenharmony_ci    extension.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    NV_float_buffer affects the definition of this extension.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    ARB_vertex_program affects the definition of this extension.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    ARB_fragment_program affects the definition of this extension.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ciOverview
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    OpenGL mandates a certain set of configurable per-fragment computations
705bd8deadSopenharmony_ci    defining texture lookup, texture environment, color sum, and fog
715bd8deadSopenharmony_ci    operations.  Each of these areas provide a useful but limited set of fixed
725bd8deadSopenharmony_ci    operations.  For example, unextended OpenGL 1.2.1 provides only four
735bd8deadSopenharmony_ci    texture environment modes, color sum, and three fog modes.  Many OpenGL
745bd8deadSopenharmony_ci    extensions have either improved existing functionality or introduced new
755bd8deadSopenharmony_ci    configurable fragment operations.  While these extensions have enabled new
765bd8deadSopenharmony_ci    and interesting rendering effects, the set of effects is limited by the
775bd8deadSopenharmony_ci    set of special modes introduced by the extension.  This lack of
785bd8deadSopenharmony_ci    flexibility is in contrast to the high-level of programmability of
795bd8deadSopenharmony_ci    general-purpose CPUs and other (frequently software-based) shading
805bd8deadSopenharmony_ci    languages.  The purpose of this extension is to expose to the OpenGL
815bd8deadSopenharmony_ci    application writer an unprecedented degree of programmability in the
825bd8deadSopenharmony_ci    computation of final fragment colors and depth values.
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    This extension provides a mechanism for defining fragment program
855bd8deadSopenharmony_ci    instruction sequences for application-defined fragment programs.  When in
865bd8deadSopenharmony_ci    fragment program mode, a program is executed each time a fragment is
875bd8deadSopenharmony_ci    produced by rasterization.  The inputs for the program are the attributes
885bd8deadSopenharmony_ci    (position, colors, texture coordinates) associated with the fragment and a
895bd8deadSopenharmony_ci    set of constant registers.  A fragment program can perform mathematical
905bd8deadSopenharmony_ci    computations and texture lookups using arbitrary texture coordinates.  The
915bd8deadSopenharmony_ci    results of a fragment program are new color and depth values for the
925bd8deadSopenharmony_ci    fragment.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    This extension defines a programming model including a 4-component vector
955bd8deadSopenharmony_ci    instruction set, 16- and 32-bit floating-point data types, and a
965bd8deadSopenharmony_ci    relatively large set of temporary registers.  The programming model also
975bd8deadSopenharmony_ci    includes a condition code vector which can be used to mask register writes
985bd8deadSopenharmony_ci    at run-time or kill fragments altogether.  The syntax, program
995bd8deadSopenharmony_ci    instructions, and general semantics are similar to those in the
1005bd8deadSopenharmony_ci    NV_vertex_program and NV_vertex_program2 extensions, which provide for the
1015bd8deadSopenharmony_ci    execution of an arbitrary program each time the GL receives a vertex.
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    The fragment program execution environment is designed for efficient
1045bd8deadSopenharmony_ci    hardware implementation and to support a wide variety of programs.  By
1055bd8deadSopenharmony_ci    design, the entire set of existing fragment programs defined by existing
1065bd8deadSopenharmony_ci    OpenGL per-fragment computation extensions can be implemented using the
1075bd8deadSopenharmony_ci    extension's programming model.
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    The fragment program execution environment accesses textures via
1105bd8deadSopenharmony_ci    arbitrarily computed texture coordinates.  As such, there is no necessary
1115bd8deadSopenharmony_ci    correspondence between the texture coordinates and texture maps previously
1125bd8deadSopenharmony_ci    lumped into a single "texture unit".  This extension separates the notion
1135bd8deadSopenharmony_ci    of "texture coordinate sets" and "texture image units" (texture maps and
1145bd8deadSopenharmony_ci    associated parameters), allowing implementations with a different number
1155bd8deadSopenharmony_ci    of each.  The initial implementation of this extension will support 8
1165bd8deadSopenharmony_ci    texture coordinate sets and 16 texture image units.
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ciIssues
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    What limitations exist in this extension?
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci        RESOLVED:  Very few.  Programs can not exceed a maximum program length
1235bd8deadSopenharmony_ci        (which is no less than 1024 instructions), and can use no more than
1245bd8deadSopenharmony_ci        32-64 temporary registers.  Programs can not access more than one
1255bd8deadSopenharmony_ci        fragment attribute or program parameter (constant) per instruction,
1265bd8deadSopenharmony_ci        but can work around this restriction using temporaries.  The number of
1275bd8deadSopenharmony_ci        textures that can be used by a program is limited to the number of
1285bd8deadSopenharmony_ci        texture image units provided by the implementation (16 in the initial
1295bd8deadSopenharmony_ci        implementation of this extension).
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci        These limits are fairly high.  Additionally, there is no limit on the
1325bd8deadSopenharmony_ci        total number of texture lookups that can be performed by a program.
1335bd8deadSopenharmony_ci        There is no limit on the length of a texture dependency chain -- one
1345bd8deadSopenharmony_ci        can write a program that performs over 1000 consecutive dependent
1355bd8deadSopenharmony_ci        texture lookups.  There is no restrictions on dependencies between
1365bd8deadSopenharmony_ci        texture mapping instructions and arithmetic instructions.  Texture
1375bd8deadSopenharmony_ci        lookups can be performed using arbitrarily computed texture
1385bd8deadSopenharmony_ci        coordinates.  Applications can carry out their calculations with full
1395bd8deadSopenharmony_ci        32-bit single precision, although two lower-precision modes are also
1405bd8deadSopenharmony_ci        available.
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    How does texture mapping work with fragment programs?
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci        RESOLVED:  This extension provides three instructions used to perform
1455bd8deadSopenharmony_ci        texture lookups.
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci        The "TEX" instruction performs a lookup with the (s,t,r) values taken
1485bd8deadSopenharmony_ci        from an interpolated texture coordinate, an arbitrarily computed
1495bd8deadSopenharmony_ci        vector, or even a program constant.  The "TXP" instruction performs a
1505bd8deadSopenharmony_ci        similar lookup, except that it uses the fourth component of the source
1515bd8deadSopenharmony_ci        vector to performs a perspective divide, using (s/q, t/q, r/q).  In
1525bd8deadSopenharmony_ci        both cases, the GL will automatically compute partial derivatives used
1535bd8deadSopenharmony_ci        for filter and LOD selection.
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci        The "TXD" instruction operates like "TEX", except that it allows the
1565bd8deadSopenharmony_ci        program to explicitly specify two additional vectors containing the
1575bd8deadSopenharmony_ci        partial derivatives of the texture coordinate with respect to x and y
1585bd8deadSopenharmony_ci        window coordinates.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci        All three instructions write a filtered texel value to a temporary or
1615bd8deadSopenharmony_ci        output register.  Other than the computation of texture coordinates
1625bd8deadSopenharmony_ci        and partial derivatives, texture lookups not performed any differently
1635bd8deadSopenharmony_ci        in fragment program mode.  In particular, any applicable LOD biases,
1645bd8deadSopenharmony_ci        wrap modes, minification and magnification filters, and anisotropic
1655bd8deadSopenharmony_ci        filtering controls are still applied in fragment program mode.
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci        The results of the texture lookup are available to be used arbitrarily
1685bd8deadSopenharmony_ci        by subsequent fragment program instructions.  Fragment programs are
1695bd8deadSopenharmony_ci        allowed to access any texture map arbitrarily many times.
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    Can fragment programs be used to compute depth values?
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci         RESOLVED:  Yes.  A fragment program can perform arbitrary
1745bd8deadSopenharmony_ci         computations to compute a final value for the fragment, which it
1755bd8deadSopenharmony_ci         should write to the "z" component of the o[DEPR] register.  The "z"
1765bd8deadSopenharmony_ci         value written should be in the range [0,1], regardless of the size of
1775bd8deadSopenharmony_ci         the depth buffer.  
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci         To assist in the computation of the final Z value, a fragment program
1805bd8deadSopenharmony_ci         can access the interpolated depth of the fragment (prior to any
1815bd8deadSopenharmony_ci         displacement) by reading the "z" component of the f[WPOS] attribute
1825bd8deadSopenharmony_ci         register.
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    How should near and far plane clipping work in fragment program mode if
1855bd8deadSopenharmony_ci    the current fragment program computes a depth value?
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci        RESOLVED:  Geometric clipping to the near and far clip plane should be
1885bd8deadSopenharmony_ci        disabled.  Clipping should be done based on the depth values computed
1895bd8deadSopenharmony_ci        per-fragment.  The rationale is that per-fragment depth displacement
1905bd8deadSopenharmony_ci        operations may effectively move portions of a primitive initially
1915bd8deadSopenharmony_ci        outside the clip volume inside, and vice versa.
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci        Note that under the NV_depth_clamp extension, geometric clipping to
1945bd8deadSopenharmony_ci        the near and far clip planes is also disabled, and the fragment depth
1955bd8deadSopenharmony_ci        values are clamped to the depth range.  If depth clamp mode is enabled
1965bd8deadSopenharmony_ci        when using a fragment program that computes a depth value, the
1975bd8deadSopenharmony_ci        computed depth value will be clamped to the depth range.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    Should fragment programs be allowed to use multiple precisions for
2005bd8deadSopenharmony_ci    operands and operations?
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci        RESOLVED:  Yes.  Low-precision operands are generally adequate for
2035bd8deadSopenharmony_ci        representing colors.  Allowing low-precision registers also allows for
2045bd8deadSopenharmony_ci        a larger number of temporary registers (at lower precision).
2055bd8deadSopenharmony_ci        Low-precision operations also provide the opportunity for a higher
2065bd8deadSopenharmony_ci        level of performance.  
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci        Applications are free to use only high-precision operations or mix
2095bd8deadSopenharmony_ci        high- and low-precision operations as necessary.
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    What levels of precision are supported in arithmetic operations?
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci        RESOLVED:  Arithmetic operations can be performed at three different
2145bd8deadSopenharmony_ci        precisions.  32-bit floating point precision (fp32) uses the IEEE
2155bd8deadSopenharmony_ci        single-precision standard with a sign bit, 8 exponent bits, and 23
2165bd8deadSopenharmony_ci        mantissa bits.  16-bit floating-point precision (fp16) uses a similar
2175bd8deadSopenharmony_ci        floating-point representation, but with 5 exponent bits and 10
2185bd8deadSopenharmony_ci        mantissa bits.  Additionally, many arithmetic operations can also be
2195bd8deadSopenharmony_ci        carried out at 12-bit fixed point precision (fx12), where values in
2205bd8deadSopenharmony_ci        the range [-2,+2) are represented as signed values with 10 fraction
2215bd8deadSopenharmony_ci        bits.
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    How should the precision with which operations are carried out be
2245bd8deadSopenharmony_ci    specified?  Should we infer the precision from the types of the operands
2255bd8deadSopenharmony_ci    or result vectors?  Or should it be an attribute of the instruction?
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci        RESOLVED:  Applications can optionally specify the precision of
2285bd8deadSopenharmony_ci        individual instructions by adding a suffix of "R", "H", and "X" to
2295bd8deadSopenharmony_ci        instruction names to select fp32, fp16, and fx12 precision,
2305bd8deadSopenharmony_ci        respectively.  
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci        By default, instructions will be carried out using the precision of
2335bd8deadSopenharmony_ci        the destination register.  Always inferring the precision from the
2345bd8deadSopenharmony_ci        operands has a number of issues.  First, there are a number of
2355bd8deadSopenharmony_ci        operations (e.g., TEX/TXP/TXD) where result type has little to no
2365bd8deadSopenharmony_ci        correspondance to the type of the operands.  In these cases, precision
2375bd8deadSopenharmony_ci        suffixes are not supported.  Second, one could have instructions
2385bd8deadSopenharmony_ci        automatically cast operands and compute results using the type of the
2395bd8deadSopenharmony_ci        highest precision operand or result.  This behavior would be
2405bd8deadSopenharmony_ci        problematic since all fragment attribute registers and program
2415bd8deadSopenharmony_ci        parameters are kept at full precision, but full precision may not be
2425bd8deadSopenharmony_ci        needed by the operation.
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci        The choice of precision level allows programs to trade off precision
2455bd8deadSopenharmony_ci        for potentially higher performance.  Giving the program explicit
2465bd8deadSopenharmony_ci        control over the precision also allows it to dictate precision
2475bd8deadSopenharmony_ci        explicitly and eliminate any uncertainty over type casting.
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci    For instructions whose specified precision is different than the precision
2505bd8deadSopenharmony_ci    of the operands or the result registers, how are the operations performed?
2515bd8deadSopenharmony_ci    How are the condition codes updated?
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci        RESOLVED:  Operations are performed with operands and results at the
2545bd8deadSopenharmony_ci        precision specified by the instruction.  After the operation is
2555bd8deadSopenharmony_ci        complete, the result is converted to the precision of the destination
2565bd8deadSopenharmony_ci        register, after which the condition code is generated.
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci        In an alternate approach, the condition code could be generated from
2595bd8deadSopenharmony_ci        the result.  However, in some cases, the register contents would not
2605bd8deadSopenharmony_ci        match the condition code.  In such cases, it may not be reliable to
2615bd8deadSopenharmony_ci        use the condition code to prevent division by zero or other special
2625bd8deadSopenharmony_ci        cases.
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    How does this extension interact with the ARB_multisample extension?  In
2655bd8deadSopenharmony_ci    the ARB_multisample extension, each fragment has multiple depth values.
2665bd8deadSopenharmony_ci    In this extension, a single interpolated depth value may be modified by a
2675bd8deadSopenharmony_ci    fragment program.
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci        RESOLVED:  The depth values for the extra samples are generated by
2705bd8deadSopenharmony_ci        computing partials of the computed depth value and using these
2715bd8deadSopenharmony_ci        partials to derive the depth values for each of the extra samples.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    How does this extension interact with polygon offset?  Both extensions
2745bd8deadSopenharmony_ci    modify fragment depth values.
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci        RESOLVED:  As in the base OpenGL spec, the depth offset generated by
2775bd8deadSopenharmony_ci        polygon offset is added during polygon rasterization.  The depth value
2785bd8deadSopenharmony_ci        provided to programs in f[WPOS].z already includes polygon offset, if
2795bd8deadSopenharmony_ci        enabled.  If the depth value is replaced by a fragment program, the
2805bd8deadSopenharmony_ci        polygon offset value will NOT be recomputed and added back after
2815bd8deadSopenharmony_ci        program execution.
2825bd8deadSopenharmony_ci  
2835bd8deadSopenharmony_ci        This is probably not desirable for fragment programs that modify depth
2845bd8deadSopenharmony_ci        values since the partials used to generate the offset may not match
2855bd8deadSopenharmony_ci        the partials of the computed depth value.  Polygon offset for filled
2865bd8deadSopenharmony_ci        polygons can be approximated in a fragment program using the depth
2875bd8deadSopenharmony_ci        partials obtained by the DDX and DDY instructions.  This will not work
2885bd8deadSopenharmony_ci        properly for line- and point-mode polygons, since the partials used
2895bd8deadSopenharmony_ci        for offset are computed over the polygon, while the partials resulting
2905bd8deadSopenharmony_ci        from the DDX and DDY instructions are computed along the line (or are
2915bd8deadSopenharmony_ci        zero for point-mode polygons).  In addition, separate treatment of
2925bd8deadSopenharmony_ci        points, line segments, and polygons is not possible in a fragment
2935bd8deadSopenharmony_ci        program.
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci    Should depth component replacement be an property of the fragment program
2965bd8deadSopenharmony_ci    or a separate enable?
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci        RESOLVED:  It should be a program property.  Using the output register
2995bd8deadSopenharmony_ci        notation simplifies matters:  depth components are replaced if and
3005bd8deadSopenharmony_ci        only if the DEPR register is written to.  This alleviates the
3015bd8deadSopenharmony_ci        application and driver burden of maintaining separate state.
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    How does this extension affect the handling of q texture coordinates in
3045bd8deadSopenharmony_ci    the OpenGL spec?
3055bd8deadSopenharmony_ci       
3065bd8deadSopenharmony_ci        RESOLVED:  Fragment programs are allowed to access an associated q
3075bd8deadSopenharmony_ci        texture coordinate, so this attribute must be produced by
3085bd8deadSopenharmony_ci        rasterization.  In unextended OpenGL 1.2, the q coordinate is
3095bd8deadSopenharmony_ci        eliminated in the rasterization portions of the spec after dividing
3105bd8deadSopenharmony_ci        each of s, t, and r by it.  This extension updates the specification
3115bd8deadSopenharmony_ci        to pass q coordinates through at least to conventional texture
3125bd8deadSopenharmony_ci        mapping.  When fragment program mode are disabled, q coordinates will
3135bd8deadSopenharmony_ci        be eliminated there in an identical manner.  This modification has the
3145bd8deadSopenharmony_ci        added benefit of simplifying the equations used for attribute
3155bd8deadSopenharmony_ci        interpolation.
3165bd8deadSopenharmony_ci
3175bd8deadSopenharmony_ci    How should clip w coordinates be handled by this extension?
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci        RESOLVED:  Fragment programs are allowed to access the reciprocal of
3205bd8deadSopenharmony_ci        the clip w coordinate, so this attribute must be produced by
3215bd8deadSopenharmony_ci        rasterization.  The OpenGL 1.2 spec doesn't explictly enumerate the
3225bd8deadSopenharmony_ci        attributes associated with the fragment, but we add treatment of the w
3235bd8deadSopenharmony_ci        clip coordinate in the appropriate locations.  
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        The reciprocal of the clip w coordinate in traditional graphics
3265bd8deadSopenharmony_ci        hardware is produced by screen-space linear interpolation of the
3275bd8deadSopenharmony_ci        reciprocals of the clip w coordinates of the vertices.  However, this
3285bd8deadSopenharmony_ci        spec says the clip w coordinate is produced by perspective-correct
3295bd8deadSopenharmony_ci        interpolation of the (non-reciprocated) clip w vertex coordinates.
3305bd8deadSopenharmony_ci        These two formulations turn out to be equivalent, and the latter is
3315bd8deadSopenharmony_ci        more convenient since the core OpenGL spec already contains formulas
3325bd8deadSopenharmony_ci        for perspective-correct interpolation of vertex attributes.
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci    What is produced by the TEX/TXP/TXD instructions if the requested texture
3355bd8deadSopenharmony_ci    image is inconsistent?
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci        RESOLVED:  The result vector is specified to be (0,0,0,0).  This
3385bd8deadSopenharmony_ci        behavior is consistent with the NV_texture_shader extension.  Note
3395bd8deadSopenharmony_ci        that like in NV_texture_shader, these instructions ignore the standard
3405bd8deadSopenharmony_ci        hierarchy of texture enables and programs can access textures that are
3415bd8deadSopenharmony_ci        not specifically "enabled".
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci    Should a minimum precision be specified for certain fragment attribute
3445bd8deadSopenharmony_ci    registers (in particular COL0, COL1) that may not be generated with full
3455bd8deadSopenharmony_ci    fp32 precision?
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ci        RESOLVED:  No.  It is expected that the precision of COL0/COL1 should
3485bd8deadSopenharmony_ci        generally be at least as high as that of the frame buffer.
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci    Fragment color components (f[COL0] and f[COL1]) are generally
3515bd8deadSopenharmony_ci    low-precision fixed-point values in the range [0,1].  Is it possible to
3525bd8deadSopenharmony_ci    pass unclamped or high-precision color components to fragment programs?
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci        RESOLVED:  Yes, although you can't exactly call them "colors".
3555bd8deadSopenharmony_ci        High-precision per-vertex color values can be written into any unused
3565bd8deadSopenharmony_ci        texture coordinate set, either via a MultiTexCoord call or using a
3575bd8deadSopenharmony_ci        vertex program.  These "texture coordinates" will be interpolated
3585bd8deadSopenharmony_ci        during rasterization, and can be used arbitrarily by a fragment
3595bd8deadSopenharmony_ci        program.
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci        In particular, there is no requirement that per-fragment attributes
3625bd8deadSopenharmony_ci        called "texture coordinates" be used for texture mapping.
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    Should this specification guarantee that temporary registers are
3655bd8deadSopenharmony_ci    initialized to zero?
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci        RESOLVED:  Yes.  This will allow for the modular construction of
3685bd8deadSopenharmony_ci        programs that accumulate results in registers.  For example,
3695bd8deadSopenharmony_ci        per-fragment lighting may use MAD instructions to accumulate color
3705bd8deadSopenharmony_ci        contributions at each light.  Without zero-initialization, the program
3715bd8deadSopenharmony_ci        would require an explicit MOV instruction to load 0 or the use of the
3725bd8deadSopenharmony_ci        MUL instruction for the first light.
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci    Should this specification support Unicode program strings?
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci        RESOLVED:  Not necessary.
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    Programs defined by NV_vertex_program begin with "!!VP1.0".  Should
3795bd8deadSopenharmony_ci    fragment programs have a similar identifier?
3805bd8deadSopenharmony_ci
3815bd8deadSopenharmony_ci        RESOLVED:  Yes, "!!FP1.0", identifying the first revision of this
3825bd8deadSopenharmony_ci        fragment program language.
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci    Should per-fragment attributes have equivalent integer names in the
3855bd8deadSopenharmony_ci    program language, as per-vertex attributes do in NV_vertex_program?
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci        RESOLVED:  No.  In NV_vertex_program, "generic" vertex attributes
3885bd8deadSopenharmony_ci        could be specified directly by an application using only an attribute
3895bd8deadSopenharmony_ci        number.  Those numbers may have no necessary correlation with the
3905bd8deadSopenharmony_ci        conventional attribute names, although conventional vertex attributes
3915bd8deadSopenharmony_ci        are mapped to attribute numbers.  However, conventional attributes are
3925bd8deadSopenharmony_ci        the only outputs of vertex programs and of rasterization.  Therefore,
3935bd8deadSopenharmony_ci        there is no need for a similar input-by-number functionality for
3945bd8deadSopenharmony_ci        fragment programs.
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    Should we provide the ability to issue instructions that do not update
3975bd8deadSopenharmony_ci    temporary or output registers?
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci        RESOLVED:  Yes.  Programs may issue instructions whose only purpose is
4005bd8deadSopenharmony_ci        to update the condition code register, and requiring such instructions
4015bd8deadSopenharmony_ci        to write to a temporary may require the use of an additional temporary
4025bd8deadSopenharmony_ci        and/or defeat possible program optimizations.  We accomplish this by
4035bd8deadSopenharmony_ci        adding two write-only temporary pseudo-registers ("RC" and "HC") that
4045bd8deadSopenharmony_ci        can be specified as destination registers.
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    Do the packing and unpacking instructions in this extension make any
4075bd8deadSopenharmony_ci    sense?
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci        RESOLVED:  Yes.  They are useful for packing and unpacking multiple
4105bd8deadSopenharmony_ci        components in a single channel of a floating-point frame buffer.  For
4115bd8deadSopenharmony_ci        example, a 128-bit "RGBA" frame buffer could pack 16 8-bit quantities
4125bd8deadSopenharmony_ci        or 8 16-bit quantities, all of which could be used in later
4135bd8deadSopenharmony_ci        rasterization passes.  See the NV_float_buffer extension for more
4145bd8deadSopenharmony_ci        information.
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci    Should we provide a method for specifying a fp16 depth component output
4175bd8deadSopenharmony_ci    value?
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci        RESOLVED:  No.  There is no good reason for supporting half-precision
4205bd8deadSopenharmony_ci        Z outputs.  Even with 16-bit Z buffers, the 10-bit mantissa of the
4215bd8deadSopenharmony_ci        half-precision float is rather limiting.  There would effectively be
4225bd8deadSopenharmony_ci        only 11 good bits in the back half of the Z buffer.
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    Should RequestResidentProgramsNV (or a new equivalent function) take a
4255bd8deadSopenharmony_ci    target?  Dealing with working sets of different program types is a bit
4265bd8deadSopenharmony_ci    messy.  Should we document some limitation if we get programs of different
4275bd8deadSopenharmony_ci    types?
4285bd8deadSopenharmony_ci          
4295bd8deadSopenharmony_ci        RESOLVED:  In retrospect, it may have been a good idea to attach a
4305bd8deadSopenharmony_ci        target to this command, but there isn't a good reason to mess with
4315bd8deadSopenharmony_ci        something that already works for vertex programs.  The driver is
4325bd8deadSopenharmony_ci        responsible for ensuring consistent results when the program types
4335bd8deadSopenharmony_ci        specified are mixed.
4345bd8deadSopenharmony_ci    
4355bd8deadSopenharmony_ci    What happens on data type conversions where the original value is not
4365bd8deadSopenharmony_ci    exactly representable in the new data type, either due to overflow or
4375bd8deadSopenharmony_ci    insufficient precision in the destination type?
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci        RESOLVED:  In case of overflow, the original value is clamped to the
4405bd8deadSopenharmony_ci        +/-INF (fp16 or fp32) or the nearest representable value (fx12).  In
4415bd8deadSopenharmony_ci        case of imprecision, the conversion is either to round or truncate to
4425bd8deadSopenharmony_ci        the nearest representable value.
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    Should this extension support IEEE-style denorms?  For 32-bit IEEE
4455bd8deadSopenharmony_ci    floating point, denorms are numbers smaller in absolute value than 2^-126.
4465bd8deadSopenharmony_ci    For 16-bit floats used by this extension, denorms are numbers smaller in
4475bd8deadSopenharmony_ci    absolute value than 2^-14.
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci        RESOLVED:  For 32-bit data types, hardware support for denorms was
4505bd8deadSopenharmony_ci        considered too expensive relative to the benefit provided.
4515bd8deadSopenharmony_ci        Computational results that would otherwise produce denorms are flushed
4525bd8deadSopenharmony_ci        to zero.  For 16-bit data types, hardware denorm support will be
4535bd8deadSopenharmony_ci        present.  The expense of hardware denorm support is lower and the
4545bd8deadSopenharmony_ci        potential precision benefit is greater for 16-bit data types.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    OpenGL provides a hierarchy of texture enables.  The texture lookup
4575bd8deadSopenharmony_ci    operations in NV_texture_shader effectively override the texture enable
4585bd8deadSopenharmony_ci    hierarchy and select a specific texture to enable.  What should be done by
4595bd8deadSopenharmony_ci    this extension?
4605bd8deadSopenharmony_ci
4615bd8deadSopenharmony_ci        RESOLVED:  This extension will build upon NV_texture_shader and reduce
4625bd8deadSopenharmony_ci        the driver overhead of validating the texture enables.  Texture
4635bd8deadSopenharmony_ci        lookups can be specified by instructions like "TEX H0, f[TEX2], TEX2,
4645bd8deadSopenharmony_ci        3D", which would indicate to use texture coordinate set number 2 to do
4655bd8deadSopenharmony_ci        a lookup in the texture object bound to the TEXTURE_3D target in
4665bd8deadSopenharmony_ci        texture image unit 2.
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci        Each texture unit can have only one "active" target.  Programs are not
4695bd8deadSopenharmony_ci        allowed to reference different texture targets in the same texture
4705bd8deadSopenharmony_ci        image unit.  In the example above, any other texture instructions
4715bd8deadSopenharmony_ci        using texture image unit 2 must specify the 3D texture target.
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci    What is the interaction with NV_register_combiners?
4745bd8deadSopenharmony_ci
4755bd8deadSopenharmony_ci        RESOLVED:  Register combiners are not available when fragment programs
4765bd8deadSopenharmony_ci        are enabled.
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci        Previous version of this specification supported the notion of
4795bd8deadSopenharmony_ci        combiner programs, where the result of fragment program execution was
4805bd8deadSopenharmony_ci        a set of four "texture lookup" values that fed the register combiners.
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci    For convenience, should we include pseudo-instructions not present in the
4835bd8deadSopenharmony_ci    hardware instruction set that are trivially implementable?  For example,
4845bd8deadSopenharmony_ci    absolute value and subtract instructions could fall in this category.  An
4855bd8deadSopenharmony_ci    "ABS R1,R0" instruction would be equivalent to "MAX R1,R0,-R0", and a "SUB
4865bd8deadSopenharmony_ci    R2,R0,R1" would be equivalent to "ADD R2,R0,-R1"
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci        RESOLVED:  In general, yes.  A SUB instruction is provided for
4895bd8deadSopenharmony_ci        convenience.  This extension does not provide a separate ABS
4905bd8deadSopenharmony_ci        instruction because it supports absolute value operations of each
4915bd8deadSopenharmony_ci        operand.
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci    Should there be a '+' in the <optionalSign> portion of the grammar?  There
4945bd8deadSopenharmony_ci    isn't one in the GL_NV_vertex_program spec.
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci        RESOLVED:  Yes, for orthogonality/readability.  A '+' obviously adds
4975bd8deadSopenharmony_ci        no functionality.  In NV_vertex_program, an <optionalSign> of "-" was
4985bd8deadSopenharmony_ci        always a negation operator.  However, in fragment programs, it can
4995bd8deadSopenharmony_ci        also be used as a sign for a constant value.
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci    Can the same fragment attribute register, program parameter register, or
5025bd8deadSopenharmony_ci    constants be used for multiple operands in the same instruction?  If so,
5035bd8deadSopenharmony_ci    can it be used with different swizzle patterns?
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci        RESOLVED:  Yes and yes.
5065bd8deadSopenharmony_ci
5075bd8deadSopenharmony_ci    This extension allows different limits for the number of texture
5085bd8deadSopenharmony_ci    coordinate sets and the number of texture image units (i.e., texture maps
5095bd8deadSopenharmony_ci    and associated data).  The state in ActiveTextureARB affects both
5105bd8deadSopenharmony_ci    coordinate sets (TexGen, matrix operations) and image units (TexParameter,
5115bd8deadSopenharmony_ci    TexEnv).  How should we deal with this?
5125bd8deadSopenharmony_ci
5135bd8deadSopenharmony_ci        RESOLVED:  Continue to use ActiveTextureARB and emit an
5145bd8deadSopenharmony_ci        INVALID_OPERATION if the active texture refers to an unsupported
5155bd8deadSopenharmony_ci        coordinate set/image unit.  Other options included creating dummy
5165bd8deadSopenharmony_ci        (unusable) state for unsupported coordinate sets/image units and
5175bd8deadSopenharmony_ci        continue to use ActiveTextureARB normally, or creating separate state
5185bd8deadSopenharmony_ci        and state-setting commands for coordinate sets and image units.
5195bd8deadSopenharmony_ci        Separate state is the cleanest solution, but would add more calls and
5205bd8deadSopenharmony_ci        potentially cause more programmer confusion.  Dummy state would avoid
5215bd8deadSopenharmony_ci        additional error checks, but the demands of dummy state could grow if
5225bd8deadSopenharmony_ci        the number of texture image units and texture coordinate sets
5235bd8deadSopenharmony_ci        increases.
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci        The current OpenGL spec is vague as to what state is affected by the
5265bd8deadSopenharmony_ci        active texture selector and has no distination between
5275bd8deadSopenharmony_ci        coordinate-related and image-related state.  The state tables could
5285bd8deadSopenharmony_ci        use a good clean-up in this area.
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci    The LRP instruction is defined so that the result of "LRP R0, R0, R1, R2"
5315bd8deadSopenharmony_ci    is R0*R1+(1-R0)*R2.  There are conflicting precedents here.  The
5325bd8deadSopenharmony_ci    definition here matches the "lrp" instruction in the DirectX 8.0 pixel
5335bd8deadSopenharmony_ci    shader language.  However, an equivalent RenderMan lerp operation would
5345bd8deadSopenharmony_ci    yield a result of (1-R0)*R1+R0*R2.  Which ordering should be implemented?
5355bd8deadSopenharmony_ci
5365bd8deadSopenharmony_ci        RESOLVED:  NVIDIA hardware implements the former operand ordering, and
5375bd8deadSopenharmony_ci        there is no good reason to specify a different ordering.  To convert a
5385bd8deadSopenharmony_ci        "LRP" using the latter ordering to NV_fragment_program, swap the third
5395bd8deadSopenharmony_ci        and fourth arguments.
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    Should this extension provide tracking of matrices or any other state,
5425bd8deadSopenharmony_ci    similar to that provided in NV_vertex_program?
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci        RESOLVED:  No.
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ci    Should this extension provide global program parameters -- values shared
5475bd8deadSopenharmony_ci    between multiple fragment programs?
5485bd8deadSopenharmony_ci
5495bd8deadSopenharmony_ci        RESOLVED:  No.
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci    Should this extension provide program parameters specific to a program?
5525bd8deadSopenharmony_ci    If so, how?
5535bd8deadSopenharmony_ci
5545bd8deadSopenharmony_ci        RESOLVED:  Yes.  These parameters will be called "local parameters".
5555bd8deadSopenharmony_ci        This extension will provide both named and numbered local parameters.
5565bd8deadSopenharmony_ci        Local parameters can be managed by the driver and eliminate the need
5575bd8deadSopenharmony_ci        for applications to manage a global name space.  
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci        Named local parameters work much like standard variable names in most
5605bd8deadSopenharmony_ci        programming languages.  They are created using the "DECLARE"
5615bd8deadSopenharmony_ci        instruction within the fragment program itself.  For example:
5625bd8deadSopenharmony_ci
5635bd8deadSopenharmony_ci            DECLARE color = {1,0,0,1};
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci        Named local parameters are used simply by referencing the variable
5665bd8deadSopenharmony_ci        name.  They do not require the array syntax like the global parameters
5675bd8deadSopenharmony_ci        in the NV_vertex_program extension.  They can be updated using the
5685bd8deadSopenharmony_ci        commands ProgramNamedParameter4[f,fv]NV.
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci        Numbered local parameters are not declared.  They are used by simply
5715bd8deadSopenharmony_ci        referencing an element of an array called "p".  For example,
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci            MOV R0, p[12];
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ci        loads the value of numbered local parameter 12 into register R0.
5765bd8deadSopenharmony_ci        Numbered local parameters can be updated using the commands
5775bd8deadSopenharmony_ci        ProgramLocalParameter4[d,dv,f,fv]ARB.
5785bd8deadSopenharmony_ci
5795bd8deadSopenharmony_ci        The numbered local parameter APIs were added to this extension late in
5805bd8deadSopenharmony_ci        its development, and are provided for compatibility with the
5815bd8deadSopenharmony_ci        ARB_vertex_program extension, and what will likely be supported in
5825bd8deadSopenharmony_ci        ARB_fragment_program as well.  Providing this mechanism allows
5835bd8deadSopenharmony_ci        programs to use the same mechanisms to set local parameters in both
5845bd8deadSopenharmony_ci        extension.
5855bd8deadSopenharmony_ci
5865bd8deadSopenharmony_ci    Why are the APIs for setting named and numbered local parameters
5875bd8deadSopenharmony_ci    different?
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci        RESOLVED:  The named parameter API was created prior to
5905bd8deadSopenharmony_ci        ARB_vertex_program (and the possible future ARB_fragment_program) and
5915bd8deadSopenharmony_ci        uses conventions borrowed from NV_vertex_program.  A slightly
5925bd8deadSopenharmony_ci        different API was chosen during the ARB standardization process; see
5935bd8deadSopenharmony_ci        the ARB_vertex_program specification for more details.
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ci        The named parameter API takes a program ID and a parameter name, and
5965bd8deadSopenharmony_ci        sets the parameter for the program with the specified ID.  The
5975bd8deadSopenharmony_ci        specified program does not need to be bound (via BindProgramNV) in
5985bd8deadSopenharmony_ci        order to modify the values of its named parameters.  The numbered
5995bd8deadSopenharmony_ci        parameter API takes a program target enum (FRAGMENT_PROGRAM_NV) and a
6005bd8deadSopenharmony_ci        parameter number and modifies the corresponding numbered parameter of
6015bd8deadSopenharmony_ci        the currently bound program.
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    What should be the initial value of uninitialized local parameters?
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci        RESOLVED:  (0,0,0,0).  This choice is somewhat arbitrary, but matches
6065bd8deadSopenharmony_ci        previous extensions (e.g., NV_vertex_program).
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ci    Should this extension support program parameter arrays?
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci        RESOLVED:  No hardware support is present.  Note that from the point
6115bd8deadSopenharmony_ci        of view of a fragment program, a texture map can be used as a 1-, 2-,
6125bd8deadSopenharmony_ci        or 3-dimensional array of constants.
6135bd8deadSopenharmony_ci        
6145bd8deadSopenharmony_ci    Should this extension provide support constants in fragment programs?  If
6155bd8deadSopenharmony_ci    so, how?
6165bd8deadSopenharmony_ci
6175bd8deadSopenharmony_ci        RESOLVED:  Yes.  Scalar or vector constants can be defined inline
6185bd8deadSopenharmony_ci        (e.g., "1.0" or "{1,2,3,4}").  In addition, named constants are
6195bd8deadSopenharmony_ci        supported using the "DEFINE" instruction, which allow programmers to
6205bd8deadSopenharmony_ci        change the values of constants used in multiple instructions simply be
6215bd8deadSopenharmony_ci        changing the value assigned to the named constant.
6225bd8deadSopenharmony_ci
6235bd8deadSopenharmony_ci        Note that because this extension uses program strings, the
6245bd8deadSopenharmony_ci        floating-point value of any constants generated on the fly must be
6255bd8deadSopenharmony_ci        printed to the program string.  An alternate method that avoids the
6265bd8deadSopenharmony_ci        need to print constants is to declare a named local program parameter
6275bd8deadSopenharmony_ci        and initialize it with the ProgramNamedParameter4[f,fv]() calls.
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci    Should named constants be allowed to be redefined?
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci        RESOLVED:  No.  If you want to redefine the values of constants, you
6325bd8deadSopenharmony_ci        can create an equivalent named program parameter by changing the
6335bd8deadSopenharmony_ci        "DEFINE" keyword to "DECLARE".
6345bd8deadSopenharmony_ci
6355bd8deadSopenharmony_ci    Should functions used to update or query named local parameters take a
6365bd8deadSopenharmony_ci    zero-terminated string (as with most strings in the C programming
6375bd8deadSopenharmony_ci    language), or should they require an explicit string length?  If the
6385bd8deadSopenharmony_ci    former, should we create a version of LoadProgramNV that does not require
6395bd8deadSopenharmony_ci    a string length.
6405bd8deadSopenharmony_ci
6415bd8deadSopenharmony_ci        RESOLVED:  Stick with explicit string length.  Strings that are
6425bd8deadSopenharmony_ci        defined as constants can have the length computed at compile-time.
6435bd8deadSopenharmony_ci        Strings read from files will have the length known in advance.
6445bd8deadSopenharmony_ci        Programs to build strings at run-time also likely keep the length
6455bd8deadSopenharmony_ci        up-to-date.  Passing an explicit length saves time, since the driver
6465bd8deadSopenharmony_ci        doesn't have to do a strlen().
6475bd8deadSopenharmony_ci
6485bd8deadSopenharmony_ci    What is the deal with the alpha of the secondary color?
6495bd8deadSopenharmony_ci
6505bd8deadSopenharmony_ci        RESOLVED:  In unextended OpenGL 1.2, the alpha component of the
6515bd8deadSopenharmony_ci        secondary color is forced to 0.0.  In the EXT_secondary_color
6525bd8deadSopenharmony_ci        extension, the alpha of the per-vertex secondary colors is defined to
6535bd8deadSopenharmony_ci        be 0.0.  NV_vertex_program allows vertex programs to produce a
6545bd8deadSopenharmony_ci        per-vertex alpha component, but it is forced to zero for the purposes
6555bd8deadSopenharmony_ci        of the color sum.  In the NV_register_combiners extension, the alpha
6565bd8deadSopenharmony_ci        component of the secondary color is undefined.  What a mess.
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci        In this extension, the alpha of the secondary color is well-defined
6595bd8deadSopenharmony_ci        and can be used normally.  When in vertex program mode
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    Why are fragment program instructions involving f[FOGC] or f[TEX0] through
6625bd8deadSopenharmony_ci    f[TEX7] automatically carried out at full precision?
6635bd8deadSopenharmony_ci
6645bd8deadSopenharmony_ci        RESOLVED:  This is an artifact of the method that these interpolants
6655bd8deadSopenharmony_ci        are generated the NVIDIA graphics hardware.  If such instructions
6665bd8deadSopenharmony_ci        absolutely must be carried out at lower precision, the requirement can
6675bd8deadSopenharmony_ci        be met by first loading the interpolants into a temporary register.
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    With a different number of texture coordinate sets and texture image
6705bd8deadSopenharmony_ci    units, how many copies of each kind of texture state are there?
6715bd8deadSopenharmony_ci
6725bd8deadSopenharmony_ci        RESOLVED:  The intention is that texture state be broken into three
6735bd8deadSopenharmony_ci        groups.  (1) There are MAX_TEXTURE_COORDS_NV copies of texture
6745bd8deadSopenharmony_ci        coordinate set state, which includes current texture coordinates,
6755bd8deadSopenharmony_ci        TexGen state, and texture matrices.  (2) There are
6765bd8deadSopenharmony_ci        MAX_TEXTURE_IMAGE_UNITS_NV copies of texture image unit state, which
6775bd8deadSopenharmony_ci        include texture maps, texture parameters, LOD bias parameters.  (3)
6785bd8deadSopenharmony_ci        There are MAX_TEXTURE_UNITS_ARB copies of legacy OpenGL texture unit
6795bd8deadSopenharmony_ci        state (e.g., texture enables, TexEnv blending state), all of which are
6805bd8deadSopenharmony_ci        unused when in fragment program mode.
6815bd8deadSopenharmony_ci
6825bd8deadSopenharmony_ci        It is not necessary that MAX_TEXTURE_UNITS_ARB be equal to the minimum
6835bd8deadSopenharmony_ci        of MAX_TEXTURE_COORDS_NV and MAX_TEXTURE_IMAGE_UNITS --
6845bd8deadSopenharmony_ci        implementations may choose not to extend fixed-function OpenGL texture
6855bd8deadSopenharmony_ci        mapping modes beyond a certain point.
6865bd8deadSopenharmony_ci
6875bd8deadSopenharmony_ci    The GLX protocol for LoadProgramNV (and ProgramNamedParameterNV) may end
6885bd8deadSopenharmony_ci    up with programs >64KB.  This will overflow the limits of the GLX Render
6895bd8deadSopenharmony_ci    protocol, resulting in the need to use RenderLarge path.  This is an issue
6905bd8deadSopenharmony_ci    with vertex programs, also.
6915bd8deadSopenharmony_ci
6925bd8deadSopenharmony_ci        RESOLVED:  Yes, it is.
6935bd8deadSopenharmony_ci
6945bd8deadSopenharmony_ci    Should textures used by fragment programs be declared?  For example,
6955bd8deadSopenharmony_ci    "TEXTURE TEX3, 2D", indicating that the 2D texture should be used for all
6965bd8deadSopenharmony_ci    accesses to texture unit 3.  The dimension could be dropped from the TEX
6975bd8deadSopenharmony_ci    family of instructions, and some of the compile-time error checking could
6985bd8deadSopenharmony_ci    be dropped.
6995bd8deadSopenharmony_ci
7005bd8deadSopenharmony_ci        RESOLVED:  Maybe it should be, but for better or worse, it isn't.
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci    It is not all that uncommon to have negative q values with projective
7035bd8deadSopenharmony_ci    texture mapping, but results are undefined if any q values are negative in
7045bd8deadSopenharmony_ci    this specification.  Why?
7055bd8deadSopenharmony_ci
7065bd8deadSopenharmony_ci        RESOLVED:  This restriction carries on a similar one in the initial
7075bd8deadSopenharmony_ci        OpenGL specification.  The motivation for this restriction is that
7085bd8deadSopenharmony_ci        when interpolating, it is possible for a fragment to have an
7095bd8deadSopenharmony_ci        interpolated q coordinate at or near 0.0.  Since the texture
7105bd8deadSopenharmony_ci        coordinates used for projective texture mapping are s/q, t/q, and r/q,
7115bd8deadSopenharmony_ci        this will result in a divide-by-zero error or suffer from significant
7125bd8deadSopenharmony_ci        numerical instability.  Results will be inaccurate for such fragments.
7135bd8deadSopenharmony_ci
7145bd8deadSopenharmony_ci        Other than the numerical stability issue above, NVIDIA hardware should
7155bd8deadSopenharmony_ci        have no problems with negative q coordinates.
7165bd8deadSopenharmony_ci
7175bd8deadSopenharmony_ci    Should programs that replace depth have their own special program type,
7185bd8deadSopenharmony_ci    Such as "!!FPD1.0" and "!!FPDC1.0"?
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci        RESOLVED:  No.  If a program has an instruction that writes to
7215bd8deadSopenharmony_ci        o[DEPR], the final fragment depth value is taken from o[DEPR].z.
7225bd8deadSopenharmony_ci        Otherwise, the fragment's original depth value is used.
7235bd8deadSopenharmony_ci
7245bd8deadSopenharmony_ci    What fx12 value should NaN map to?
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci        RESOLVED:  For the lack of any better choice, 0.0.
7275bd8deadSopenharmony_ci
7285bd8deadSopenharmony_ci    How are special-case encodings (-INF, +INF, -0.0, +0.0, NaN) handled for
7295bd8deadSopenharmony_ci    arithmetic and comparison operations?
7305bd8deadSopenharmony_ci
7315bd8deadSopenharmony_ci        RESOLVED:  The special cases for all floating-point operations are
7325bd8deadSopenharmony_ci        designed to match the IEEE specification for floating-point numbers as
7335bd8deadSopenharmony_ci        closely as possible.  The results produced by special cases should be
7345bd8deadSopenharmony_ci        enumerated in the sections of this spec describing the operations.
7355bd8deadSopenharmony_ci        There are some cases where the implemented fragment program behavior
7365bd8deadSopenharmony_ci        does not match IEEE conventions, and these cases should be noted in
7375bd8deadSopenharmony_ci        this specification.
7385bd8deadSopenharmony_ci
7395bd8deadSopenharmony_ci    How can condition codes be used to mask out register writes?  How about
7405bd8deadSopenharmony_ci    killing fragments?  What other things can you do?
7415bd8deadSopenharmony_ci
7425bd8deadSopenharmony_ci        RESOLVED:  The following example computes a component wise |R1-R2|:
7435bd8deadSopenharmony_ci
7445bd8deadSopenharmony_ci          SUBC R0, R1, R2;      # "C" suffix means update condition code
7455bd8deadSopenharmony_ci          MOV  R0 (LT), -R0;    # Conditional write mask in parentheses
7465bd8deadSopenharmony_ci
7475bd8deadSopenharmony_ci        The first instruction computes a component-wise difference between R1
7485bd8deadSopenharmony_ci        and R2, storing R1-R2 in register R0.  The "C" suffix in the
7495bd8deadSopenharmony_ci        instruction means to update the condition code based on the sign of
7505bd8deadSopenharmony_ci        the result vector components.  The second instruction inverts the sign
7515bd8deadSopenharmony_ci        of the components of R0.  However the "(LT)" portion says that the
7525bd8deadSopenharmony_ci        destination register should be updated only if the corresponding
7535bd8deadSopenharmony_ci        condition code component is LT (negative).  This means that only those
7545bd8deadSopenharmony_ci        components of R0
7555bd8deadSopenharmony_ci
7565bd8deadSopenharmony_ci        To kill a fragment if the red (x) component of a texture lookup
7575bd8deadSopenharmony_ci        returns zero:
7585bd8deadSopenharmony_ci
7595bd8deadSopenharmony_ci          TEXC R0, f[TEX0], TEX0, 2D;
7605bd8deadSopenharmony_ci          KIL EQ.x;
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci        To kill based on the green (y) component, use "EQ.y" instead.  To kill
7635bd8deadSopenharmony_ci        if any of the four components is zero, use "EQ.xyzw" or just "EQ".
7645bd8deadSopenharmony_ci        
7655bd8deadSopenharmony_ci        Fragment programs do not support boolean expressions.  These can
7665bd8deadSopenharmony_ci        generally be achieved using conditional write mask.  
7675bd8deadSopenharmony_ci
7685bd8deadSopenharmony_ci        To evaluate the expression "(R0.x == 0) && (R1.x == 0)":
7695bd8deadSopenharmony_ci
7705bd8deadSopenharmony_ci          MOVC RC.x, R0.x;
7715bd8deadSopenharmony_ci          MOVC RC.x (EQ), R1.x;
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci        To evaluate the expression "(R0.x == 0) || (R1.x == 0)":
7745bd8deadSopenharmony_ci
7755bd8deadSopenharmony_ci          MOVC RC.x, R0.x;
7765bd8deadSopenharmony_ci          MOVC RC.x (NE), R1.x;
7775bd8deadSopenharmony_ci
7785bd8deadSopenharmony_ci        In both cases, the x component of the condition code will contain "EQ"
7795bd8deadSopenharmony_ci        if and only if the condition is TRUE.
7805bd8deadSopenharmony_ci
7815bd8deadSopenharmony_ci    How can fragment programs be used to implement non-standard texture
7825bd8deadSopenharmony_ci    filtering modes?
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ci        RESOLVED:  As one example, consider a case where you want to do linear
7855bd8deadSopenharmony_ci        filtering in a 2D texture map, but only horizontally.  To achieve
7865bd8deadSopenharmony_ci        this, first set the texture filtering mode to NEAREST.  For a 16 x n
7875bd8deadSopenharmony_ci        texture, you might do something like:
7885bd8deadSopenharmony_ci
7895bd8deadSopenharmony_ci          DEFINE halfTexel = { 0.03125, 0 };   # 1/32 (1/2 a texel)
7905bd8deadSopenharmony_ci          ADD R2, f[TEX0], -halfTexel;         # coords of left sample
7915bd8deadSopenharmony_ci          ADD R1, f[TEX0], +halfTexel;         # coords of right sample
7925bd8deadSopenharmony_ci          TEX R0, R2, TEX0, 2D;                # lookup left sample
7935bd8deadSopenharmony_ci          TEX R1, R1, TEX0, 2D;                # lookup right sample
7945bd8deadSopenharmony_ci          MUL R2.x, R2.x, 16;                  # scale X coords to texels
7955bd8deadSopenharmony_ci          FRC R2.x, R2.x;                      # get fraction, filter weight
7965bd8deadSopenharmony_ci          LRP R0, R2.x, R1, R0;                # blend samples based on weight
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci        There are plenty of other interesting things that can be done.
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci    Should this specification provide more examples?
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci        RESOLVED:  Yes, it should.
8035bd8deadSopenharmony_ci
8045bd8deadSopenharmony_ci    Is the OpenGL ARB working on a multi-vendor standard for fragment
8055bd8deadSopenharmony_ci    programmability?  Will there be an ARB_fragment_program extension?  If so,
8065bd8deadSopenharmony_ci    how will this extension interact with the ARB standard?
8075bd8deadSopenharmony_ci
8085bd8deadSopenharmony_ci        RESOLVED:  Yes, as of July 2002, there was a multi-vendor working
8095bd8deadSopenharmony_ci        group and a draft specification.  The ARB extension is expected to
8105bd8deadSopenharmony_ci        have several features not present in this extension, such as state
8115bd8deadSopenharmony_ci        tracking and global parameters (called "program environment
8125bd8deadSopenharmony_ci        parameters").  It will also likely lack certain features found in this
8135bd8deadSopenharmony_ci        extension.
8145bd8deadSopenharmony_ci
8155bd8deadSopenharmony_ci    Why does the HEMI mapping apply to the third component of signed HILO
8165bd8deadSopenharmony_ci    textures, but not to unsigned HILO textures?
8175bd8deadSopenharmony_ci
8185bd8deadSopenharmony_ci        RESOLVED:  This behavior matches the behavior of NV_texture_shader
8195bd8deadSopenharmony_ci        (e.g., the DOT_PRODUCT_NV mode).  The HEMI mapping will construct the
8205bd8deadSopenharmony_ci        third component of a unit vector whose first two components are
8215bd8deadSopenharmony_ci        encoded in the HILO texture.
8225bd8deadSopenharmony_ci
8235bd8deadSopenharmony_ci
8245bd8deadSopenharmony_ciNew Procedures and Functions
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ci    void ProgramNamedParameter4fNV(uint id, sizei len, const ubyte *name,
8275bd8deadSopenharmony_ci                                   float x, float y, float z, float w);
8285bd8deadSopenharmony_ci    void ProgramNamedParameter4dNV(uint id, sizei len, const ubyte *name,
8295bd8deadSopenharmony_ci                                   double x, double y, double z, double w);
8305bd8deadSopenharmony_ci    void ProgramNamedParameter4fvNV(uint id, sizei len, const ubyte *name,
8315bd8deadSopenharmony_ci                                    const float v[]);
8325bd8deadSopenharmony_ci    void ProgramNamedParameter4dvNV(uint id, sizei len, const ubyte *name,
8335bd8deadSopenharmony_ci                                    const double v[]);
8345bd8deadSopenharmony_ci    void GetProgramNamedParameterfvNV(uint id, sizei len, const ubyte *name,
8355bd8deadSopenharmony_ci                                      float *params);
8365bd8deadSopenharmony_ci    void GetProgramNamedParameterdvNV(uint id, sizei len, const ubyte *name,
8375bd8deadSopenharmony_ci                                      double *params);
8385bd8deadSopenharmony_ci
8395bd8deadSopenharmony_ci    void ProgramLocalParameter4dARB(enum target, uint index,
8405bd8deadSopenharmony_ci                                    double x, double y, double z, double w);
8415bd8deadSopenharmony_ci    void ProgramLocalParameter4dvARB(enum target, uint index,
8425bd8deadSopenharmony_ci                                     const double *params);
8435bd8deadSopenharmony_ci    void ProgramLocalParameter4fARB(enum target, uint index,
8445bd8deadSopenharmony_ci                                    float x, float y, float z, float w);
8455bd8deadSopenharmony_ci    void ProgramLocalParameter4fvARB(enum target, uint index,
8465bd8deadSopenharmony_ci                                     const float *params);
8475bd8deadSopenharmony_ci    void GetProgramLocalParameterdvARB(enum target, uint index,
8485bd8deadSopenharmony_ci                                       double *params);
8495bd8deadSopenharmony_ci    void GetProgramLocalParameterfvARB(enum target, uint index, 
8505bd8deadSopenharmony_ci                                       float *params);
8515bd8deadSopenharmony_ci
8525bd8deadSopenharmony_ci
8535bd8deadSopenharmony_ciNew Tokens
8545bd8deadSopenharmony_ci
8555bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the
8565bd8deadSopenharmony_ci    <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev,
8575bd8deadSopenharmony_ci    and by the <target> parameter of BindProgramNV, LoadProgramNV,
8585bd8deadSopenharmony_ci    ProgramLocalParameter4dARB, ProgramLocalParameter4dvARB,
8595bd8deadSopenharmony_ci    ProgramLocalParameter4fARB, ProgramLocalParameter4fvARB,
8605bd8deadSopenharmony_ci    GetProgramLocalParameterdvARB, and GetProgramLocalParameterfvARB:
8615bd8deadSopenharmony_ci
8625bd8deadSopenharmony_ci        FRAGMENT_PROGRAM_NV                            0x8870
8635bd8deadSopenharmony_ci
8645bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
8655bd8deadSopenharmony_ci    and GetDoublev:
8665bd8deadSopenharmony_ci
8675bd8deadSopenharmony_ci        MAX_TEXTURE_COORDS_NV                          0x8871
8685bd8deadSopenharmony_ci        MAX_TEXTURE_IMAGE_UNITS_NV                     0x8872
8695bd8deadSopenharmony_ci        FRAGMENT_PROGRAM_BINDING_NV                    0x8873
8705bd8deadSopenharmony_ci        MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV       0x8868
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ci    Accepted by the <name> parameter of GetString:
8735bd8deadSopenharmony_ci
8745bd8deadSopenharmony_ci        PROGRAM_ERROR_STRING_NV                        0x8874
8755bd8deadSopenharmony_ci
8765bd8deadSopenharmony_ci
8775bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
8785bd8deadSopenharmony_ci
8795bd8deadSopenharmony_ci    Modify Section 2.11, Clipping (p.39)
8805bd8deadSopenharmony_ci
8815bd8deadSopenharmony_ci    (replace the first paragraph of the section, p. 39)  Primitives are clipped
8825bd8deadSopenharmony_ci    to the clip volume.  In clip coordinates, the view volume is defined by
8835bd8deadSopenharmony_ci    
8845bd8deadSopenharmony_ci        -w_c <= x_c <= w_c,
8855bd8deadSopenharmony_ci        -w_c <= y_c <= w_c, and
8865bd8deadSopenharmony_ci        -w_c <= z_c <= w_c.
8875bd8deadSopenharmony_ci
8885bd8deadSopenharmony_ci    Clipping to the near and far clip planes is ignored if fragment program
8895bd8deadSopenharmony_ci    mode (section 3.11) or texture shaders (see NV_texture_shader
8905bd8deadSopenharmony_ci    specification) are enabled, if the current fragment program or texture
8915bd8deadSopenharmony_ci    shader computes per-fragment depth values.  In this case, the view volume
8925bd8deadSopenharmony_ci    is defined by:
8935bd8deadSopenharmony_ci    
8945bd8deadSopenharmony_ci        -w_c <= x_c <= w_c and
8955bd8deadSopenharmony_ci        -w_c <= y_c <= w_c.
8965bd8deadSopenharmony_ci
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    Modify Chapter 3 introduction (p. 57)
9015bd8deadSopenharmony_ci
9025bd8deadSopenharmony_ci    (p.57, modify 1st paragraph) ... Figure 3.1 diagrams the rasterization
9035bd8deadSopenharmony_ci    process.  The color value assigned to a fragment is initially determined
9045bd8deadSopenharmony_ci    by the rasterization operations (Sections 3.3 through 3.7) and modified by
9055bd8deadSopenharmony_ci    either the execution of the texturing, color sum, and fog operations as
9065bd8deadSopenharmony_ci    defined in Sections 3.8, 3.9, and 3.10, or of a fragment program defined
9075bd8deadSopenharmony_ci    in Section 3.11.  The final depth value is initially determined by the
9085bd8deadSopenharmony_ci    rasterization operations and may be modified by a fragment program.
9095bd8deadSopenharmony_ci  
9105bd8deadSopenharmony_ci    note:  Antialiasing Application is renumbered from Section 3.11 to Section
9115bd8deadSopenharmony_ci    3.12.
9125bd8deadSopenharmony_ci
9135bd8deadSopenharmony_ci    Modify Figure 3.1 (p.58)
9145bd8deadSopenharmony_ci
9155bd8deadSopenharmony_ci                             Primitive Assembly
9165bd8deadSopenharmony_ci                                      |
9175bd8deadSopenharmony_ci              +-----------+-----------+-----------+-----------+
9185bd8deadSopenharmony_ci              |           |           |           |           |
9195bd8deadSopenharmony_ci              |           |           |        Pixel          |
9205bd8deadSopenharmony_ci            Point       Line       Polygon     Rectangle   Bitmap
9215bd8deadSopenharmony_ci           Raster-     Raster-     Raster-     Raster-     Raster-
9225bd8deadSopenharmony_ci           ization     ization     ization     ization     ization   
9235bd8deadSopenharmony_ci              |           |           |           |           |
9245bd8deadSopenharmony_ci              +-----------+-----------+-----------+-----------+
9255bd8deadSopenharmony_ci                                      |
9265bd8deadSopenharmony_ci                                      |
9275bd8deadSopenharmony_ci                    +-----------------+-----------------+
9285bd8deadSopenharmony_ci                    |                 |                 |
9295bd8deadSopenharmony_ci              Conventional         Texture          Fragment
9305bd8deadSopenharmony_ci              Texture Fetch        Shaders          Programs
9315bd8deadSopenharmony_ci                    |                 |                 |
9325bd8deadSopenharmony_ci                    |  +--------------+                 |
9335bd8deadSopenharmony_ci                    |  |                                |
9345bd8deadSopenharmony_ci        TEXTURE_    o  o                                |
9355bd8deadSopenharmony_ci        SHADER_NV                                       |
9365bd8deadSopenharmony_ci        enable      o                                   | 
9375bd8deadSopenharmony_ci                    |                                   |
9385bd8deadSopenharmony_ci                    +-------------+                     |
9395bd8deadSopenharmony_ci                    |             |                     |
9405bd8deadSopenharmony_ci               Conventional   Register                  |
9415bd8deadSopenharmony_ci                  TexEnv      Combiners                 |
9425bd8deadSopenharmony_ci                    |             |                     |
9435bd8deadSopenharmony_ci                Color Sum         |                     |
9445bd8deadSopenharmony_ci                    |             |                     |
9455bd8deadSopenharmony_ci                   Fog            |                     |
9465bd8deadSopenharmony_ci                    |             |                     |
9475bd8deadSopenharmony_ci                    |  +----------+                     |
9485bd8deadSopenharmony_ci                    |  |                                | 
9495bd8deadSopenharmony_ci        REGISTER_   o  o                                |
9505bd8deadSopenharmony_ci        COMBINERS_                                      |
9515bd8deadSopenharmony_ci        NV enable   o                                   |
9525bd8deadSopenharmony_ci                    |                                   |
9535bd8deadSopenharmony_ci                    +-----------------+  +--------------+
9545bd8deadSopenharmony_ci                                      |  |
9555bd8deadSopenharmony_ci                           FRAGMENT_  o  o
9565bd8deadSopenharmony_ci                           PROGRAM_
9575bd8deadSopenharmony_ci                           NV enable  o
9585bd8deadSopenharmony_ci                                      |
9595bd8deadSopenharmony_ci                                      |
9605bd8deadSopenharmony_ci                                   Coverage 
9615bd8deadSopenharmony_ci                                  Application
9625bd8deadSopenharmony_ci                                      |
9635bd8deadSopenharmony_ci                                      v
9645bd8deadSopenharmony_ci                            to fragment processing
9655bd8deadSopenharmony_ci
9665bd8deadSopenharmony_ci
9675bd8deadSopenharmony_ci    Modify Section 3.3, Points (p.61)
9685bd8deadSopenharmony_ci
9695bd8deadSopenharmony_ci    All fragments produced in rasterizing a non-antialiased point are assigned
9705bd8deadSopenharmony_ci    the same associated data, which are those of the vertex corresponding to
9715bd8deadSopenharmony_ci    the point.  (delete reference to divide by q).
9725bd8deadSopenharmony_ci
9735bd8deadSopenharmony_ci    If anitialiasing is enabled, then ...  The data associated with each
9745bd8deadSopenharmony_ci    fragment are otherwise the data associated with the point being
9755bd8deadSopenharmony_ci    rasterized.  (delete reference to divide by q)
9765bd8deadSopenharmony_ci
9775bd8deadSopenharmony_ci    Modify Section 3.4.1, Basic Line Segment Rasterization (p.66)
9785bd8deadSopenharmony_ci
9795bd8deadSopenharmony_ci    (Note that t=0 at p_a and t=1 at p_b).  The value of an associated datum f
9805bd8deadSopenharmony_ci    from the fragment, whether it be R, G, B, or A (in RGBA mode) or a color
9815bd8deadSopenharmony_ci    index (in color index mode), the s, t, r, or q texture coordinate, or the
9825bd8deadSopenharmony_ci    clip w coordinate (the depth value, window z, must be found using equation
9835bd8deadSopenharmony_ci    3.3, below), is found as
9845bd8deadSopenharmony_ci
9855bd8deadSopenharmony_ci      f = (1-t) * f_a / w_a + t * f_b / w_b                     (3.2)
9865bd8deadSopenharmony_ci          ---------------------------------
9875bd8deadSopenharmony_ci                (1-t) / w_a + t / w_b
9885bd8deadSopenharmony_ci
9895bd8deadSopenharmony_ci    where f_a and f_b are the data associated with the starting and ending
9905bd8deadSopenharmony_ci    endpoints of the segment, respectively; w_a and w_b are the clip
9915bd8deadSopenharmony_ci    w coordinates of the starting and ending endpoints of the segments
9925bd8deadSopenharmony_ci    respectively.  Note that linear interpolation would use
9935bd8deadSopenharmony_ci
9945bd8deadSopenharmony_ci      f = (1-t) * f_a + t * f_b.                                (3.3)
9955bd8deadSopenharmony_ci
9965bd8deadSopenharmony_ci    ... A GL implementation may choose to approximate equation 3.2 with 3.3,
9975bd8deadSopenharmony_ci    but this will normally lead to unacceptable distortion effects when
9985bd8deadSopenharmony_ci    interpolating texture coordinates or clip w coordinates.
9995bd8deadSopenharmony_ci
10005bd8deadSopenharmony_ci    Modify Section 3.5.1, Basic Polygon Rasterization (p.71)
10015bd8deadSopenharmony_ci
10025bd8deadSopenharmony_ci    Denote a datum at p_a, p_b, or p_c ... is given by
10035bd8deadSopenharmony_ci
10045bd8deadSopenharmony_ci      f = a * f_a / w_a + b * f_b / w_b + c * f_c / w_c         (3.4)
10055bd8deadSopenharmony_ci          ---------------------------------------------
10065bd8deadSopenharmony_ci                  a / w_a + b / w_b + c / w_c
10075bd8deadSopenharmony_ci
10085bd8deadSopenharmony_ci    where w_a, w_b, and w_c are the clip w coordinates of p_a, p_b, and p_c,
10095bd8deadSopenharmony_ci    respectively.  a, b, and c are the barycentric coordinates of the fragment
10105bd8deadSopenharmony_ci    for which the data are produced. a, b, and c must correspond precisely to
10115bd8deadSopenharmony_ci    the exact coordinates ... at the fragment's center.
10125bd8deadSopenharmony_ci    
10135bd8deadSopenharmony_ci    Just as with line segment rasterization, equation 3.4 may be approximated
10145bd8deadSopenharmony_ci    by
10155bd8deadSopenharmony_ci    
10165bd8deadSopenharmony_ci      f = a * f_a + b * f_b + c * f_c;                          (3.5)
10175bd8deadSopenharmony_ci
10185bd8deadSopenharmony_ci    this may yield ... for texture coordinates or clip w coordinates.
10195bd8deadSopenharmony_ci
10205bd8deadSopenharmony_ci    Modify Section 3.6.4, Rasterization of Pixel Rectangles (p.100)
10215bd8deadSopenharmony_ci
10225bd8deadSopenharmony_ci    A fragment arising from a group ... are given by those associated with the
10235bd8deadSopenharmony_ci    current raster position.  (delete reference to divide by q)
10245bd8deadSopenharmony_ci      
10255bd8deadSopenharmony_ci    Modify Section 3.7, Bitmaps (p.111)
10265bd8deadSopenharmony_ci
10275bd8deadSopenharmony_ci    Otherwise, a rectangular array ... The associated data for each fragment
10285bd8deadSopenharmony_ci    are those associated with the current raster position.  (delete reference
10295bd8deadSopenharmony_ci    to divide by q)  Once the fragments have been produced ...
10305bd8deadSopenharmony_ci
10315bd8deadSopenharmony_ci    Modify Section 3.8, Texturing (p.112)
10325bd8deadSopenharmony_ci
10335bd8deadSopenharmony_ci    ... an image at the location indicated by a fragment's texture coordinates
10345bd8deadSopenharmony_ci    to modify the fragments primary RGBA color.  Texturing does not affect the
10355bd8deadSopenharmony_ci    secondary color.  
10365bd8deadSopenharmony_ci
10375bd8deadSopenharmony_ci    Texturing is specified only for RGBA mode; its use in color index mode is
10385bd8deadSopenharmony_ci    undefined.
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    Except when in fragment program mode (Section 3.11), the (s,t,r) texture
10415bd8deadSopenharmony_ci    coordinates used for texturing are the values s/q, t/q, and r/q,
10425bd8deadSopenharmony_ci    respectively, where s, t, r, and q are the texture coordinates associated
10435bd8deadSopenharmony_ci    with the fragment.  When in fragment program mode, the (s,t,r) texture
10445bd8deadSopenharmony_ci    coordinates are specified by the program.  If q is less than or equal to
10455bd8deadSopenharmony_ci    zero, the results of texturing are undefined.
10465bd8deadSopenharmony_ci
10475bd8deadSopenharmony_ci    Add new Section 3.11, Fragment Programs (p.140)  
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    Fragment program mode is enabled and disabled with the Enable and Disable
10505bd8deadSopenharmony_ci    commands using the symbolic constant FRAGMENT_PROGRAM_NV.  When fragment
10515bd8deadSopenharmony_ci    program mode is enabled, standard and extended texturing, color sum, and
10525bd8deadSopenharmony_ci    fog application stages are ignored and a general purpose program is
10535bd8deadSopenharmony_ci    executed instead.  
10545bd8deadSopenharmony_ci
10555bd8deadSopenharmony_ci    A fragment program is a sequence of instructions that execute on a
10565bd8deadSopenharmony_ci    per-fragment basis.  In fragment program mode, the currently bound
10575bd8deadSopenharmony_ci    fragment program is executed as each fragment is generated by the
10585bd8deadSopenharmony_ci    rasterization operations.  Fragment programs execute a finite fixed
10595bd8deadSopenharmony_ci    sequence of instructions with no branching or looping, and operate
10605bd8deadSopenharmony_ci    independently from the processing of other fragments.  Fragment programs
10615bd8deadSopenharmony_ci    are used to compute new color values to be associated with each fragment,
10625bd8deadSopenharmony_ci    and can optionally compute a new depth value for each fragment as well.
10635bd8deadSopenharmony_ci
10645bd8deadSopenharmony_ci    Fragment program mode is not available in color index mode and is
10655bd8deadSopenharmony_ci    considered disabled, regardless of the state of FRAGMENT_PROGRAM_NV.  When
10665bd8deadSopenharmony_ci    fragment program mode is enabled, texture shaders and register combiners
10675bd8deadSopenharmony_ci    (NV_texture_shader and NV_register_combiners extension) are disabled,
10685bd8deadSopenharmony_ci    regardless of the state of TEXTURE_SHADER_NV and REGISTER_COMBINERS_NV.
10695bd8deadSopenharmony_ci
10705bd8deadSopenharmony_ci    Section 3.11.1, Fragment Program Registers
10715bd8deadSopenharmony_ci
10725bd8deadSopenharmony_ci    Fragment programs operate on a set of program registers.  Each program
10735bd8deadSopenharmony_ci    register is a 4-component vector, whose components are referred to as "x",
10745bd8deadSopenharmony_ci    "y", "z", and "w" respectively.  The components of a fragment register are
10755bd8deadSopenharmony_ci    always referred to in this manner, regardless of the meaning of their
10765bd8deadSopenharmony_ci    contents.
10775bd8deadSopenharmony_ci
10785bd8deadSopenharmony_ci    The four components of each fragment program register have one of two
10795bd8deadSopenharmony_ci    different representations:  32-bit floating-point (fp32) or 16-bit
10805bd8deadSopenharmony_ci    floating-point (fp16).  More details on these representations can be found
10815bd8deadSopenharmony_ci    in Section 3.11.4.1.
10825bd8deadSopenharmony_ci
10835bd8deadSopenharmony_ci    There are several different classes of program registers.  Attribute
10845bd8deadSopenharmony_ci    registers (Table X.1) correspond to the fragment's associated data
10855bd8deadSopenharmony_ci    produced by rasterization.  Temporary registers (Table X.2) hold
10865bd8deadSopenharmony_ci    intermediate results generated by the fragment program.  Output registers
10875bd8deadSopenharmony_ci    (Table X.3) hold the final results of a fragment program.  The single
10885bd8deadSopenharmony_ci    condition code register is used to mask writes to other registers or to
10895bd8deadSopenharmony_ci    determine if a fragment should be discarded.
10905bd8deadSopenharmony_ci
10915bd8deadSopenharmony_ci
10925bd8deadSopenharmony_ci    Section 3.11.1.1, Fragment Program Attribute Registers
10935bd8deadSopenharmony_ci
10945bd8deadSopenharmony_ci    The fragment program attribute registers (Table X.1) hold the location of
10955bd8deadSopenharmony_ci    the fragment and the data associated with the fragment produced by
10965bd8deadSopenharmony_ci    rasterization.
10975bd8deadSopenharmony_ci
10985bd8deadSopenharmony_ci    Fragment Attribute                                    Component
10995bd8deadSopenharmony_ci    Register Name    Description                          Interpretation
11005bd8deadSopenharmony_ci    --------------   -----------------------------------  --------------
11015bd8deadSopenharmony_ci       f[WPOS]       Position of the fragment center.     (x,y,z,1/w)
11025bd8deadSopenharmony_ci       f[COL0]       Interpolated primary color           (r,g,b,a)
11035bd8deadSopenharmony_ci       f[COL1]       Interpolated secondary color         (r,g,b,a)
11045bd8deadSopenharmony_ci       f[FOGC]       Interpolated fog distance/coord      (z,0,0,0)
11055bd8deadSopenharmony_ci       f[TEX0]       Texture coordinate (unit 0)          (s,t,r,q)
11065bd8deadSopenharmony_ci       f[TEX1]       Texture coordinate (unit 1)          (s,t,r,q)
11075bd8deadSopenharmony_ci       f[TEX2]       Texture coordinate (unit 2)          (s,t,r,q)
11085bd8deadSopenharmony_ci       f[TEX3]       Texture coordinate (unit 3)          (s,t,r,q)
11095bd8deadSopenharmony_ci       f[TEX4]       Texture coordinate (unit 4)          (s,t,r,q)
11105bd8deadSopenharmony_ci       f[TEX5]       Texture coordinate (unit 5)          (s,t,r,q)
11115bd8deadSopenharmony_ci       f[TEX6]       Texture coordinate (unit 6)          (s,t,r,q)
11125bd8deadSopenharmony_ci       f[TEX7]       Texture coordinate (unit 7)          (s,t,r,q)
11135bd8deadSopenharmony_ci
11145bd8deadSopenharmony_ci    Table X.1:  Fragment Attribute Registers.  The component interpretation
11155bd8deadSopenharmony_ci    column describes the mapping of attribute values to register components.
11165bd8deadSopenharmony_ci    For example, the "x" component of f[COL0] holds the red color component,
11175bd8deadSopenharmony_ci    and the "x" component of f[TEX0] holds the "s" texture coordinate for
11185bd8deadSopenharmony_ci    texture unit 0.  The entries "0" and "1" indicate that the attribute
11195bd8deadSopenharmony_ci    register components hold the constants 0 and 1, respectively.
11205bd8deadSopenharmony_ci
11215bd8deadSopenharmony_ci    f[WPOS].x and f[WPOS].y hold the (x,y) window coordinates of the fragment
11225bd8deadSopenharmony_ci    center, and relative to the lower left corner of the window.  f[WPOS].z
11235bd8deadSopenharmony_ci    holds the associated z window coordinate, normally in the range [0,1].
11245bd8deadSopenharmony_ci    f[WPOS].w holds the reciprocal of the associated clip w coordinate.
11255bd8deadSopenharmony_ci
11265bd8deadSopenharmony_ci    f[COL0] and f[COL1] hold the associated RGBA primary and secondary colors
11275bd8deadSopenharmony_ci    of the fragment, respectively.  
11285bd8deadSopenharmony_ci
11295bd8deadSopenharmony_ci    f[FOGC] holds the associated eye distance or fog coordinate normally used
11305bd8deadSopenharmony_ci    for fog computations.
11315bd8deadSopenharmony_ci
11325bd8deadSopenharmony_ci    f[TEX0] through f[TEX7] hold the associated texture coordinates for
11335bd8deadSopenharmony_ci    texture coordinate sets 0 through 7, respectively.
11345bd8deadSopenharmony_ci
11355bd8deadSopenharmony_ci    All attribute register components are treated as 32-bit floats.  However,
11365bd8deadSopenharmony_ci    the components of primary and secondary colors (f[COL0] and f[COL1]) may
11375bd8deadSopenharmony_ci    be generated with reduced precision.
11385bd8deadSopenharmony_ci
11395bd8deadSopenharmony_ci    The contents of the fragment attribute registers may not be modified by a
11405bd8deadSopenharmony_ci    fragment program.  In addition, each fragment program instruction can use
11415bd8deadSopenharmony_ci    at most one unique attribute register.
11425bd8deadSopenharmony_ci
11435bd8deadSopenharmony_ci
11445bd8deadSopenharmony_ci    Section 3.11.1.2, Fragment Program Temporary Registers
11455bd8deadSopenharmony_ci
11465bd8deadSopenharmony_ci    The fragment temporary registers (Table X.2) hold intermediate values used
11475bd8deadSopenharmony_ci    during the execution of a fragment program.  There are 96 temporary
11485bd8deadSopenharmony_ci    register names, but not all can be used simultaneously.
11495bd8deadSopenharmony_ci
11505bd8deadSopenharmony_ci    Fragment Temporary
11515bd8deadSopenharmony_ci    Register Name       Description
11525bd8deadSopenharmony_ci    ------------------  -----------------------------------------------------
11535bd8deadSopenharmony_ci        R0-R31          Four 32-bit (fp32) floating point values (s.e8.m23)
11545bd8deadSopenharmony_ci        H0-H63          Four 16-bit (fp16) floating point values (s.e5.m10)
11555bd8deadSopenharmony_ci
11565bd8deadSopenharmony_ci    Table X.2:  Fragment Temporary Registers.
11575bd8deadSopenharmony_ci
11585bd8deadSopenharmony_ci    In addition to the normal temporary registers, there are two temporary
11595bd8deadSopenharmony_ci    pseudo-registers, "RC" and "HC".  RC and HC are treated as unnumbered,
11605bd8deadSopenharmony_ci    write-only temporary registers.  The components of RC have a fp32 data
11615bd8deadSopenharmony_ci    type; the components of HC have a fp16 data type.  The sole purpose of
11625bd8deadSopenharmony_ci    these registers is to permit instructions to modify the condition code
11635bd8deadSopenharmony_ci    register (section 3.11.1.4) without overwriting the values in any
11645bd8deadSopenharmony_ci    temporary register.
11655bd8deadSopenharmony_ci
11665bd8deadSopenharmony_ci    Fragment program instructions can read and write temporary registers.
11675bd8deadSopenharmony_ci    There is no restriction on the number of temporary registers that can be
11685bd8deadSopenharmony_ci    accessed by any given instruction.
11695bd8deadSopenharmony_ci
11705bd8deadSopenharmony_ci    All temporary registers are initialized to (0,0,0,0) each time a fragment
11715bd8deadSopenharmony_ci    program executes.
11725bd8deadSopenharmony_ci
11735bd8deadSopenharmony_ci
11745bd8deadSopenharmony_ci    Section 3.11.1.3, Fragment Program Output Registers
11755bd8deadSopenharmony_ci
11765bd8deadSopenharmony_ci    The fragment program output registers hold the final results of the
11775bd8deadSopenharmony_ci    fragment program.  The possible final results of a fragment program are a
11785bd8deadSopenharmony_ci    high- or low-precision RGBA fragment color, and a fragment depth value.
11795bd8deadSopenharmony_ci
11805bd8deadSopenharmony_ci       Output
11815bd8deadSopenharmony_ci    Register Name      Description
11825bd8deadSopenharmony_ci    -------------      -------------------------------------------------------
11835bd8deadSopenharmony_ci       o[COLR]         Final RGBA fragment color, fp32 format
11845bd8deadSopenharmony_ci       o[COLH]         Final RGBA fragment color, fp16 format
11855bd8deadSopenharmony_ci       o[DEPR]         Final fragment depth value, fp32 format
11865bd8deadSopenharmony_ci
11875bd8deadSopenharmony_ci    Table X.3:  Fragment Program Output Registers.
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci    o[COLR] and o[COLH] specify the color of a fragment.  These two registers
11905bd8deadSopenharmony_ci    are identical, except for the associated data type of the components.  The
11915bd8deadSopenharmony_ci    R, G, B, and A components of the fragment color are taken from the x, y,
11925bd8deadSopenharmony_ci    z, and w components respectively of the o[COLR] or o[COLH].  A fragment
11935bd8deadSopenharmony_ci    program will fail to load if it writes to both o[COLR] and o[COLH].
11945bd8deadSopenharmony_ci
11955bd8deadSopenharmony_ci    o[DEPR] can be used to replace the associated depth value of a fragment.
11965bd8deadSopenharmony_ci    The new depth value is taken from the z component of o[DEPR].  If a
11975bd8deadSopenharmony_ci    fragment program does not write to o[DEPR], the associated depth value is
11985bd8deadSopenharmony_ci    unmodified.
11995bd8deadSopenharmony_ci
12005bd8deadSopenharmony_ci    A fragment program will fail to load if it does not write to at least one
12015bd8deadSopenharmony_ci    output register.
12025bd8deadSopenharmony_ci
12035bd8deadSopenharmony_ci    The fragment program output registers may not be read by a fragment
12045bd8deadSopenharmony_ci    program, but may be written to multiple times.  
12055bd8deadSopenharmony_ci
12065bd8deadSopenharmony_ci    The values of all fragment program output registers are initially
12075bd8deadSopenharmony_ci    undefined.
12085bd8deadSopenharmony_ci
12095bd8deadSopenharmony_ci
12105bd8deadSopenharmony_ci    Section 3.11.1.4, Fragment Program Condition Code Register
12115bd8deadSopenharmony_ci
12125bd8deadSopenharmony_ci    The condition code register (CC) is a single four-component vector.  Each
12135bd8deadSopenharmony_ci    component of this register is one of four enumerated values:  GT (greater
12145bd8deadSopenharmony_ci    than), EQ (equal), LT (less than), or UN (unordered).  The condition code
12155bd8deadSopenharmony_ci    register can be used to mask writes to fragment data register components
12165bd8deadSopenharmony_ci    or to terminate processing of a fragment altogether (via the KIL
12175bd8deadSopenharmony_ci    instruction).
12185bd8deadSopenharmony_ci
12195bd8deadSopenharmony_ci    Most fragment program instructions can optionally update the condition
12205bd8deadSopenharmony_ci    code register.  When a fragment program instruction updates the condition
12215bd8deadSopenharmony_ci    code register, a condition code component is set to LT if the
12225bd8deadSopenharmony_ci    corresponding component of the result vector is less than zero, EQ if it
12235bd8deadSopenharmony_ci    is equal to zero, GT if it is greater than zero, and UN if it is NaN (not
12245bd8deadSopenharmony_ci    a number).
12255bd8deadSopenharmony_ci
12265bd8deadSopenharmony_ci    The condition code register is initialized to a vector of EQ values each
12275bd8deadSopenharmony_ci    time a fragment program executes.
12285bd8deadSopenharmony_ci
12295bd8deadSopenharmony_ci
12305bd8deadSopenharmony_ci    Section 3.11.2, Fragment Program Parameters
12315bd8deadSopenharmony_ci
12325bd8deadSopenharmony_ci    In addition to using the registers defined in Section 3.11.1, fragment
12335bd8deadSopenharmony_ci    programs may also use fragment program parameters in their computation.
12345bd8deadSopenharmony_ci    Fragment program parameters are constant during the execution of fragment
12355bd8deadSopenharmony_ci    programs, but some parameters may be modified outside the execution of a
12365bd8deadSopenharmony_ci    fragment program.
12375bd8deadSopenharmony_ci
12385bd8deadSopenharmony_ci    There are five different types of program parameters:  embedded scalar
12395bd8deadSopenharmony_ci    constants, embedded vector constants, named constants, named local
12405bd8deadSopenharmony_ci    parameters, and numbered local parameters.
12415bd8deadSopenharmony_ci
12425bd8deadSopenharmony_ci    Embedded scalar constants are written as standard floating-point numbers
12435bd8deadSopenharmony_ci    with an optional sign designator ("+" or "-") and optional scientific
12445bd8deadSopenharmony_ci    notation (e.g., "E+06", meaning "times 10^6").
12455bd8deadSopenharmony_ci 
12465bd8deadSopenharmony_ci    Embedded vector constants are written as a comma-separated array of one to
12475bd8deadSopenharmony_ci    four scalar constants, surrounded by braces (like a C/C++ array
12485bd8deadSopenharmony_ci    initializer).  Vector constants are always treated as 4-component vectors:
12495bd8deadSopenharmony_ci    constants with fewer than four components are expanded to 4-components by
12505bd8deadSopenharmony_ci    filling missing y and z components with 0.0 and missing w components with
12515bd8deadSopenharmony_ci    1.0.  Thus, the vector constant "{2}" is equivalent to "{2,0,0,1}",
12525bd8deadSopenharmony_ci    "{3,4}" is equivalent to "{3,4,0,1}", and "{5,6,7}" is equivalent to
12535bd8deadSopenharmony_ci    "{5,6,7,1}".
12545bd8deadSopenharmony_ci
12555bd8deadSopenharmony_ci    Named constants allow fragment program instructions to define scalar or
12565bd8deadSopenharmony_ci    vector constants that can be referenced by name.  Named constants are
12575bd8deadSopenharmony_ci    created using the DEFINE instruction:
12585bd8deadSopenharmony_ci
12595bd8deadSopenharmony_ci        DEFINE pi = 3.1415926535;
12605bd8deadSopenharmony_ci        DEFINE color = {0.2, 0.5, 0.8, 1.0};
12615bd8deadSopenharmony_ci
12625bd8deadSopenharmony_ci    The DEFINE instruction associates a constant name with a scalar or vector
12635bd8deadSopenharmony_ci    constant value.  Subsequent fragment program instructions that use the
12645bd8deadSopenharmony_ci    constant name are equivalent to those using the corresponding constant
12655bd8deadSopenharmony_ci    value.
12665bd8deadSopenharmony_ci
12675bd8deadSopenharmony_ci    Named local parameters are similar to named vector constants, but their
12685bd8deadSopenharmony_ci    values can be modified after the program is loaded.  Local parameters are
12695bd8deadSopenharmony_ci    created using the DECLARE instruction:
12705bd8deadSopenharmony_ci
12715bd8deadSopenharmony_ci        DECLARE fog_color1;
12725bd8deadSopenharmony_ci        DECLARE fog_color2 = {0.3, 0.6, 0.9, 0.1};
12735bd8deadSopenharmony_ci
12745bd8deadSopenharmony_ci    The DECLARE instruction creates a 4-component vector associated with the
12755bd8deadSopenharmony_ci    local parameter name.  Subsequent fragment program instructions
12765bd8deadSopenharmony_ci    referencing the local parameter name are processed as though the current
12775bd8deadSopenharmony_ci    value of the local parameter vector were specified instead of the
12785bd8deadSopenharmony_ci    parameter name.  A DECLARE instruction can optionally specify an initial
12795bd8deadSopenharmony_ci    value for the local parameter, which can be either a scalar or vector
12805bd8deadSopenharmony_ci    constant.  Scalar constants are expanded to 4-component vectors by
12815bd8deadSopenharmony_ci    replicating the scalar value in each component.  The initial value of
12825bd8deadSopenharmony_ci    local parameters not initialized by the program is (0,0,0,0).
12835bd8deadSopenharmony_ci
12845bd8deadSopenharmony_ci    A named local parameter for a specific program can be updated using the
12855bd8deadSopenharmony_ci    calls ProgramNamedParameter4fNV or ProgramNamedParameter4fvNV (section
12865bd8deadSopenharmony_ci    5.7).  Named local parameters are accessible only by the program in which
12875bd8deadSopenharmony_ci    they are defined.  Modifying a local parameter affects the only the
12885bd8deadSopenharmony_ci    associated program and does not affect local parameters with the same name
12895bd8deadSopenharmony_ci    that are found in any other fragment program.
12905bd8deadSopenharmony_ci
12915bd8deadSopenharmony_ci    Numbered local parameters are similar to named local parameters, except
12925bd8deadSopenharmony_ci    that they are referred to by number and are not declared in fragment
12935bd8deadSopenharmony_ci    programs.  Each fragment program object has an array of four-component
12945bd8deadSopenharmony_ci    floating-point vectors that can be used by the program.  The number of
12955bd8deadSopenharmony_ci    vectors is given by the implementation-dependent constant
12965bd8deadSopenharmony_ci    MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV, and must be at least 64.  A
12975bd8deadSopenharmony_ci    numbered local parameter is accessed by a fragment program as members of
12985bd8deadSopenharmony_ci    an array called "p".  For example, the instruction
12995bd8deadSopenharmony_ci
13005bd8deadSopenharmony_ci        MOV R0, p[31];
13015bd8deadSopenharmony_ci
13025bd8deadSopenharmony_ci    copies the contents of numbered local parameter 31 into temporary register
13035bd8deadSopenharmony_ci    R0.
13045bd8deadSopenharmony_ci
13055bd8deadSopenharmony_ci    Constant and local parameter names can be arbitrary strings consisting of
13065bd8deadSopenharmony_ci    letters (upper or lower-case), numbers, underscores ("_"), and dollar
13075bd8deadSopenharmony_ci    signs ("$").  Keywords defined in the grammar (including instruction
13085bd8deadSopenharmony_ci    names) can not be used as constant names, nor can strings that start with
13095bd8deadSopenharmony_ci    numbers, or strings that specify valid temporary register or texture
13105bd8deadSopenharmony_ci    numbers (e.g., "R0"-"R31", "H0"-"H63"", "TEX0"-"TEX15").  A fragment
13115bd8deadSopenharmony_ci    program will fail to load if a DEFINE or DECLARE instruction specifies an
13125bd8deadSopenharmony_ci    invalid constant or local parameter name.
13135bd8deadSopenharmony_ci
13145bd8deadSopenharmony_ci    A fragment program will fail to load if an instruction contains a named
13155bd8deadSopenharmony_ci    parameter not specified in a previous DEFINE or DECLARE instruction.  A
13165bd8deadSopenharmony_ci    fragment program will also fail to load if a DEFINE or DECLARE instruction
13175bd8deadSopenharmony_ci    attempts to re-define a named parameter specified in a previous DEFINE or
13185bd8deadSopenharmony_ci    DECLARE instruction.
13195bd8deadSopenharmony_ci
13205bd8deadSopenharmony_ci    The contents of the fragment program parameters may not be modified by a
13215bd8deadSopenharmony_ci    fragment program.  In addition, each fragment program instruction can
13225bd8deadSopenharmony_ci    normally use at most one unique program parameter.  The only exception to
13235bd8deadSopenharmony_ci    this rule is if all program parameter references specify named or embedded
13245bd8deadSopenharmony_ci    constants that taken together contain no more than four unique scalar
13255bd8deadSopenharmony_ci    values.  For such instructions, the GL will automatically generate an
13265bd8deadSopenharmony_ci    equivalent instruction that references a single merged vector constant.
13275bd8deadSopenharmony_ci    This merging allows programs to specify instructions like the following:
13285bd8deadSopenharmony_ci
13295bd8deadSopenharmony_ci        Instruction              Equivalent Instruction
13305bd8deadSopenharmony_ci        ---------------------    ---------------------------------------
13315bd8deadSopenharmony_ci        MAD R0, R1, 2, -1;       MAD R0, R1, {2,-1,0,0}.x, {2,-1,0,0}.y;
13325bd8deadSopenharmony_ci        ADD R0, {1,2,3,4}, 4;    ADD R0, {1,2,3,4}.xyzw, {1,2,3,4}.w;
13335bd8deadSopenharmony_ci
13345bd8deadSopenharmony_ci    Before counting the number of unique values, any named constants are first
13355bd8deadSopenharmony_ci    converted to the equivalent embedded constants.  When generating a
13365bd8deadSopenharmony_ci    combined vector constant, the GL does not perform swizzling, component
13375bd8deadSopenharmony_ci    selection, negation, or absolute value operations.  The following
13385bd8deadSopenharmony_ci    instructions are invalid, as they contain more than four unique scalar
13395bd8deadSopenharmony_ci    values.
13405bd8deadSopenharmony_ci
13415bd8deadSopenharmony_ci        Invalid Instructions
13425bd8deadSopenharmony_ci        -----------------------------------
13435bd8deadSopenharmony_ci        ADD R0, {1,2,3,4}, -4;
13445bd8deadSopenharmony_ci        ADD R0, {1,2,3,4}, |-4|;
13455bd8deadSopenharmony_ci        ADD R0, {1,2,3,4}, -{-1,-2,-3,-4};
13465bd8deadSopenharmony_ci        ADD R0, {1,2,3,4}, {4,5,6,7}.x;
13475bd8deadSopenharmony_ci
13485bd8deadSopenharmony_ci
13495bd8deadSopenharmony_ci    Section 3.11.3, Fragment Program Specification
13505bd8deadSopenharmony_ci
13515bd8deadSopenharmony_ci    Fragment programs are specified as an array of ubytes.  The array is a
13525bd8deadSopenharmony_ci    string of ASCII characters encoding the program.  The command
13535bd8deadSopenharmony_ci    LoadProgramNV loads a fragment program when the target parameter is
13545bd8deadSopenharmony_ci    FRAGMENT_PROGRAM_NV.  The command BindProgramNV enables a fragment program
13555bd8deadSopenharmony_ci    for execution.
13565bd8deadSopenharmony_ci
13575bd8deadSopenharmony_ci    At program load time, the program is parsed into a set of tokens possibly
13585bd8deadSopenharmony_ci    separated by white space.  Spaces, tabs, newlines, carriage returns, and
13595bd8deadSopenharmony_ci    comments are considered whitespace.  Comments begin with the character "#"
13605bd8deadSopenharmony_ci    and are terminated by a newline, a carriage return, or the end of the
13615bd8deadSopenharmony_ci    program array.  Fragment programs are case-sensitive -- upper and lower
13625bd8deadSopenharmony_ci    case letters are treated differently.  The proper choice of case can be
13635bd8deadSopenharmony_ci    inferred from the grammar.
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci    The Backus-Naur Form (BNF) grammar below specifies the syntactically valid
13665bd8deadSopenharmony_ci    sequences for fragment programs.  The set of valid tokens can be inferred
13675bd8deadSopenharmony_ci    from the grammar.  The token "" represents an empty string and is used to
13685bd8deadSopenharmony_ci    indicate optional rules.  A program is invalid if it contains any
13695bd8deadSopenharmony_ci    undefined tokens or characters.
13705bd8deadSopenharmony_ci
13715bd8deadSopenharmony_ci    <program>              ::= <progPrefix> <instructionSequence> "END"
13725bd8deadSopenharmony_ci
13735bd8deadSopenharmony_ci    <progPrefix>           ::= "!!FP1.0"
13745bd8deadSopenharmony_ci
13755bd8deadSopenharmony_ci    <instructionSequence>  ::= <instructionSequence> <instructionStatement>
13765bd8deadSopenharmony_ci                             | <instructionStatement>
13775bd8deadSopenharmony_ci
13785bd8deadSopenharmony_ci    <instructionStatement> ::= <instruction> ";" 
13795bd8deadSopenharmony_ci                             | <constantDefinition> ";"
13805bd8deadSopenharmony_ci                             | <localDeclaration> ";"
13815bd8deadSopenharmony_ci
13825bd8deadSopenharmony_ci    <instruction>          ::= <VECTORop-instruction>
13835bd8deadSopenharmony_ci                             | <SCALARop-instruction>
13845bd8deadSopenharmony_ci                             | <BINSCop-instruction>
13855bd8deadSopenharmony_ci                             | <BINop-instruction>
13865bd8deadSopenharmony_ci                             | <TRIop-instruction>
13875bd8deadSopenharmony_ci                             | <KILop-instruction>
13885bd8deadSopenharmony_ci                             | <TEXop-instruction>
13895bd8deadSopenharmony_ci                             | <TXDop-instruction>
13905bd8deadSopenharmony_ci
13915bd8deadSopenharmony_ci    <VECTORop-instruction> ::= <VECTORop> <maskedDstReg> "," 
13925bd8deadSopenharmony_ci                               <vectorSrc>
13935bd8deadSopenharmony_ci
13945bd8deadSopenharmony_ci    <VECTORop>             ::= "DDX"   | "DDX_SAT"
13955bd8deadSopenharmony_ci                             | "DDXR"  | "DDXR_SAT"
13965bd8deadSopenharmony_ci                             | "DDXH"  | "DDXH_SAT"
13975bd8deadSopenharmony_ci                             | "DDXC"  | "DDXC_SAT"
13985bd8deadSopenharmony_ci                             | "DDXRC" | "DDXRC_SAT"
13995bd8deadSopenharmony_ci                             | "DDXHC" | "DDXHC_SAT"
14005bd8deadSopenharmony_ci                             | "DDY"   | "DDY_SAT"
14015bd8deadSopenharmony_ci                             | "DDYR"  | "DDYR_SAT"
14025bd8deadSopenharmony_ci                             | "DDYH"  | "DDYH_SAT"
14035bd8deadSopenharmony_ci                             | "DDYC"  | "DDYC_SAT"
14045bd8deadSopenharmony_ci                             | "DDYRC" | "DDYRC_SAT"
14055bd8deadSopenharmony_ci                             | "DDYHC" | "DDYHC_SAT"
14065bd8deadSopenharmony_ci                             | "FLR"   | "FLR_SAT"
14075bd8deadSopenharmony_ci                             | "FLRR"  | "FLRR_SAT"
14085bd8deadSopenharmony_ci                             | "FLRH"  | "FLRH_SAT"
14095bd8deadSopenharmony_ci                             | "FLRX"  | "FLRX_SAT"
14105bd8deadSopenharmony_ci                             | "FLRC"  | "FLRC_SAT"
14115bd8deadSopenharmony_ci                             | "FLRRC" | "FLRRC_SAT"
14125bd8deadSopenharmony_ci                             | "FLRHC" | "FLRHC_SAT"
14135bd8deadSopenharmony_ci                             | "FLRXC" | "FLRXC_SAT"
14145bd8deadSopenharmony_ci                             | "FRC"   | "FRC_SAT"
14155bd8deadSopenharmony_ci                             | "FRCR"  | "FRCR_SAT"
14165bd8deadSopenharmony_ci                             | "FRCH"  | "FRCH_SAT"
14175bd8deadSopenharmony_ci                             | "FRCX"  | "FRCX_SAT"
14185bd8deadSopenharmony_ci                             | "FRCC"  | "FRCC_SAT"
14195bd8deadSopenharmony_ci                             | "FRCRC" | "FRCRC_SAT"
14205bd8deadSopenharmony_ci                             | "FRCHC" | "FRCHC_SAT"
14215bd8deadSopenharmony_ci                             | "FRCXC" | "FRCXC_SAT"
14225bd8deadSopenharmony_ci                             | "LIT"   | "LIT_SAT"
14235bd8deadSopenharmony_ci                             | "LITR"  | "LITR_SAT"
14245bd8deadSopenharmony_ci                             | "LITH"  | "LITH_SAT"
14255bd8deadSopenharmony_ci                             | "LITC"  | "LITC_SAT"
14265bd8deadSopenharmony_ci                             | "LITRC" | "LITRC_SAT"
14275bd8deadSopenharmony_ci                             | "LITHC" | "LITHC_SAT"
14285bd8deadSopenharmony_ci                             | "MOV"   | "MOV_SAT"
14295bd8deadSopenharmony_ci                             | "MOVR"  | "MOVR_SAT"
14305bd8deadSopenharmony_ci                             | "MOVH"  | "MOVH_SAT"
14315bd8deadSopenharmony_ci                             | "MOVX"  | "MOVX_SAT"
14325bd8deadSopenharmony_ci                             | "MOVC"  | "MOVC_SAT"
14335bd8deadSopenharmony_ci                             | "MOVRC" | "MOVRC_SAT"
14345bd8deadSopenharmony_ci                             | "MOVHC" | "MOVHC_SAT"
14355bd8deadSopenharmony_ci                             | "MOVXC" | "MOVXC_SAT"
14365bd8deadSopenharmony_ci                             | "PK2H"
14375bd8deadSopenharmony_ci                             | "PK2US"  
14385bd8deadSopenharmony_ci                             | "PK4B"  
14395bd8deadSopenharmony_ci                             | "PK4UB"
14405bd8deadSopenharmony_ci
14415bd8deadSopenharmony_ci    <SCALARop-instruction> ::= <SCALARop> <maskedDstReg> "," 
14425bd8deadSopenharmony_ci                               <scalarSrc>
14435bd8deadSopenharmony_ci
14445bd8deadSopenharmony_ci    <SCALARop>             ::= "COS"     | "COS_SAT"
14455bd8deadSopenharmony_ci                             | "COSR"    | "COSR_SAT"
14465bd8deadSopenharmony_ci                             | "COSH"    | "COSH_SAT"
14475bd8deadSopenharmony_ci                             | "COSC"    | "COSC_SAT"
14485bd8deadSopenharmony_ci                             | "COSRC"   | "COSRC_SAT"
14495bd8deadSopenharmony_ci                             | "COSHC"   | "COSHC_SAT"
14505bd8deadSopenharmony_ci                             | "EX2"     | "EX2_SAT"
14515bd8deadSopenharmony_ci                             | "EX2R"    | "EX2R_SAT"
14525bd8deadSopenharmony_ci                             | "EX2H"    | "EX2H_SAT"
14535bd8deadSopenharmony_ci                             | "EX2C"    | "EX2C_SAT"
14545bd8deadSopenharmony_ci                             | "EX2RC"   | "EX2RC_SAT"
14555bd8deadSopenharmony_ci                             | "EX2HC"   | "EX2HC_SAT"
14565bd8deadSopenharmony_ci                             | "LG2"     | "LG2_SAT"
14575bd8deadSopenharmony_ci                             | "LG2R"    | "LG2R_SAT"
14585bd8deadSopenharmony_ci                             | "LG2H"    | "LG2H_SAT"
14595bd8deadSopenharmony_ci                             | "LG2C"    | "LG2C_SAT"
14605bd8deadSopenharmony_ci                             | "LG2RC"   | "LG2RC_SAT"
14615bd8deadSopenharmony_ci                             | "LG2HC"   | "LG2HC_SAT"
14625bd8deadSopenharmony_ci                             | "RCP"     | "RCP_SAT"
14635bd8deadSopenharmony_ci                             | "RCPR"    | "RCPR_SAT"
14645bd8deadSopenharmony_ci                             | "RCPH"    | "RCPH_SAT"
14655bd8deadSopenharmony_ci                             | "RCPC"    | "RCPC_SAT"
14665bd8deadSopenharmony_ci                             | "RCPRC"   | "RCPRC_SAT"
14675bd8deadSopenharmony_ci                             | "RCPHC"   | "RCPHC_SAT"
14685bd8deadSopenharmony_ci                             | "RSQ"     | "RSQ_SAT"
14695bd8deadSopenharmony_ci                             | "RSQR"    | "RSQR_SAT"
14705bd8deadSopenharmony_ci                             | "RSQH"    | "RSQH_SAT"
14715bd8deadSopenharmony_ci                             | "RSQC"    | "RSQC_SAT"
14725bd8deadSopenharmony_ci                             | "RSQRC"   | "RSQRC_SAT"
14735bd8deadSopenharmony_ci                             | "RSQHC"   | "RSQHC_SAT"
14745bd8deadSopenharmony_ci                             | "SIN"     | "SIN_SAT"
14755bd8deadSopenharmony_ci                             | "SINR"    | "SINR_SAT"
14765bd8deadSopenharmony_ci                             | "SINH"    | "SINH_SAT"
14775bd8deadSopenharmony_ci                             | "SINC"    | "SINC_SAT"
14785bd8deadSopenharmony_ci                             | "SINRC"   | "SINRC_SAT"
14795bd8deadSopenharmony_ci                             | "SINHC"   | "SINHC_SAT"
14805bd8deadSopenharmony_ci                             | "UP2H"    | "UP2H_SAT"
14815bd8deadSopenharmony_ci                             | "UP2HC"   | "UP2HC_SAT"
14825bd8deadSopenharmony_ci                             | "UP2US"   | "UP2US_SAT"
14835bd8deadSopenharmony_ci                             | "UP2USC"  | "UP2USC_SAT"
14845bd8deadSopenharmony_ci                             | "UP4B"    | "UP4B_SAT"
14855bd8deadSopenharmony_ci                             | "UP4BC"   | "UP4BC_SAT"
14865bd8deadSopenharmony_ci                             | "UP4UB"   | "UP4UB_SAT"
14875bd8deadSopenharmony_ci                             | "UP4UBC"  | "UP4UBC_SAT"
14885bd8deadSopenharmony_ci
14895bd8deadSopenharmony_ci    <BINSCop-instruction> ::=  <BINSCop> <maskedDstReg> "," 
14905bd8deadSopenharmony_ci                               <scalarSrc> "," <scalarSrc>
14915bd8deadSopenharmony_ci
14925bd8deadSopenharmony_ci    <BINSCop>              ::= "POW"   | "POW_SAT"
14935bd8deadSopenharmony_ci                             | "POWR"  | "POWR_SAT"
14945bd8deadSopenharmony_ci                             | "POWH"  | "POWH_SAT"
14955bd8deadSopenharmony_ci                             | "POWC"  | "POWC_SAT"
14965bd8deadSopenharmony_ci                             | "POWRC" | "POWRC_SAT"
14975bd8deadSopenharmony_ci                             | "POWHC" | "POWHC_SAT"
14985bd8deadSopenharmony_ci
14995bd8deadSopenharmony_ci    <BINop-instruction>    ::= <BINop> <maskedDstReg> ","
15005bd8deadSopenharmony_ci                               <vectorSrc> "," <vectorSrc>
15015bd8deadSopenharmony_ci
15025bd8deadSopenharmony_ci    <BINop>                ::= "ADD"   | "ADD_SAT"
15035bd8deadSopenharmony_ci                             | "ADDR"  | "ADDR_SAT"
15045bd8deadSopenharmony_ci                             | "ADDH"  | "ADDH_SAT"
15055bd8deadSopenharmony_ci                             | "ADDX"  | "ADDX_SAT"
15065bd8deadSopenharmony_ci                             | "ADDC"  | "ADDC_SAT"
15075bd8deadSopenharmony_ci                             | "ADDRC" | "ADDRC_SAT"
15085bd8deadSopenharmony_ci                             | "ADDHC" | "ADDHC_SAT"
15095bd8deadSopenharmony_ci                             | "ADDXC" | "ADDXC_SAT"
15105bd8deadSopenharmony_ci                             | "DP3"   | "DP3_SAT"
15115bd8deadSopenharmony_ci                             | "DP3R"  | "DP3R_SAT"
15125bd8deadSopenharmony_ci                             | "DP3H"  | "DP3H_SAT"
15135bd8deadSopenharmony_ci                             | "DP3X"  | "DP3X_SAT"
15145bd8deadSopenharmony_ci                             | "DP3C"  | "DP3C_SAT"
15155bd8deadSopenharmony_ci                             | "DP3RC" | "DP3RC_SAT"
15165bd8deadSopenharmony_ci                             | "DP3HC" | "DP3HC_SAT"
15175bd8deadSopenharmony_ci                             | "DP3XC" | "DP3XC_SAT"
15185bd8deadSopenharmony_ci                             | "DP4"   | "DP4_SAT"
15195bd8deadSopenharmony_ci                             | "DP4R"  | "DP4R_SAT"
15205bd8deadSopenharmony_ci                             | "DP4H"  | "DP4H_SAT"
15215bd8deadSopenharmony_ci                             | "DP4X"  | "DP4X_SAT"
15225bd8deadSopenharmony_ci                             | "DP4C"  | "DP4C_SAT"
15235bd8deadSopenharmony_ci                             | "DP4RC" | "DP4RC_SAT"
15245bd8deadSopenharmony_ci                             | "DP4HC" | "DP4HC_SAT"
15255bd8deadSopenharmony_ci                             | "DP4XC" | "DP4XC_SAT"
15265bd8deadSopenharmony_ci                             | "DST"   | "DST_SAT"
15275bd8deadSopenharmony_ci                             | "DSTR"  | "DSTR_SAT"
15285bd8deadSopenharmony_ci                             | "DSTH"  | "DSTH_SAT"
15295bd8deadSopenharmony_ci                             | "DSTC"  | "DSTC_SAT"
15305bd8deadSopenharmony_ci                             | "DSTRC" | "DSTRC_SAT"
15315bd8deadSopenharmony_ci                             | "DSTHC" | "DSTHC_SAT"
15325bd8deadSopenharmony_ci                             | "MAX"   | "MAX_SAT"
15335bd8deadSopenharmony_ci                             | "MAXR"  | "MAXR_SAT"
15345bd8deadSopenharmony_ci                             | "MAXH"  | "MAXH_SAT"
15355bd8deadSopenharmony_ci                             | "MAXX"  | "MAXX_SAT"
15365bd8deadSopenharmony_ci                             | "MAXC"  | "MAXC_SAT"
15375bd8deadSopenharmony_ci                             | "MAXRC" | "MAXRC_SAT"
15385bd8deadSopenharmony_ci                             | "MAXHC" | "MAXHC_SAT"
15395bd8deadSopenharmony_ci                             | "MAXXC" | "MAXXC_SAT"
15405bd8deadSopenharmony_ci                             | "MIN"   | "MIN_SAT"
15415bd8deadSopenharmony_ci                             | "MINR"  | "MINR_SAT"
15425bd8deadSopenharmony_ci                             | "MINH"  | "MINH_SAT"
15435bd8deadSopenharmony_ci                             | "MINX"  | "MINX_SAT"
15445bd8deadSopenharmony_ci                             | "MINC"  | "MINC_SAT"
15455bd8deadSopenharmony_ci                             | "MINRC" | "MINRC_SAT"
15465bd8deadSopenharmony_ci                             | "MINHC" | "MINHC_SAT"
15475bd8deadSopenharmony_ci                             | "MINXC" | "MINXC_SAT"
15485bd8deadSopenharmony_ci                             | "MUL"   | "MUL_SAT"
15495bd8deadSopenharmony_ci                             | "MULR"  | "MULR_SAT"
15505bd8deadSopenharmony_ci                             | "MULH"  | "MULH_SAT"
15515bd8deadSopenharmony_ci                             | "MULX"  | "MULX_SAT"
15525bd8deadSopenharmony_ci                             | "MULC"  | "MULC_SAT"
15535bd8deadSopenharmony_ci                             | "MULRC" | "MULRC_SAT"
15545bd8deadSopenharmony_ci                             | "MULHC" | "MULHC_SAT"
15555bd8deadSopenharmony_ci                             | "MULXC" | "MULXC_SAT"
15565bd8deadSopenharmony_ci                             | "RFL"   | "RFL_SAT"
15575bd8deadSopenharmony_ci                             | "RFLR"  | "RFLR_SAT"
15585bd8deadSopenharmony_ci                             | "RFLH"  | "RFLH_SAT"
15595bd8deadSopenharmony_ci                             | "RFLC"  | "RFLC_SAT"
15605bd8deadSopenharmony_ci                             | "RFLRC" | "RFLRC_SAT"
15615bd8deadSopenharmony_ci                             | "RFLHC" | "RFLHC_SAT"
15625bd8deadSopenharmony_ci                             | "SEQ"   | "SEQ_SAT"
15635bd8deadSopenharmony_ci                             | "SEQR"  | "SEQR_SAT"
15645bd8deadSopenharmony_ci                             | "SEQH"  | "SEQH_SAT"
15655bd8deadSopenharmony_ci                             | "SEQX"  | "SEQX_SAT"
15665bd8deadSopenharmony_ci                             | "SEQC"  | "SEQC_SAT"
15675bd8deadSopenharmony_ci                             | "SEQRC" | "SEQRC_SAT"
15685bd8deadSopenharmony_ci                             | "SEQHC" | "SEQHC_SAT"
15695bd8deadSopenharmony_ci                             | "SEQXC" | "SEQXC_SAT"
15705bd8deadSopenharmony_ci                             | "SFL"   | "SFL_SAT"
15715bd8deadSopenharmony_ci                             | "SFLR"  | "SFLR_SAT"
15725bd8deadSopenharmony_ci                             | "SFLH"  | "SFLH_SAT"
15735bd8deadSopenharmony_ci                             | "SFLX"  | "SFLX_SAT"
15745bd8deadSopenharmony_ci                             | "SFLC"  | "SFLC_SAT"
15755bd8deadSopenharmony_ci                             | "SFLRC" | "SFLRC_SAT"
15765bd8deadSopenharmony_ci                             | "SFLHC" | "SFLHC_SAT"
15775bd8deadSopenharmony_ci                             | "SFLXC" | "SFLXC_SAT"
15785bd8deadSopenharmony_ci                             | "SGE"   | "SGE_SAT"
15795bd8deadSopenharmony_ci                             | "SGER"  | "SGER_SAT"
15805bd8deadSopenharmony_ci                             | "SGEH"  | "SGEH_SAT"
15815bd8deadSopenharmony_ci                             | "SGEX"  | "SGEX_SAT"
15825bd8deadSopenharmony_ci                             | "SGEC"  | "SGEC_SAT"
15835bd8deadSopenharmony_ci                             | "SGERC" | "SGERC_SAT"
15845bd8deadSopenharmony_ci                             | "SGEHC" | "SGEHC_SAT"
15855bd8deadSopenharmony_ci                             | "SGEXC" | "SGEXC_SAT"
15865bd8deadSopenharmony_ci                             | "SGT"   | "SGT_SAT"
15875bd8deadSopenharmony_ci                             | "SGTR"  | "SGTR_SAT"
15885bd8deadSopenharmony_ci                             | "SGTH"  | "SGTH_SAT"
15895bd8deadSopenharmony_ci                             | "SGTX"  | "SGTX_SAT"
15905bd8deadSopenharmony_ci                             | "SGTC"  | "SGTC_SAT"
15915bd8deadSopenharmony_ci                             | "SGTRC" | "SGTRC_SAT"
15925bd8deadSopenharmony_ci                             | "SGTHC" | "SGTHC_SAT"
15935bd8deadSopenharmony_ci                             | "SGTXC" | "SGTXC_SAT"
15945bd8deadSopenharmony_ci                             | "SLE"   | "SLE_SAT"
15955bd8deadSopenharmony_ci                             | "SLER"  | "SLER_SAT"
15965bd8deadSopenharmony_ci                             | "SLEH"  | "SLEH_SAT"
15975bd8deadSopenharmony_ci                             | "SLEX"  | "SLEX_SAT"
15985bd8deadSopenharmony_ci                             | "SLEC"  | "SLEC_SAT"
15995bd8deadSopenharmony_ci                             | "SLERC" | "SLERC_SAT"
16005bd8deadSopenharmony_ci                             | "SLEHC" | "SLEHC_SAT"
16015bd8deadSopenharmony_ci                             | "SLEXC" | "SLEXC_SAT"
16025bd8deadSopenharmony_ci                             | "SLT"   | "SLT_SAT"
16035bd8deadSopenharmony_ci                             | "SLTR"  | "SLTR_SAT"
16045bd8deadSopenharmony_ci                             | "SLTH"  | "SLTH_SAT"
16055bd8deadSopenharmony_ci                             | "SLTX"  | "SLTX_SAT"
16065bd8deadSopenharmony_ci                             | "SLTC"  | "SLTC_SAT"
16075bd8deadSopenharmony_ci                             | "SLTRC" | "SLTRC_SAT"
16085bd8deadSopenharmony_ci                             | "SLTHC" | "SLTHC_SAT"
16095bd8deadSopenharmony_ci                             | "SLTXC" | "SLTXC_SAT"
16105bd8deadSopenharmony_ci                             | "SNE"   | "SNE_SAT"
16115bd8deadSopenharmony_ci                             | "SNER"  | "SNER_SAT"
16125bd8deadSopenharmony_ci                             | "SNEH"  | "SNEH_SAT"
16135bd8deadSopenharmony_ci                             | "SNEX"  | "SNEX_SAT"
16145bd8deadSopenharmony_ci                             | "SNEC"  | "SNEC_SAT"
16155bd8deadSopenharmony_ci                             | "SNERC" | "SNERC_SAT"
16165bd8deadSopenharmony_ci                             | "SNEHC" | "SNEHC_SAT"
16175bd8deadSopenharmony_ci                             | "SNEXC" | "SNEXC_SAT"
16185bd8deadSopenharmony_ci                             | "STR"   | "STR_SAT"
16195bd8deadSopenharmony_ci                             | "STRR"  | "STRR_SAT"
16205bd8deadSopenharmony_ci                             | "STRH"  | "STRH_SAT"
16215bd8deadSopenharmony_ci                             | "STRX"  | "STRX_SAT"
16225bd8deadSopenharmony_ci                             | "STRC"  | "STRC_SAT"
16235bd8deadSopenharmony_ci                             | "STRRC" | "STRRC_SAT"
16245bd8deadSopenharmony_ci                             | "STRHC" | "STRHC_SAT"
16255bd8deadSopenharmony_ci                             | "STRXC" | "STRXC_SAT"
16265bd8deadSopenharmony_ci                             | "SUB"   | "SUB_SAT"
16275bd8deadSopenharmony_ci                             | "SUBR"  | "SUBR_SAT"
16285bd8deadSopenharmony_ci                             | "SUBH"  | "SUBH_SAT"
16295bd8deadSopenharmony_ci                             | "SUBX"  | "SUBX_SAT"
16305bd8deadSopenharmony_ci                             | "SUBC"  | "SUBC_SAT"
16315bd8deadSopenharmony_ci                             | "SUBRC" | "SUBRC_SAT"
16325bd8deadSopenharmony_ci                             | "SUBHC" | "SUBHC_SAT"
16335bd8deadSopenharmony_ci                             | "SUBXC" | "SUBXC_SAT"
16345bd8deadSopenharmony_ci
16355bd8deadSopenharmony_ci    <TRIop-instruction>    ::= <TRIop> <maskedDstReg> ","
16365bd8deadSopenharmony_ci                               <vectorSrc> "," <vectorSrc> ","
16375bd8deadSopenharmony_ci                               <vectorSrc>
16385bd8deadSopenharmony_ci
16395bd8deadSopenharmony_ci    <TRIop>                ::= "MAD"   | "MAD_SAT"
16405bd8deadSopenharmony_ci                             | "MADR"  | "MADR_SAT"
16415bd8deadSopenharmony_ci                             | "MADH"  | "MADH_SAT"
16425bd8deadSopenharmony_ci                             | "MADX"  | "MADX_SAT"
16435bd8deadSopenharmony_ci                             | "MADC"  | "MADC_SAT"
16445bd8deadSopenharmony_ci                             | "MADRC" | "MADRC_SAT"
16455bd8deadSopenharmony_ci                             | "MADHC" | "MADHC_SAT"
16465bd8deadSopenharmony_ci                             | "MADXC" | "MADXC_SAT"
16475bd8deadSopenharmony_ci                             | "LRP"   | "LRP_SAT"
16485bd8deadSopenharmony_ci                             | "LRPR"  | "LRPR_SAT"
16495bd8deadSopenharmony_ci                             | "LRPH"  | "LRPH_SAT"
16505bd8deadSopenharmony_ci                             | "LRPX"  | "LRPX_SAT"
16515bd8deadSopenharmony_ci                             | "LRPC"  | "LRPC_SAT"
16525bd8deadSopenharmony_ci                             | "LRPRC" | "LRPRC_SAT"
16535bd8deadSopenharmony_ci                             | "LRPHC" | "LRPHC_SAT"
16545bd8deadSopenharmony_ci                             | "LRPXC" | "LRPXC_SAT"
16555bd8deadSopenharmony_ci                             | "X2D"   | "X2D_SAT"
16565bd8deadSopenharmony_ci                             | "X2DR"  | "X2DR_SAT"
16575bd8deadSopenharmony_ci                             | "X2DH"  | "X2DH_SAT"
16585bd8deadSopenharmony_ci                             | "X2DC"  | "X2DC_SAT"
16595bd8deadSopenharmony_ci                             | "X2DRC" | "X2DRC_SAT"
16605bd8deadSopenharmony_ci                             | "X2DHC" | "X2DHC_SAT"
16615bd8deadSopenharmony_ci
16625bd8deadSopenharmony_ci    <KILop-instruction>    ::= <KILop> <ccMask>
16635bd8deadSopenharmony_ci
16645bd8deadSopenharmony_ci    <KILop>                ::= "KIL"
16655bd8deadSopenharmony_ci
16665bd8deadSopenharmony_ci    <TEXop-instruction>    ::= <TEXop> <maskedDstReg> ","
16675bd8deadSopenharmony_ci                               <vectorSrc> "," <texImageId>
16685bd8deadSopenharmony_ci
16695bd8deadSopenharmony_ci    <TEXop>                ::= "TEX"  | "TEX_SAT"
16705bd8deadSopenharmony_ci                             | "TEXC" | "TEXC_SAT"
16715bd8deadSopenharmony_ci                             | "TXP"  | "TXP_SAT"
16725bd8deadSopenharmony_ci                             | "TXPC" | "TXPC_SAT"
16735bd8deadSopenharmony_ci
16745bd8deadSopenharmony_ci    <TXDop-instruction>    ::= <TXDop> <maskedDstReg> ","
16755bd8deadSopenharmony_ci                               <vectorSrc> "," <vectorSrc> ","
16765bd8deadSopenharmony_ci                               <vectorSrc> "," <texImageId>
16775bd8deadSopenharmony_ci
16785bd8deadSopenharmony_ci    <TXDop>                ::= "TXD"  | "TXD_SAT"
16795bd8deadSopenharmony_ci                             | "TXDC" | "TXDC_SAT"
16805bd8deadSopenharmony_ci
16815bd8deadSopenharmony_ci    <scalarSrc>            ::= <absScalarSrc>
16825bd8deadSopenharmony_ci                             | <baseScalarSrc>
16835bd8deadSopenharmony_ci
16845bd8deadSopenharmony_ci    <absScalarSrc>         ::= <negate> "|" <baseScalarSrc> "|"
16855bd8deadSopenharmony_ci
16865bd8deadSopenharmony_ci    <baseScalarSrc>        ::= <signedScalarConstant>
16875bd8deadSopenharmony_ci                             | <negate> <namedScalarConstant>
16885bd8deadSopenharmony_ci                             | <negate> <vectorConstant> <scalarSuffix>
16895bd8deadSopenharmony_ci                             | <negate> <namedLocalParameter> <scalarSuffix>
16905bd8deadSopenharmony_ci                             | <negate> <numberedLocal> <scalarSuffix>
16915bd8deadSopenharmony_ci                             | <negate> <srcRegister> <scalarSuffix>
16925bd8deadSopenharmony_ci
16935bd8deadSopenharmony_ci    <vectorSrc>            ::= <absVectorSrc>
16945bd8deadSopenharmony_ci                             | <baseVectorSrc>
16955bd8deadSopenharmony_ci
16965bd8deadSopenharmony_ci    <absVectorSrc>         ::= <negate> "|" <baseVectorSrc> "|"
16975bd8deadSopenharmony_ci
16985bd8deadSopenharmony_ci    <baseVectorSrc>        ::= <signedScalarConstant>
16995bd8deadSopenharmony_ci                             | <negate> <namedScalarConstant>
17005bd8deadSopenharmony_ci                             | <negate> <vectorConstant> <scalarSuffix>
17015bd8deadSopenharmony_ci                             | <negate> <vectorConstant> <swizzleSuffix>
17025bd8deadSopenharmony_ci                             | <negate> <namedLocalParameter> <scalarSuffix>
17035bd8deadSopenharmony_ci                             | <negate> <namedLocalParameter> <swizzleSuffix>
17045bd8deadSopenharmony_ci                             | <negate> <numberedLocal> <scalarSuffix>
17055bd8deadSopenharmony_ci                             | <negate> <numberedLocal> <swizzleSuffix>
17065bd8deadSopenharmony_ci                             | <negate> <srcRegister> <scalarSuffix>
17075bd8deadSopenharmony_ci                             | <negate> <srcRegister> <swizzleSuffix>
17085bd8deadSopenharmony_ci
17095bd8deadSopenharmony_ci    <maskedDstReg>         ::= <dstRegister> <optionalWriteMask> 
17105bd8deadSopenharmony_ci                               <optionalCCMask>
17115bd8deadSopenharmony_ci
17125bd8deadSopenharmony_ci    <dstRegister>          ::= <fragTempReg>
17135bd8deadSopenharmony_ci                             | <fragOutputReg>
17145bd8deadSopenharmony_ci                             | "RC"
17155bd8deadSopenharmony_ci                             | "HC"
17165bd8deadSopenharmony_ci
17175bd8deadSopenharmony_ci    <optionalCCMask>       ::= "(" <ccMask> ")"
17185bd8deadSopenharmony_ci                             | ""
17195bd8deadSopenharmony_ci
17205bd8deadSopenharmony_ci    <ccMask>               ::= <ccMaskRule> <swizzleSuffix>
17215bd8deadSopenharmony_ci                             | <ccMaskRule> <scalarSuffix>
17225bd8deadSopenharmony_ci
17235bd8deadSopenharmony_ci    <ccMaskRule>           ::= "EQ" | "GE" | "GT" | "LE" | "LT" | "NE" |
17245bd8deadSopenharmony_ci                               "TR" | "FL"
17255bd8deadSopenharmony_ci                           
17265bd8deadSopenharmony_ci    <optionalWriteMask>    ::= ""
17275bd8deadSopenharmony_ci                             | "." "x"
17285bd8deadSopenharmony_ci                             | "."     "y"
17295bd8deadSopenharmony_ci                             | "." "x" "y"
17305bd8deadSopenharmony_ci                             | "."         "z"
17315bd8deadSopenharmony_ci                             | "." "x"     "z"
17325bd8deadSopenharmony_ci                             | "."     "y" "z"
17335bd8deadSopenharmony_ci                             | "." "x" "y" "z"
17345bd8deadSopenharmony_ci                             | "."             "w"
17355bd8deadSopenharmony_ci                             | "." "x"         "w"
17365bd8deadSopenharmony_ci                             | "."     "y"     "w"
17375bd8deadSopenharmony_ci                             | "." "x" "y"     "w"
17385bd8deadSopenharmony_ci                             | "."         "z" "w"
17395bd8deadSopenharmony_ci                             | "." "x"     "z" "w"
17405bd8deadSopenharmony_ci                             | "."     "y" "z" "w"
17415bd8deadSopenharmony_ci                             | "." "x" "y" "z" "w"
17425bd8deadSopenharmony_ci
17435bd8deadSopenharmony_ci    <srcRegister>          ::= <fragAttribReg>
17445bd8deadSopenharmony_ci                             | <fragTempReg>
17455bd8deadSopenharmony_ci
17465bd8deadSopenharmony_ci    <fragAttribReg>        ::= "f" "[" <fragAttribRegId> "]"
17475bd8deadSopenharmony_ci
17485bd8deadSopenharmony_ci    <fragAttribRegId>      ::= "WPOS" | "COL0" | "COL1" | "FOGC" | "TEX0"
17495bd8deadSopenharmony_ci                             | "TEX1" | "TEX2" | "TEX3" | "TEX4" | "TEX5"
17505bd8deadSopenharmony_ci                             | "TEX6" | "TEX7"
17515bd8deadSopenharmony_ci
17525bd8deadSopenharmony_ci    <fragTempReg>          ::= <fragF32Reg>
17535bd8deadSopenharmony_ci                             | <fragF16Reg>
17545bd8deadSopenharmony_ci
17555bd8deadSopenharmony_ci    <fragF32Reg>           ::= "R0"  | "R1"  | "R2"  | "R3"
17565bd8deadSopenharmony_ci                             | "R4"  | "R5"  | "R6"  | "R7"
17575bd8deadSopenharmony_ci                             | "R8"  | "R9"  | "R10" | "R11"
17585bd8deadSopenharmony_ci                             | "R12" | "R13" | "R14" | "R15"
17595bd8deadSopenharmony_ci                             | "R16" | "R17" | "R18" | "R19"
17605bd8deadSopenharmony_ci                             | "R20" | "R21" | "R22" | "R23"
17615bd8deadSopenharmony_ci                             | "R24" | "R25" | "R26" | "R27"
17625bd8deadSopenharmony_ci                             | "R28" | "R29" | "R30" | "R31"
17635bd8deadSopenharmony_ci
17645bd8deadSopenharmony_ci    <fragF16Reg>           ::= "H0"  | "H1"  | "H2"  | "H3"
17655bd8deadSopenharmony_ci                             | "H4"  | "H5"  | "H6"  | "H7"
17665bd8deadSopenharmony_ci                             | "H8"  | "H9"  | "H10" | "H11"
17675bd8deadSopenharmony_ci                             | "H12" | "H13" | "H14" | "H15"
17685bd8deadSopenharmony_ci                             | "H16" | "H17" | "H18" | "H19"
17695bd8deadSopenharmony_ci                             | "H20" | "H21" | "H22" | "H23"
17705bd8deadSopenharmony_ci                             | "H24" | "H25" | "H26" | "H27"
17715bd8deadSopenharmony_ci                             | "H28" | "H29" | "H30" | "H31"
17725bd8deadSopenharmony_ci                             | "H32" | "H33" | "H34" | "H35"
17735bd8deadSopenharmony_ci                             | "H36" | "H37" | "H38" | "H39"
17745bd8deadSopenharmony_ci                             | "H40" | "H41" | "H42" | "H43"
17755bd8deadSopenharmony_ci                             | "H44" | "H45" | "H46" | "H47"
17765bd8deadSopenharmony_ci                             | "H48" | "H49" | "H50" | "H51"
17775bd8deadSopenharmony_ci                             | "H52" | "H53" | "H54" | "H55"
17785bd8deadSopenharmony_ci                             | "H56" | "H57" | "H58" | "H59"
17795bd8deadSopenharmony_ci                             | "H60" | "H61" | "H62" | "H63"
17805bd8deadSopenharmony_ci
17815bd8deadSopenharmony_ci    <fragOutputReg>        ::= "o" "[" <fragOutputRegName> "]"
17825bd8deadSopenharmony_ci
17835bd8deadSopenharmony_ci    <fragOutputRegName>    ::= "COLR" | "COLH" | "DEPR"
17845bd8deadSopenharmony_ci
17855bd8deadSopenharmony_ci    <numberedLocal>        ::= "p" "[" <localNumber> "]"
17865bd8deadSopenharmony_ci
17875bd8deadSopenharmony_ci    <localNumber>          ::= <integer> from 0 to
17885bd8deadSopenharmony_ci                               MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV - 1
17895bd8deadSopenharmony_ci
17905bd8deadSopenharmony_ci    <scalarSuffix>         ::= "." <component>
17915bd8deadSopenharmony_ci
17925bd8deadSopenharmony_ci    <swizzleSuffix>        ::= ""
17935bd8deadSopenharmony_ci                             | "." <component> <component>
17945bd8deadSopenharmony_ci                                   <component> <component>
17955bd8deadSopenharmony_ci
17965bd8deadSopenharmony_ci    <component>            ::= "x" | "y" | "z" | "w"
17975bd8deadSopenharmony_ci
17985bd8deadSopenharmony_ci    <texImageId>           ::= <texImageUnit> "," <texImageTarget>
17995bd8deadSopenharmony_ci
18005bd8deadSopenharmony_ci    <texImageUnit>         ::= "TEX0"  | "TEX1"  | "TEX2"  | "TEX3"
18015bd8deadSopenharmony_ci                             | "TEX4"  | "TEX5"  | "TEX6"  | "TEX7"
18025bd8deadSopenharmony_ci                             | "TEX8"  | "TEX9"  | "TEX10" | "TEX11"
18035bd8deadSopenharmony_ci                             | "TEX12" | "TEX13" | "TEX14" | "TEX15"
18045bd8deadSopenharmony_ci
18055bd8deadSopenharmony_ci    <texImageTarget>       ::= "1D" | "2D" | "3D" | "CUBE" | "RECT"
18065bd8deadSopenharmony_ci
18075bd8deadSopenharmony_ci    <constantDefinition>   ::= "DEFINE" <namedVectorConstant> "=" 
18085bd8deadSopenharmony_ci                               <vectorConstant>
18095bd8deadSopenharmony_ci                             | "DEFINE" <namedScalarConstant> "=" 
18105bd8deadSopenharmony_ci                               <scalarConstant>
18115bd8deadSopenharmony_ci
18125bd8deadSopenharmony_ci    <localDeclaration>     ::= "DECLARE" <namedLocalParameter> 
18135bd8deadSopenharmony_ci                               <optionalLocalValue>
18145bd8deadSopenharmony_ci
18155bd8deadSopenharmony_ci    <optionalLocalValue>   ::= ""
18165bd8deadSopenharmony_ci                             | "=" <vectorConstant>
18175bd8deadSopenharmony_ci                             | "=" <scalarConstant>
18185bd8deadSopenharmony_ci
18195bd8deadSopenharmony_ci    <vectorConstant>       ::= {" <vectorConstantList> "}"
18205bd8deadSopenharmony_ci                             | <namedVectorConstant>
18215bd8deadSopenharmony_ci
18225bd8deadSopenharmony_ci    <vectorConstantList>   ::= <scalarConstant>
18235bd8deadSopenharmony_ci                             | <scalarConstant> "," <scalarConstant>
18245bd8deadSopenharmony_ci                             | <scalarConstant> "," <scalarConstant> ","
18255bd8deadSopenharmony_ci                               <scalarConstant>
18265bd8deadSopenharmony_ci                             | <scalarConstant> "," <scalarConstant> ","
18275bd8deadSopenharmony_ci                               <scalarConstant> "," <scalarConstant>
18285bd8deadSopenharmony_ci
18295bd8deadSopenharmony_ci    <scalarConstant>       ::= <signedScalarConstant>
18305bd8deadSopenharmony_ci                             | <namedScalarConstant>
18315bd8deadSopenharmony_ci
18325bd8deadSopenharmony_ci    <signedScalarConstant> ::= <optionalSign> <floatConstant>
18335bd8deadSopenharmony_ci
18345bd8deadSopenharmony_ci    <namedScalarConstant>  ::= <identifier>    ((name of a scalar constant
18355bd8deadSopenharmony_ci                                                 in a DEFINE instruction))
18365bd8deadSopenharmony_ci
18375bd8deadSopenharmony_ci    <namedVectorConstant>  ::= <identifier>    ((name of a vector constant
18385bd8deadSopenharmony_ci                                                 in a DEFINE instruction))
18395bd8deadSopenharmony_ci
18405bd8deadSopenharmony_ci    <namedLocalParameter>  ::= <identifier>    ((name of a local parameter
18415bd8deadSopenharmony_ci                                                 in a DECLARE instruction))
18425bd8deadSopenharmony_ci
18435bd8deadSopenharmony_ci    <negate>               ::= "-" | "+" | ""
18445bd8deadSopenharmony_ci
18455bd8deadSopenharmony_ci    <optionalSign>         ::= "-" | "+" | ""
18465bd8deadSopenharmony_ci
18475bd8deadSopenharmony_ci    <identifier>           ::= see text below
18485bd8deadSopenharmony_ci
18495bd8deadSopenharmony_ci    <floatConstant>        ::= see text below
18505bd8deadSopenharmony_ci
18515bd8deadSopenharmony_ci
18525bd8deadSopenharmony_ci    The <identifier> rule matches a sequence of one or more letters ("A"
18535bd8deadSopenharmony_ci    through "Z", "a" through "z", "_", and "$") and digits ("0" through "9);
18545bd8deadSopenharmony_ci    the first character must be a letter.  The underscore ("_") and dollar
18555bd8deadSopenharmony_ci    sign ("$") count as a letters.  Upper and lower case letters are different
18565bd8deadSopenharmony_ci    (names are case-sensitive).
18575bd8deadSopenharmony_ci
18585bd8deadSopenharmony_ci    The <floatConstant> rule matches a floating-point constant consisting
18595bd8deadSopenharmony_ci    of an integer part, a decimal point, a fraction part, an "e" or
18605bd8deadSopenharmony_ci    "E", and an optionally signed integer exponent.  The integer and
18615bd8deadSopenharmony_ci    fraction parts both consist of a sequence of on or more digits ("0"
18625bd8deadSopenharmony_ci    through "9").  Either the integer part or the fraction parts (not
18635bd8deadSopenharmony_ci    both) may be missing; either the decimal point or the "e" (or "E")
18645bd8deadSopenharmony_ci    and the exponent (not both) may be missing.
18655bd8deadSopenharmony_ci
18665bd8deadSopenharmony_ci    A fragment program fails to load if it contains more than the maximum
18675bd8deadSopenharmony_ci    number of executable instructions.  If ARB_fragment_program is supported,
18685bd8deadSopenharmony_ci    this limit is the value of MAX_PROGRAM_INSTRUCTIONS_ARB for the
18695bd8deadSopenharmony_ci    FRAGMENT_PROGRAM_ARB target.  Otherwise, the limit is 1024.  Executable
18705bd8deadSopenharmony_ci    instructions are those matching the <instruction> rule in the grammar, and
18715bd8deadSopenharmony_ci    do not include DEFINE or DECLARE instructions.
18725bd8deadSopenharmony_ci
18735bd8deadSopenharmony_ci    A fragment program fails to load if its total temporary and output
18745bd8deadSopenharmony_ci    register count exceeds 64.  Each fp32 temporary or output register used by
18755bd8deadSopenharmony_ci    the program (R0-R31, o[COLR], and o[DEPR]) counts as two registers; each
18765bd8deadSopenharmony_ci    fp16 temporary or output register used by the program (H0-H63 and o[COLH])
18775bd8deadSopenharmony_ci    count as a single register.
18785bd8deadSopenharmony_ci      
18795bd8deadSopenharmony_ci    A fragment program fails to load if any instruction sources more than one
18805bd8deadSopenharmony_ci    unique fragment attribute register.  Instructions sourcing the same
18815bd8deadSopenharmony_ci    attribute register multiple times are acceptable.
18825bd8deadSopenharmony_ci
18835bd8deadSopenharmony_ci    A fragment program fails to load if any instruction sources more than one
18845bd8deadSopenharmony_ci    unique program parameter register.  Instructions sourcing the same program
18855bd8deadSopenharmony_ci    parameter multiple times are acceptable.
18865bd8deadSopenharmony_ci
18875bd8deadSopenharmony_ci    A fragment program fails to load if multiple texture lookup instructions
18885bd8deadSopenharmony_ci    reference different targets for the same texture image unit.
18895bd8deadSopenharmony_ci
18905bd8deadSopenharmony_ci    A fragment program fails to load if it writes to both the o[COLR] and
18915bd8deadSopenharmony_ci    o[COLH] output registers.
18925bd8deadSopenharmony_ci
18935bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by LoadProgramNV if a fragment
18945bd8deadSopenharmony_ci    program fails to load because it is not syntactically correct or for one
18955bd8deadSopenharmony_ci    of the semantic restrictions listed above.
18965bd8deadSopenharmony_ci
18975bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by LoadProgramNV if a program is
18985bd8deadSopenharmony_ci    loaded for id when id is currently loaded with a program of a different
18995bd8deadSopenharmony_ci    target.
19005bd8deadSopenharmony_ci
19015bd8deadSopenharmony_ci    A successfully loaded fragment program is parsed into a sequence of
19025bd8deadSopenharmony_ci    instructions.  Each instruction is identified by its tokenized name.  The
19035bd8deadSopenharmony_ci    operation of these instructions when executed is defined in Sections
19045bd8deadSopenharmony_ci    3.11.4 and 3.11.5.
19055bd8deadSopenharmony_ci
19065bd8deadSopenharmony_ci
19075bd8deadSopenharmony_ci    Section 3.11.4, Fragment Program Operation
19085bd8deadSopenharmony_ci
19095bd8deadSopenharmony_ci    There are forty-five fragment program instructions.  Fragment program
19105bd8deadSopenharmony_ci    instructions may have up to eight variants, including a suffix of "R",
19115bd8deadSopenharmony_ci    "H", or "X" to specify arithmetic precision (section 3.11.4.2), a suffix
19125bd8deadSopenharmony_ci    of "C" to allow an update of the condition code register (section
19135bd8deadSopenharmony_ci    3.11.4.4), and a suffix of "_SAT" to clamp the result vector components to
19145bd8deadSopenharmony_ci    the range [0,1] (section 3.11.4.4).  For example, the sixteen forms of the
19155bd8deadSopenharmony_ci    "ADD" instruction are "ADD", "ADDR", "ADDH", "ADDX", "ADDC", "ADDRC",
19165bd8deadSopenharmony_ci    "ADDHC", "ADDXC", "ADD_SAT", "ADDR_SAT", "ADDH_SAT", "ADDX_SAT",
19175bd8deadSopenharmony_ci    "ADDC_SAT", "ADDRC_SAT", "ADDHC_SAT", and "ADDXC_SAT".
19185bd8deadSopenharmony_ci
19195bd8deadSopenharmony_ci    Some mathematical instructions that support precision suffixes, typically
19205bd8deadSopenharmony_ci    those that involve complicated floating-point computations, do not support
19215bd8deadSopenharmony_ci    the "X" precision suffix.
19225bd8deadSopenharmony_ci
19235bd8deadSopenharmony_ci    The fragment program instructions and their respective input and output
19245bd8deadSopenharmony_ci    parameters are summarized in Table X.4.
19255bd8deadSopenharmony_ci
19265bd8deadSopenharmony_ci      Instruction          Inputs  Output   Description
19275bd8deadSopenharmony_ci      -----------------    ------  ------   --------------------------------
19285bd8deadSopenharmony_ci      ADD[RHX][C][_SAT]    v,v     v        add
19295bd8deadSopenharmony_ci      COS[RH ][C][_SAT]    s       ssss     cosine
19305bd8deadSopenharmony_ci      DDX[RH ][C][_SAT]    v       v        derivative relative to x
19315bd8deadSopenharmony_ci      DDY[RH ][C][_SAT]    v       v        derivative relative to y
19325bd8deadSopenharmony_ci      DP3[RHX][C][_SAT]    v,v     ssss     3-component dot product
19335bd8deadSopenharmony_ci      DP4[RHX][C][_SAT]    v,v     ssss     4-component dot product
19345bd8deadSopenharmony_ci      DST[RH ][C][_SAT]    v,v     v        distance vector
19355bd8deadSopenharmony_ci      EX2[RH ][C][_SAT]    s       ssss     exponential base 2
19365bd8deadSopenharmony_ci      FLR[RHX][C][_SAT]    v       v        floor
19375bd8deadSopenharmony_ci      FRC[RHX][C][_SAT]    v       v        fraction
19385bd8deadSopenharmony_ci      KIL                  none    none     conditionally discard fragment
19395bd8deadSopenharmony_ci      LG2[RH ][C][_SAT]    s       ssss     logarithm base 2
19405bd8deadSopenharmony_ci      LIT[RH ][C][_SAT]    v       v        compute light coefficients
19415bd8deadSopenharmony_ci      LRP[RHX][C][_SAT]    v,v,v   v        linear interpolation
19425bd8deadSopenharmony_ci      MAD[RHX][C][_SAT]    v,v,v   v        multiply and add
19435bd8deadSopenharmony_ci      MAX[RHX][C][_SAT]    v,v     v        maximum
19445bd8deadSopenharmony_ci      MIN[RHX][C][_SAT]    v,v     v        minimum
19455bd8deadSopenharmony_ci      MOV[RHX][C][_SAT]    v       v        move
19465bd8deadSopenharmony_ci      MUL[RHX][C][_SAT]    v,v     v        multiply
19475bd8deadSopenharmony_ci      PK2H                 v       ssss     pack two 16-bit floats
19485bd8deadSopenharmony_ci      PK2US                v       ssss     pack two unsigned 16-bit scalars
19495bd8deadSopenharmony_ci      PK4B                 v       ssss     pack four signed 8-bit scalars
19505bd8deadSopenharmony_ci      PK4UB                v       ssss     pack four unsigned 8-bit scalars
19515bd8deadSopenharmony_ci      POW[RH ][C][_SAT]    s,s     ssss     exponentiation (x^y)
19525bd8deadSopenharmony_ci      RCP[RH ][C][_SAT]    s       ssss     reciprocal
19535bd8deadSopenharmony_ci      RFL[RH ][C][_SAT]    v,v     v        reflection vector
19545bd8deadSopenharmony_ci      RSQ[RH ][C][_SAT]    s       ssss     reciprocal square root
19555bd8deadSopenharmony_ci      SEQ[RHX][C][_SAT]    v,v     v        set on equal
19565bd8deadSopenharmony_ci      SFL[RHX][C][_SAT]    v,v     v        set on false
19575bd8deadSopenharmony_ci      SGE[RHX][C][_SAT]    v,v     v        set on greater than or equal
19585bd8deadSopenharmony_ci      SGT[RHX][C][_SAT]    v,v     v        set on greater than
19595bd8deadSopenharmony_ci      SIN[RH ][C][_SAT]    s       ssss     sine
19605bd8deadSopenharmony_ci      SLE[RHX][C][_SAT]    v,v     v        set on less than or equal
19615bd8deadSopenharmony_ci      SLT[RHX][C][_SAT]    v,v     v        set on less than
19625bd8deadSopenharmony_ci      SNE[RHX][C][_SAT]    v,v     v        set on not equal
19635bd8deadSopenharmony_ci      STR[RHX][C][_SAT]    v,v     v        set on true
19645bd8deadSopenharmony_ci      SUB[RHX][C][_SAT]    v,v     v        subtract
19655bd8deadSopenharmony_ci      TEX[C][_SAT]         v       v        texture lookup
19665bd8deadSopenharmony_ci      TXD[C][_SAT]         v,v,v   v        texture lookup w/partials
19675bd8deadSopenharmony_ci      TXP[C][_SAT]         v       v        projective texture lookup
19685bd8deadSopenharmony_ci      UP2H[C][_SAT]        s       v        unpack two 16-bit floats
19695bd8deadSopenharmony_ci      UP2US[C][_SAT]       s       v        unpack two unsigned 16-bit scalars
19705bd8deadSopenharmony_ci      UP4B[C][_SAT]        s       v        unpack four signed 8-bit scalars
19715bd8deadSopenharmony_ci      UP4UB[C][_SAT]       s       v        unpack four unsigned 8-bit scalars
19725bd8deadSopenharmony_ci      X2D[RH ][C][_SAT]    v,v,v   v        2D coordinate transformation
19735bd8deadSopenharmony_ci     
19745bd8deadSopenharmony_ci    Table X.4:  Summary of fragment program instructions.  "[RHX]" indicates
19755bd8deadSopenharmony_ci    an optional arithmetic precision suffix.  "[C]" indicates an optional
19765bd8deadSopenharmony_ci    condition code update suffix.  "[_SAT]" indicates an optional clamp of
19775bd8deadSopenharmony_ci    result vector components to [0,1].  "v" indicates a 4-component vector
19785bd8deadSopenharmony_ci    input or output, "s" indicates a scalar input, and "ssss" indicates a
19795bd8deadSopenharmony_ci    scalar output replicated across a 4-component vector.
19805bd8deadSopenharmony_ci
19815bd8deadSopenharmony_ci
19825bd8deadSopenharmony_ci    Section 3.11.4.1:  Fragment Program Storage Precision
19835bd8deadSopenharmony_ci
19845bd8deadSopenharmony_ci    Registers in fragment program are stored in two different representations:
19855bd8deadSopenharmony_ci    16-bit floating-point (fp16) and 32-bit floating-point (fp32).  There is
19865bd8deadSopenharmony_ci    an additional 12-bit fixed-point representation (fx12) used only as an
19875bd8deadSopenharmony_ci    internal representation for instructions with the "X" precision qualifier.
19885bd8deadSopenharmony_ci
19895bd8deadSopenharmony_ci    In the 32-bit float (fp32) representation, each component is represented
19905bd8deadSopenharmony_ci    in floating-point with eight exponent and twenty-three mantissa bits, as
19915bd8deadSopenharmony_ci    in the standard IEEE single-precision format.  If S represents the sign (0
19925bd8deadSopenharmony_ci    or 1), E represents the exponent in the range [0,255], and M represents
19935bd8deadSopenharmony_ci    the mantissa in the range [0,2^23-1], then a fp32 float is decoded as:
19945bd8deadSopenharmony_ci
19955bd8deadSopenharmony_ci       (-1)^S * 0.0,                           if E == 0,
19965bd8deadSopenharmony_ci       (-1)^S * 2^(E-127) * (1 + M/2^23),      if 0 < E < 255,
19975bd8deadSopenharmony_ci       (-1)^S * INF,                           if E == 255 and M == 0,
19985bd8deadSopenharmony_ci       NaN,                                    if E == 255 and M != 0.
19995bd8deadSopenharmony_ci
20005bd8deadSopenharmony_ci    INF (Infinity) is a special representation indicating numerical overflow.
20015bd8deadSopenharmony_ci    NaN (Not a Number) is a special representation indicating the result of
20025bd8deadSopenharmony_ci    illegal arithmetic operations, such as computing the square root or
20035bd8deadSopenharmony_ci    logarithm of a negative number.  Note that all normal fp32 values, zero,
20045bd8deadSopenharmony_ci    and INF have an associated sign.  -0.0 and +0.0 are considered equivalent
20055bd8deadSopenharmony_ci    for the purposes of comparisons.
20065bd8deadSopenharmony_ci
20075bd8deadSopenharmony_ci    This representation is identical to the IEEE single-precision
20085bd8deadSopenharmony_ci    floating-point standard, except that no special representation is provided
20095bd8deadSopenharmony_ci    for denorms -- numbers in the range (-2^-126, +2^-126).  All such numbers
20105bd8deadSopenharmony_ci    are flushed to zero.
20115bd8deadSopenharmony_ci
20125bd8deadSopenharmony_ci    In a 16-bit float (fp16) register, each component is represented
20135bd8deadSopenharmony_ci    similarly, except with only five exponent and ten mantissa bits.  If S
20145bd8deadSopenharmony_ci    represents the sign (0 or 1), E represents the exponent in the range
20155bd8deadSopenharmony_ci    [0,31], and M represents the mantissa in the range [0,2^10-1], then an
20165bd8deadSopenharmony_ci    fp32 float is decoded as:
20175bd8deadSopenharmony_ci
20185bd8deadSopenharmony_ci       (-1)^S * 0.0,                           if E == 0 and M == 0,
20195bd8deadSopenharmony_ci       (-1)^S * 2^-14 * M/2^10                 if E == 0 and M != 0,
20205bd8deadSopenharmony_ci       (-1)^S * 2^(E-15) * (1 + M/2^10),       if 0 < E < 31,
20215bd8deadSopenharmony_ci       (-1)^S * INF,                           if E == 31 and M == 0, or
20225bd8deadSopenharmony_ci       NaN,                                    if E == 31 and M != 0.
20235bd8deadSopenharmony_ci
20245bd8deadSopenharmony_ci    One important difference is that the fp16 representation, unlike fp32,
20255bd8deadSopenharmony_ci    supports denorms to maximize the limited precision of the 16-bit floating
20265bd8deadSopenharmony_ci    point encodings.
20275bd8deadSopenharmony_ci
20285bd8deadSopenharmony_ci    In the 12-bit fixed-point (fx12) format, numbers are represented as signed
20295bd8deadSopenharmony_ci    12-bit two's complement integers with 10 fraction bits.  The range of
20305bd8deadSopenharmony_ci    representable values is [-2048/1024, +2047/1024].
20315bd8deadSopenharmony_ci
20325bd8deadSopenharmony_ci    Section 3.11.4.2:  Fragment Program Operation Precision
20335bd8deadSopenharmony_ci
20345bd8deadSopenharmony_ci    Fragment program instructions frequently perform mathematical operations.
20355bd8deadSopenharmony_ci    Such operations may be performed at one of three different precisions.
20365bd8deadSopenharmony_ci    Fragment programs can specify the precision of each instruction by using
20375bd8deadSopenharmony_ci    the precision suffix.  If an instruction has a suffix of "R", calculations
20385bd8deadSopenharmony_ci    are carried out with 32-bit floating point operands and results.  If an
20395bd8deadSopenharmony_ci    instruction has a suffix of "H", calculations are carried out using 16-bit
20405bd8deadSopenharmony_ci    floating point operands and results.  If an instruction has a suffix of
20415bd8deadSopenharmony_ci    "X", calculations are carried out using 12-bit fixed point operands and
20425bd8deadSopenharmony_ci    results.  For example, the instruction "MULR" performs a 32-bit
20435bd8deadSopenharmony_ci    floating-point multiply, "MULH" performs a 16-bit floating-point multiply,
20445bd8deadSopenharmony_ci    and "MULX" performs a 12-bit fixed-point multiply.  If no precision suffix
20455bd8deadSopenharmony_ci    is specified, calculations are carried out using the precision of the
20465bd8deadSopenharmony_ci    temporary register receiving the result.
20475bd8deadSopenharmony_ci
20485bd8deadSopenharmony_ci    Fragment program instructions may source registers or constants whose
20495bd8deadSopenharmony_ci    precisions differ from the precision specified with the instruction.
20505bd8deadSopenharmony_ci    Instructions may also generate intermediate results with a different
20515bd8deadSopenharmony_ci    precision than that of the destination register.  In these cases, the
20525bd8deadSopenharmony_ci    values sourced are converted to the precision specified by the
20535bd8deadSopenharmony_ci    instruction.
20545bd8deadSopenharmony_ci
20555bd8deadSopenharmony_ci    When converting to fx12 format, -INF and any values less than -2048/1024
20565bd8deadSopenharmony_ci    become -2048/1024.  +INF, and any values greater than +2047/1024 become
20575bd8deadSopenharmony_ci    +2047/1024.  NaN becomes 0.
20585bd8deadSopenharmony_ci
20595bd8deadSopenharmony_ci    When converting to fp16 format, any values less than or equal to -2^16 are
20605bd8deadSopenharmony_ci    converted to -INF.  Any values greater than or equal to +2^16 are
20615bd8deadSopenharmony_ci    converted to +INF.  -INF, +INF, NaN, -0.0, and +0.0 are unchanged.  Any
20625bd8deadSopenharmony_ci    other values that are not exactly representable in fp16 format are
20635bd8deadSopenharmony_ci    converted to one of the two nearest representable values.
20645bd8deadSopenharmony_ci
20655bd8deadSopenharmony_ci    When converting to fp32 format, any values less than or equal to -2^128
20665bd8deadSopenharmony_ci    are converted to -INF.  Any values greater than or equal to +2^128 are
20675bd8deadSopenharmony_ci    converted to +INF.  -INF, +INF, NaN, -0.0, and +0.0 are unchanged.  Any
20685bd8deadSopenharmony_ci    other values that are not exactly representable in fp32 format are
20695bd8deadSopenharmony_ci    converted to one of the two nearest representable values.
20705bd8deadSopenharmony_ci
20715bd8deadSopenharmony_ci    Fragment program instructions using the fragment attribute registers
20725bd8deadSopenharmony_ci    f[FOGC] or f[TEX0] through f[TEX7] will be carried out at full fp32
20735bd8deadSopenharmony_ci    precision, regardless of the precision specified by the instruction.
20745bd8deadSopenharmony_ci
20755bd8deadSopenharmony_ci    Section 3.11.4.3:  Fragment Program Operands
20765bd8deadSopenharmony_ci
20775bd8deadSopenharmony_ci    Except for KIL, fragment program instructions operate on either vector or
20785bd8deadSopenharmony_ci    scalar operands, indicated in the grammar (see section 3.11.3) by the
20795bd8deadSopenharmony_ci    rules <vectorSrc> and <scalarSrc> respectively.
20805bd8deadSopenharmony_ci
20815bd8deadSopenharmony_ci    The basic set of scalar operands is defined by the grammar rule
20825bd8deadSopenharmony_ci    <baseScalarSrc>.  Scalar operands can be scalar constants (embedded or
20835bd8deadSopenharmony_ci    named), or single components of vector constants, local parameters, or
20845bd8deadSopenharmony_ci    registers allowed by the <srcRegister> rule.  A vector component is
20855bd8deadSopenharmony_ci    selected by the <scalarSuffix> rule, where the characters "x", "y", "z",
20865bd8deadSopenharmony_ci    and "w" select the x, y, z, and w components, respectively, of the vector.
20875bd8deadSopenharmony_ci
20885bd8deadSopenharmony_ci    The basic set of vector operands is defined by the grammar rule
20895bd8deadSopenharmony_ci    <baseVectorSrc>.  Vector operands can include vector constants, local
20905bd8deadSopenharmony_ci    parameters, or registers allowed by the <srcRegister> rule.
20915bd8deadSopenharmony_ci
20925bd8deadSopenharmony_ci    Basic vector operands can be swizzled according to the <swizzleSuffix>
20935bd8deadSopenharmony_ci    rule.  In its most general form, the <swizzleSuffix> rule matches the
20945bd8deadSopenharmony_ci    pattern ".????" where each question mark is one of "x", "y", "z", or "w".
20955bd8deadSopenharmony_ci    For such patterns, the x, y, z, and w components of the operand are taken
20965bd8deadSopenharmony_ci    from the vector components named by the first, second, third, and fourth
20975bd8deadSopenharmony_ci    character of the pattern, respectively.  For example, if the swizzle
20985bd8deadSopenharmony_ci    suffix is ".yzzx" and the specified source contains {2,8,9,0}, the
20995bd8deadSopenharmony_ci    swizzled operand used by the instruction is {8,9,9,2}.  If the
21005bd8deadSopenharmony_ci    <swizzleSuffix> rule matches "", it is treated as though it were ".xyzw".
21015bd8deadSopenharmony_ci
21025bd8deadSopenharmony_ci    Operands can optionally be negated according to the <negate> rule in
21035bd8deadSopenharmony_ci    <baseScalarSrc> or <baseVectorSrc>.  If the <negate> matches "-", each
21045bd8deadSopenharmony_ci    value is negated.
21055bd8deadSopenharmony_ci
21065bd8deadSopenharmony_ci    The absolute value of operands can be taken if the <vectorSrc> or
21075bd8deadSopenharmony_ci    <scalarSrc> rules match <absScalarSrc> or <absVectorSrc>.  In this case,
21085bd8deadSopenharmony_ci    the absolute value of each component is taken.  In addition, if the
21095bd8deadSopenharmony_ci    <negate> rule in <absScalarSrc> or <absVectorSrc> matches "-", the result
21105bd8deadSopenharmony_ci    is then negated.
21115bd8deadSopenharmony_ci
21125bd8deadSopenharmony_ci    Instructions requiring vector operands can also use scalar operands in the
21135bd8deadSopenharmony_ci    case where the <vectorSrc> rule matches <scalarSrc>.  In such cases, a
21145bd8deadSopenharmony_ci    4-component vector is produced by replicating the scalar.
21155bd8deadSopenharmony_ci
21165bd8deadSopenharmony_ci    After operands are loaded, they are converted to a data type corresponding
21175bd8deadSopenharmony_ci    to the operation precision specified in the fragment program instruction.
21185bd8deadSopenharmony_ci 
21195bd8deadSopenharmony_ci    The following pseudo-code spells out the operand generation process.
21205bd8deadSopenharmony_ci    "SrcT" and "InstT" refer to the data types of the specified register or
21215bd8deadSopenharmony_ci    constant and the instruction, respectively.  "VecSrcT" and "VecInstT"
21225bd8deadSopenharmony_ci    refer to 4-component vectors of the corresponding type.  "absolute" is
21235bd8deadSopenharmony_ci    TRUE if the operand matches the <absScalarSrc> or <absVectorSrc> rules,
21245bd8deadSopenharmony_ci    and FALSE otherwise.  "negateBase" is TRUE if the <negate> rule in
21255bd8deadSopenharmony_ci    <baseScalarSrc> or <baseVectorSrc> matches "-" and FALSE otherwise.
21265bd8deadSopenharmony_ci    "negateAbs" is TRUE if the <negate> rule in <absScalarSrc> or
21275bd8deadSopenharmony_ci    <absVectorSrc> matches "-" and FALSE otherwise.  The ".c***", ".*c**",
21285bd8deadSopenharmony_ci    ".**c*", ".***c" modifiers refer to the x, y, z, and w components obtained
21295bd8deadSopenharmony_ci    by the swizzle operation.  TypeConvert() is assumed to convert a scalar of
21305bd8deadSopenharmony_ci    type SrcT to a scalar of type InstT using the type conversion process
21315bd8deadSopenharmony_ci    specified above.
21325bd8deadSopenharmony_ci
21335bd8deadSopenharmony_ci      VecInstT VectorLoad(VecSrcT source)
21345bd8deadSopenharmony_ci      {
21355bd8deadSopenharmony_ci          VecSrcT srcVal;
21365bd8deadSopenharmony_ci          VecInstT convertedVal;
21375bd8deadSopenharmony_ci
21385bd8deadSopenharmony_ci          srcVal.x = source.c***;
21395bd8deadSopenharmony_ci          srcVal.y = source.*c**;
21405bd8deadSopenharmony_ci          srcVal.z = source.**c*;
21415bd8deadSopenharmony_ci          srcVal.w = source.***c;
21425bd8deadSopenharmony_ci          if (negateBase) {
21435bd8deadSopenharmony_ci             srcVal.x = -srcVal.x;
21445bd8deadSopenharmony_ci             srcVal.y = -srcVal.y;
21455bd8deadSopenharmony_ci             srcVal.z = -srcVal.z;
21465bd8deadSopenharmony_ci             srcVal.w = -srcVal.w;
21475bd8deadSopenharmony_ci          }
21485bd8deadSopenharmony_ci          if (absolute) {
21495bd8deadSopenharmony_ci             srcVal.x = abs(srcVal.x);
21505bd8deadSopenharmony_ci             srcVal.y = abs(srcVal.y);
21515bd8deadSopenharmony_ci             srcVal.z = abs(srcVal.z);
21525bd8deadSopenharmony_ci             srcVal.w = abs(srcVal.w);
21535bd8deadSopenharmony_ci          }
21545bd8deadSopenharmony_ci          if (negateAbs) {
21555bd8deadSopenharmony_ci             srcVal.x = -srcVal.x;
21565bd8deadSopenharmony_ci             srcVal.y = -srcVal.y;
21575bd8deadSopenharmony_ci             srcVal.z = -srcVal.z;
21585bd8deadSopenharmony_ci             srcVal.w = -srcVal.w;
21595bd8deadSopenharmony_ci          }
21605bd8deadSopenharmony_ci
21615bd8deadSopenharmony_ci          convertedVal.x = TypeConvert(srcVal.x);
21625bd8deadSopenharmony_ci          convertedVal.y = TypeConvert(srcVal.y);
21635bd8deadSopenharmony_ci          convertedVal.z = TypeConvert(srcVal.z);
21645bd8deadSopenharmony_ci          convertedVal.w = TypeConvert(srcVal.w);
21655bd8deadSopenharmony_ci          return convertedVal;
21665bd8deadSopenharmony_ci      }
21675bd8deadSopenharmony_ci
21685bd8deadSopenharmony_ci      InstT ScalarLoad(VecSrcT source) 
21695bd8deadSopenharmony_ci      {
21705bd8deadSopenharmony_ci          SrcT srcVal;
21715bd8deadSopenharmony_ci          InstT convertedVal;
21725bd8deadSopenharmony_ci
21735bd8deadSopenharmony_ci          srcVal = source.c***;
21745bd8deadSopenharmony_ci          if (negateBase) {
21755bd8deadSopenharmony_ci            srcVal = -srcVal;
21765bd8deadSopenharmony_ci          }
21775bd8deadSopenharmony_ci          if (absolute) {
21785bd8deadSopenharmony_ci             srcVal = abs(srcVal);
21795bd8deadSopenharmony_ci          }
21805bd8deadSopenharmony_ci          if (negateAbs) {
21815bd8deadSopenharmony_ci            srcVal = -srcVal;
21825bd8deadSopenharmony_ci          }
21835bd8deadSopenharmony_ci
21845bd8deadSopenharmony_ci          convertedVal = TypeConvert(srcVal);
21855bd8deadSopenharmony_ci          return convertedVal;
21865bd8deadSopenharmony_ci      }
21875bd8deadSopenharmony_ci
21885bd8deadSopenharmony_ci
21895bd8deadSopenharmony_ci    Section 3.11.4.4, Fragment Program Destination Register Update
21905bd8deadSopenharmony_ci
21915bd8deadSopenharmony_ci    Each fragment program instruction, except for KIL, writes a 4-component
21925bd8deadSopenharmony_ci    result vector to a single temporary or output register.  
21935bd8deadSopenharmony_ci
21945bd8deadSopenharmony_ci    The four components of the result vector are first optionally clamped to
21955bd8deadSopenharmony_ci    the range [0,1].  The components will be clamped if and only if the result
21965bd8deadSopenharmony_ci    clamp suffix "_SAT" is present in the instruction name.  The instruction
21975bd8deadSopenharmony_ci    "ADD_SAT" will clamp the results to [0,1]; the otherwise equivalent
21985bd8deadSopenharmony_ci    instruction "ADD" will not.
21995bd8deadSopenharmony_ci
22005bd8deadSopenharmony_ci    Since the instruction may be carried out at a different precision than the
22015bd8deadSopenharmony_ci    destination register, the components of the results vector are then
22025bd8deadSopenharmony_ci    converted to the data type corresponding to destination register.
22035bd8deadSopenharmony_ci
22045bd8deadSopenharmony_ci    Writes to individual components of the temporary register are controlled
22055bd8deadSopenharmony_ci    by two sets of enables: individual component write masks specified as part
22065bd8deadSopenharmony_ci    of the instruction and the optional condition code mask.
22075bd8deadSopenharmony_ci
22085bd8deadSopenharmony_ci    The component write mask is specified by the <optionalWriteMask> rule
22095bd8deadSopenharmony_ci    found in the <maskedDstReg> rule.  If the optional mask is "", all
22105bd8deadSopenharmony_ci    components are enabled.  Otherwise, the optional mask names the individual
22115bd8deadSopenharmony_ci    components to enable.  The characters "x", "y", "z", and "w" match the x,
22125bd8deadSopenharmony_ci    y, z, and w components respectively.  For example, an optional mask of
22135bd8deadSopenharmony_ci    ".xzw" indicates that the x, z, and w components should be enabled for
22145bd8deadSopenharmony_ci    writing but the y component should not.  The grammar requires that the
22155bd8deadSopenharmony_ci    destination register mask components must be listed in "xyzw" order.
22165bd8deadSopenharmony_ci
22175bd8deadSopenharmony_ci    The optional condition code mask is specified by the <optionalCCMask> rule
22185bd8deadSopenharmony_ci    found in the <maskedDstReg> rule.  If <optionalCCMask> matches "", all
22195bd8deadSopenharmony_ci    components are enabled.  Otherwise, the condition code register is loaded
22205bd8deadSopenharmony_ci    and swizzled according to the swizzling specified by <swizzleSuffix>.
22215bd8deadSopenharmony_ci    Each component of the swizzled condition code is tested according to the
22225bd8deadSopenharmony_ci    rule given by <ccMaskRule>.  <ccMaskRule> may have the values "EQ", "NE",
22235bd8deadSopenharmony_ci    "LT", "GE", LE", or "GT", which mean to enable writes if the corresponding
22245bd8deadSopenharmony_ci    condition code field evaluates to equal, not equal, less than, greater
22255bd8deadSopenharmony_ci    than or equal, less than or equal, or greater than, respectively.
22265bd8deadSopenharmony_ci    Comparisons involving condition codes of "UN" (unordered) evaluate to true
22275bd8deadSopenharmony_ci    for "NE" and false otherwise.  For example, if the condition code is
22285bd8deadSopenharmony_ci    (GT,LT,EQ,GT) and the condition code mask is "(NE.zyxw)", the swizzle
22295bd8deadSopenharmony_ci    operation will load (EQ,LT,GT,GT) and the mask will thus will enable
22305bd8deadSopenharmony_ci    writes on the y, z, and w components.  In addition, "TR" always enables
22315bd8deadSopenharmony_ci    writes and "FL" always disables writes, regardless of the condition code.
22325bd8deadSopenharmony_ci
22335bd8deadSopenharmony_ci    Each component of the destination register is updated with the result of
22345bd8deadSopenharmony_ci    the fragment program if and only if the component is enabled for writes by
22355bd8deadSopenharmony_ci    both the component write mask and the optional condition code mask.
22365bd8deadSopenharmony_ci    Otherwise, the component of the destination register remains unchanged.
22375bd8deadSopenharmony_ci
22385bd8deadSopenharmony_ci    A fragment program instruction can also optionally update the condition
22395bd8deadSopenharmony_ci    code register.  The condition code is updated if the condition code
22405bd8deadSopenharmony_ci    register update suffix "C" is present in the instruction name.  The
22415bd8deadSopenharmony_ci    instruction "ADDC" will update the condition code; the otherwise
22425bd8deadSopenharmony_ci    equivalent instruction "ADD" will not.  If condition code updates are
22435bd8deadSopenharmony_ci    enabled, each component of the destination register enabled for writes is
22445bd8deadSopenharmony_ci    compared to zero.  The corresponding component of the condition code is
22455bd8deadSopenharmony_ci    set to "LT", "EQ", or "GT", if the written component is less than, equal
22465bd8deadSopenharmony_ci    to, or greater than zero, respectively.  Condition code components are set
22475bd8deadSopenharmony_ci    to "UN" if the written component is NaN.  Note that values of -0.0 and
22485bd8deadSopenharmony_ci    +0.0 both evaluate to "EQ".  If a component of the destination register is
22495bd8deadSopenharmony_ci    not enabled for writes, the corresponding condition code component is
22505bd8deadSopenharmony_ci    unchanged.
22515bd8deadSopenharmony_ci
22525bd8deadSopenharmony_ci    In the following example code,
22535bd8deadSopenharmony_ci
22545bd8deadSopenharmony_ci        # R1=(-2, 0, 2, NaN)              R0                  CC
22555bd8deadSopenharmony_ci        MOVC R0, R1;               # ( -2,  0,   2, NaN) (LT,EQ,GT,UN)
22565bd8deadSopenharmony_ci        MOVC R0.xyz, R1.yzwx;      # (  0,  2, NaN, NaN) (EQ,GT,UN,UN)
22575bd8deadSopenharmony_ci        MOVC R0 (NE), R1.zywx;     # (  0,  0, NaN,  -2) (EQ,EQ,UN,LT)
22585bd8deadSopenharmony_ci
22595bd8deadSopenharmony_ci    the first instruction writes (-2,0,2,NaN) to R0 and updates the condition
22605bd8deadSopenharmony_ci    code to (LT,EQ,GT,UN).  The second instruction, only the "x", "y", and "z"
22615bd8deadSopenharmony_ci    components of R0 and the condition code are updated, so R0 ends up with
22625bd8deadSopenharmony_ci    (0,2,NaN,NaN) and the condition code ends up with (EQ,GT,UN,UN).  In the
22635bd8deadSopenharmony_ci    third instruction, the condition code mask disables writes to the x
22645bd8deadSopenharmony_ci    component (its condition code field is "EQ"), so R0 ends up with
22655bd8deadSopenharmony_ci    (0,0,NaN,-2) and the condition code ends up with (EQ,EQ,UN,LT).
22665bd8deadSopenharmony_ci
22675bd8deadSopenharmony_ci    The following pseudocode illustrates the process of writing a result
22685bd8deadSopenharmony_ci    vector to the destination register.  In the example, "ccMaskRule" refers
22695bd8deadSopenharmony_ci    to the condition code mask rule given by <ccMaskRule> (or "" if no rule is
22705bd8deadSopenharmony_ci    specified), "instrmask" refers to the component write mask given by the
22715bd8deadSopenharmony_ci    <optionalWriteMask> rule, "updatecc" is TRUE if condition code updates are
22725bd8deadSopenharmony_ci    enabled, and "clamp01" is TRUE if [0,1] result clamping is enabled.
22735bd8deadSopenharmony_ci    "destination" and "cc" refer to the register selected by <dstRegister> and
22745bd8deadSopenharmony_ci    the condition code, respectively.
22755bd8deadSopenharmony_ci
22765bd8deadSopenharmony_ci      boolean TestCC(CondCode field) {
22775bd8deadSopenharmony_ci          switch (ccMaskRule) {
22785bd8deadSopenharmony_ci          case "EQ":  return (field == "EQ");
22795bd8deadSopenharmony_ci          case "NE":  return (field != "EQ");
22805bd8deadSopenharmony_ci          case "LT":  return (field == "LT");
22815bd8deadSopenharmony_ci          case "GE":  return (field == "GT" || field == "EQ");
22825bd8deadSopenharmony_ci          case "LE":  return (field == "LT" || field == "EQ");
22835bd8deadSopenharmony_ci          case "GT":  return (field == "GT");
22845bd8deadSopenharmony_ci          case "TR":  return TRUE;
22855bd8deadSopenharmony_ci          case "FL":  return FALSE;
22865bd8deadSopenharmony_ci          case "":    return TRUE;
22875bd8deadSopenharmony_ci      }
22885bd8deadSopenharmony_ci
22895bd8deadSopenharmony_ci      enum GenerateCC(DstT value) {
22905bd8deadSopenharmony_ci        if (value == NaN) {
22915bd8deadSopenharmony_ci          return UN;
22925bd8deadSopenharmony_ci        } else if (value < 0) {
22935bd8deadSopenharmony_ci          return LT;
22945bd8deadSopenharmony_ci        } else if (value == 0) {
22955bd8deadSopenharmony_ci          return EQ;
22965bd8deadSopenharmony_ci        } else {
22975bd8deadSopenharmony_ci          return GT;
22985bd8deadSopenharmony_ci        }
22995bd8deadSopenharmony_ci      }
23005bd8deadSopenharmony_ci
23015bd8deadSopenharmony_ci      void UpdateDestination(VecDstT destination, VecInstT result)
23025bd8deadSopenharmony_ci      {
23035bd8deadSopenharmony_ci          // Load the original destination register and condition code.
23045bd8deadSopenharmony_ci          VecDstT resultDst;
23055bd8deadSopenharmony_ci          VecDstT merged;
23065bd8deadSopenharmony_ci          VecCC   mergedCC;
23075bd8deadSopenharmony_ci
23085bd8deadSopenharmony_ci          // Clamp the result vector components to [0,1], if requested.
23095bd8deadSopenharmony_ci          if (clamp01) {
23105bd8deadSopenharmony_ci              if (result.x < 0)      result.x = 0;
23115bd8deadSopenharmony_ci              else if (result.x > 1) result.x = 1;
23125bd8deadSopenharmony_ci              if (result.y < 0)      result.y = 0;
23135bd8deadSopenharmony_ci              else if (result.y > 1) result.y = 1;
23145bd8deadSopenharmony_ci              if (result.z < 0)      result.z = 0;
23155bd8deadSopenharmony_ci              else if (result.z > 1) result.z = 1;
23165bd8deadSopenharmony_ci              if (result.w < 0)      result.w = 0;
23175bd8deadSopenharmony_ci              else if (result.w > 1) result.w = 1;
23185bd8deadSopenharmony_ci          }
23195bd8deadSopenharmony_ci
23205bd8deadSopenharmony_ci          // Convert the result to the type of the destination register.
23215bd8deadSopenharmony_ci          resultDst.x = TypeConvert(result.x);
23225bd8deadSopenharmony_ci          resultDst.y = TypeConvert(result.y);
23235bd8deadSopenharmony_ci          resultDst.z = TypeConvert(result.z);
23245bd8deadSopenharmony_ci          resultDst.w = TypeConvert(result.w);
23255bd8deadSopenharmony_ci
23265bd8deadSopenharmony_ci          // Merge the converted result into the destination register, under
23275bd8deadSopenharmony_ci          // control of the compile- and run-time write masks.
23285bd8deadSopenharmony_ci          merged = destination;
23295bd8deadSopenharmony_ci          mergedCC = cc;
23305bd8deadSopenharmony_ci          if (instrMask.x && TestCC(cc.c***)) {
23315bd8deadSopenharmony_ci              merged.x = result.x;
23325bd8deadSopenharmony_ci              if (updatecc) mergedCC.x = GenerateCC(result.x);
23335bd8deadSopenharmony_ci          }
23345bd8deadSopenharmony_ci          if (instrMask.y && TestCC(cc.*c**)) {
23355bd8deadSopenharmony_ci              merged.y = result.y;
23365bd8deadSopenharmony_ci              if (updatecc) mergedCC.y = GenerateCC(result.y);
23375bd8deadSopenharmony_ci          }
23385bd8deadSopenharmony_ci          if (instrMask.z && TestCC(cc.**c*)) {
23395bd8deadSopenharmony_ci              merged.z = result.z;
23405bd8deadSopenharmony_ci              if (updatecc) mergedCC.z = GenerateCC(result.z);
23415bd8deadSopenharmony_ci          }
23425bd8deadSopenharmony_ci          if (instrMask.w && TestCC(cc.***c)) {
23435bd8deadSopenharmony_ci              merged.w = result.w;
23445bd8deadSopenharmony_ci              if (updatecc) mergedCC.w = GenerateCC(result.w);
23455bd8deadSopenharmony_ci          }
23465bd8deadSopenharmony_ci
23475bd8deadSopenharmony_ci          // Write out the new destination register and result code.
23485bd8deadSopenharmony_ci          destination = merged;
23495bd8deadSopenharmony_ci          cc = mergedCC;
23505bd8deadSopenharmony_ci      }
23515bd8deadSopenharmony_ci
23525bd8deadSopenharmony_ci    Section 3.11.5, Fragment Program Instruction Set
23535bd8deadSopenharmony_ci
23545bd8deadSopenharmony_ci    The following sections describe the instruction set available to fragment
23555bd8deadSopenharmony_ci    programs.
23565bd8deadSopenharmony_ci
23575bd8deadSopenharmony_ci
23585bd8deadSopenharmony_ci    Section 3.11.5.1,  ADD:  Add
23595bd8deadSopenharmony_ci
23605bd8deadSopenharmony_ci    The ADD instruction performs a component-wise add of the two operands to
23615bd8deadSopenharmony_ci    yield a result vector.
23625bd8deadSopenharmony_ci
23635bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
23645bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
23655bd8deadSopenharmony_ci      result.x = tmp0.x + tmp1.x;
23665bd8deadSopenharmony_ci      result.y = tmp0.y + tmp1.y;
23675bd8deadSopenharmony_ci      result.z = tmp0.z + tmp1.z;
23685bd8deadSopenharmony_ci      result.w = tmp0.w + tmp1.w;
23695bd8deadSopenharmony_ci
23705bd8deadSopenharmony_ci    The following special-case rules apply to addition:
23715bd8deadSopenharmony_ci
23725bd8deadSopenharmony_ci      1. "A+B" is always equivalent to "B+A".
23735bd8deadSopenharmony_ci      2. NaN + <x> = NaN, for all <x>.
23745bd8deadSopenharmony_ci      3. +INF + <x> = +INF, for all <x> except NaN and -INF.
23755bd8deadSopenharmony_ci      4. -INF + <x> = -INF, for all <x> except NaN and +INF.
23765bd8deadSopenharmony_ci      5. +INF + -INF = NaN.
23775bd8deadSopenharmony_ci      6. -0.0 + <x> = <x>, for all <x>.
23785bd8deadSopenharmony_ci      7. +0.0 + <x> = <x>, for all <x> except -0.0.
23795bd8deadSopenharmony_ci
23805bd8deadSopenharmony_ci
23815bd8deadSopenharmony_ci    Section 3.11.5.2,  COS:  Cosine
23825bd8deadSopenharmony_ci
23835bd8deadSopenharmony_ci    The COS instruction approximates the cosine of the angle specified by the
23845bd8deadSopenharmony_ci    scalar operand and replicates the approximation to all four components of
23855bd8deadSopenharmony_ci    the result vector.  The angle is specified in radians and does not have to
23865bd8deadSopenharmony_ci    be in the range [0,2*PI].
23875bd8deadSopenharmony_ci
23885bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
23895bd8deadSopenharmony_ci      result.x = ApproxCosine(tmp);
23905bd8deadSopenharmony_ci      result.y = ApproxCosine(tmp);
23915bd8deadSopenharmony_ci      result.z = ApproxCosine(tmp);
23925bd8deadSopenharmony_ci      result.w = ApproxCosine(tmp);
23935bd8deadSopenharmony_ci
23945bd8deadSopenharmony_ci    The approximation function ApproxCosine is accurate to at least 22 bits
23955bd8deadSopenharmony_ci    with an angle in the range [0,2*PI].
23965bd8deadSopenharmony_ci
23975bd8deadSopenharmony_ci      | ApproxCosine(x) - cos(x) | < 1.0 / 2^22, if 0.0 <= x < 2.0 * PI.
23985bd8deadSopenharmony_ci
23995bd8deadSopenharmony_ci    The error in the approximation will typically increase with the absolute
24005bd8deadSopenharmony_ci    value of the angle when the angle falls outside the range [0,2*PI].
24015bd8deadSopenharmony_ci
24025bd8deadSopenharmony_ci    The following special-case rules apply to cosine approximation:
24035bd8deadSopenharmony_ci
24045bd8deadSopenharmony_ci      1. ApproxCosine(NaN) = NaN.
24055bd8deadSopenharmony_ci      2. ApproxCosine(+/-INF) = NaN.
24065bd8deadSopenharmony_ci      3. ApproxCosine(+/-0.0) = +1.0.
24075bd8deadSopenharmony_ci
24085bd8deadSopenharmony_ci
24095bd8deadSopenharmony_ci    Section 3.11.5.3,  DDX:  Derivative Relative to X
24105bd8deadSopenharmony_ci
24115bd8deadSopenharmony_ci    The DDX instruction computes approximate partial derivatives of the four
24125bd8deadSopenharmony_ci    components of the single operand with respect to the X window coordinate
24135bd8deadSopenharmony_ci    to yield a result vector.  The partial derivative is evaluated at the
24145bd8deadSopenharmony_ci    center of the pixel.
24155bd8deadSopenharmony_ci
24165bd8deadSopenharmony_ci      f = VectorLoad(op0);
24175bd8deadSopenharmony_ci      result = ComputePartialX(f);
24185bd8deadSopenharmony_ci
24195bd8deadSopenharmony_ci    Note that the partial derivates obtained by this instruction are
24205bd8deadSopenharmony_ci    approximate, and derivative-of-derivate instruction sequences may not
24215bd8deadSopenharmony_ci    yield accurate second derivatives.  
24225bd8deadSopenharmony_ci
24235bd8deadSopenharmony_ci    For components with partial derivatives that overflow (including +/-INF
24245bd8deadSopenharmony_ci    inputs), the resulting partials may be encoded as large floating-point
24255bd8deadSopenharmony_ci    numbers instead of +/-INF.
24265bd8deadSopenharmony_ci
24275bd8deadSopenharmony_ci
24285bd8deadSopenharmony_ci    Section 3.11.5.4,  DDY:  Derivative Relative to Y
24295bd8deadSopenharmony_ci
24305bd8deadSopenharmony_ci    The DDY instruction computes approximate partial derivatives of the four
24315bd8deadSopenharmony_ci    components of the single operand with respect to the Y window coordinate
24325bd8deadSopenharmony_ci    to yield a result vector.  The partial derivative is evaluated at the
24335bd8deadSopenharmony_ci    center of the pixel.
24345bd8deadSopenharmony_ci
24355bd8deadSopenharmony_ci      f = VectorLoad(op0);
24365bd8deadSopenharmony_ci      result = ComputePartialY(f);
24375bd8deadSopenharmony_ci
24385bd8deadSopenharmony_ci    Note that the partial derivates obtained by this instruction are
24395bd8deadSopenharmony_ci    approximate, and derivative-of-derivate instruction sequences may not
24405bd8deadSopenharmony_ci    yield accurate second derivatives.
24415bd8deadSopenharmony_ci
24425bd8deadSopenharmony_ci    For components with partial derivatives that overflow (including +/-INF
24435bd8deadSopenharmony_ci    inputs), the resulting partials may be encoded as large floating-point
24445bd8deadSopenharmony_ci    numbers instead of +/-INF.
24455bd8deadSopenharmony_ci
24465bd8deadSopenharmony_ci
24475bd8deadSopenharmony_ci    Section 3.11.5.5,  DP3:  3-Component Dot Product
24485bd8deadSopenharmony_ci
24495bd8deadSopenharmony_ci    The DP3 instruction computes a three component dot product of the two
24505bd8deadSopenharmony_ci    operands (using the x, y, and z components) and replicates the dot product
24515bd8deadSopenharmony_ci    to all four components of the result vector.
24525bd8deadSopenharmony_ci
24535bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
24545bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1):
24555bd8deadSopenharmony_ci      result.x = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24565bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z);
24575bd8deadSopenharmony_ci      result.y = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24585bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z);
24595bd8deadSopenharmony_ci      result.z = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24605bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z);
24615bd8deadSopenharmony_ci      result.w = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24625bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z);
24635bd8deadSopenharmony_ci
24645bd8deadSopenharmony_ci
24655bd8deadSopenharmony_ci    Section 3.11.5.6,  DP4:  4-Component Dot Product
24665bd8deadSopenharmony_ci
24675bd8deadSopenharmony_ci    The DP4 instruction computes a four component dot product of the two
24685bd8deadSopenharmony_ci    operands and replicates the dot product to all four components of the
24695bd8deadSopenharmony_ci    result vector.
24705bd8deadSopenharmony_ci
24715bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
24725bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1):
24735bd8deadSopenharmony_ci      result.x = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24745bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z) + (tmp0.w * tmp1.w);
24755bd8deadSopenharmony_ci      result.y = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24765bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z) + (tmp0.w * tmp1.w);
24775bd8deadSopenharmony_ci      result.z = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24785bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z) + (tmp0.w * tmp1.w);
24795bd8deadSopenharmony_ci      result.w = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
24805bd8deadSopenharmony_ci                 (tmp0.z * tmp2.z) + (tmp0.w * tmp1.w);
24815bd8deadSopenharmony_ci
24825bd8deadSopenharmony_ci
24835bd8deadSopenharmony_ci    Section 3.11.5.7,  DST:  Distance Vector
24845bd8deadSopenharmony_ci
24855bd8deadSopenharmony_ci    The DST instruction computes a distance vector from two specially-
24865bd8deadSopenharmony_ci    formatted operands.  The first operand should be of the form [NA, d^2,
24875bd8deadSopenharmony_ci    d^2, NA] and the second operand should be of the form [NA, 1/d, NA, 1/d],
24885bd8deadSopenharmony_ci    where NA values are not relevant to the calculation and d is a vector
24895bd8deadSopenharmony_ci    length.  If both vectors satisfy these conditions, the result vector will
24905bd8deadSopenharmony_ci    be of the form [1.0, d, d^2, 1/d].
24915bd8deadSopenharmony_ci
24925bd8deadSopenharmony_ci    The exact behavior is specified in the following pseudo-code:
24935bd8deadSopenharmony_ci
24945bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
24955bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
24965bd8deadSopenharmony_ci      result.x = 1.0;
24975bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y;
24985bd8deadSopenharmony_ci      result.z = tmp0.z;
24995bd8deadSopenharmony_ci      result.w = tmp1.w;
25005bd8deadSopenharmony_ci
25015bd8deadSopenharmony_ci    Given an arbitrary vector, d^2 can be obtained using the DOT3 instruction
25025bd8deadSopenharmony_ci    (using the same vector for both operands) and 1/d can be obtained from d^2
25035bd8deadSopenharmony_ci    using the RSQ instruction.
25045bd8deadSopenharmony_ci
25055bd8deadSopenharmony_ci    This distance vector is useful for per-fragment light attenuation
25065bd8deadSopenharmony_ci    calculations:  a DOT3 operation involving the distance vector and an
25075bd8deadSopenharmony_ci    attenuation constants vector will yield the attenuation factor.
25085bd8deadSopenharmony_ci
25095bd8deadSopenharmony_ci
25105bd8deadSopenharmony_ci    Section 3.11.5.8,  EX2:  Exponential Base 2
25115bd8deadSopenharmony_ci
25125bd8deadSopenharmony_ci    The EX2 instruction approximates 2 raised to the power of the scalar
25135bd8deadSopenharmony_ci    operand and replicates it to all four components of the result
25145bd8deadSopenharmony_ci    vector.
25155bd8deadSopenharmony_ci
25165bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
25175bd8deadSopenharmony_ci      result.x = Approx2ToX(tmp);
25185bd8deadSopenharmony_ci      result.y = Approx2ToX(tmp);
25195bd8deadSopenharmony_ci      result.z = Approx2ToX(tmp);
25205bd8deadSopenharmony_ci      result.w = Approx2ToX(tmp);
25215bd8deadSopenharmony_ci
25225bd8deadSopenharmony_ci    The approximation function is accurate to at least 22 bits:
25235bd8deadSopenharmony_ci
25245bd8deadSopenharmony_ci      | Approx2ToX(x) - 2^x | < 1.0 / 2^22, if 0.0 <= x < 1.0,
25255bd8deadSopenharmony_ci
25265bd8deadSopenharmony_ci    and, in general,
25275bd8deadSopenharmony_ci   
25285bd8deadSopenharmony_ci      | Approx2ToX(x) - 2^x | < (1.0 / 2^22) * (2^floor(x)).
25295bd8deadSopenharmony_ci
25305bd8deadSopenharmony_ci    The following special-case rules apply to exponential approximation:
25315bd8deadSopenharmony_ci
25325bd8deadSopenharmony_ci      1. Approx2ToX(NaN) = NaN.
25335bd8deadSopenharmony_ci      2. Approx2ToX(-INF) = +0.0.
25345bd8deadSopenharmony_ci      3. Approx2ToX(+INF) = +INF.
25355bd8deadSopenharmony_ci      4. Approx2ToX(+/-0.0) = +1.0.
25365bd8deadSopenharmony_ci
25375bd8deadSopenharmony_ci
25385bd8deadSopenharmony_ci    Section 3.11.5.9,  FLR:  Floor
25395bd8deadSopenharmony_ci
25405bd8deadSopenharmony_ci    The FLR instruction performs a component-wise floor operation on the
25415bd8deadSopenharmony_ci    operand to generate a result vector.  The floor of a value is defined as
25425bd8deadSopenharmony_ci    the largest integer less than or equal to the value.  The floor of 2.3 is
25435bd8deadSopenharmony_ci    2.0; the floor of -3.6 is -4.0.
25445bd8deadSopenharmony_ci
25455bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
25465bd8deadSopenharmony_ci      result.x = floor(tmp.x);
25475bd8deadSopenharmony_ci      result.y = floor(tmp.y);
25485bd8deadSopenharmony_ci      result.z = floor(tmp.z);
25495bd8deadSopenharmony_ci      result.w = floor(tmp.w);
25505bd8deadSopenharmony_ci
25515bd8deadSopenharmony_ci    The following special-case rules apply to floor computation:
25525bd8deadSopenharmony_ci
25535bd8deadSopenharmony_ci      1. floor(NaN) = NaN.
25545bd8deadSopenharmony_ci      2. floor(<x>) = <x>, for -0.0, +0.0, -INF, and +INF.  In all cases, the
25555bd8deadSopenharmony_ci         sign of the result is equal to the sign of the operand.
25565bd8deadSopenharmony_ci
25575bd8deadSopenharmony_ci
25585bd8deadSopenharmony_ci    Section 3.11.5.10,  FRC:  Fraction
25595bd8deadSopenharmony_ci
25605bd8deadSopenharmony_ci    The FRC instruction extracts the fractional portion of each component of
25615bd8deadSopenharmony_ci    the operand to generate a result vector.  The fractional portion of a
25625bd8deadSopenharmony_ci    component is defined as the result after subtracting off the floor of the
25635bd8deadSopenharmony_ci    component (see FLR), and is always in the range [0.00, 1.00).
25645bd8deadSopenharmony_ci
25655bd8deadSopenharmony_ci    For negative values, the fractional portion is NOT the number written to
25665bd8deadSopenharmony_ci    the right of the decimal point -- the fractional portion of -1.7 is not
25675bd8deadSopenharmony_ci    0.7 -- it is 0.3.  0.3 is produced by subtracting the floor of -1.7 (-2.0)
25685bd8deadSopenharmony_ci    from -1.7.
25695bd8deadSopenharmony_ci
25705bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
25715bd8deadSopenharmony_ci      result.x = tmp.x - floor(tmp.x);
25725bd8deadSopenharmony_ci      result.y = tmp.y - floor(tmp.y);
25735bd8deadSopenharmony_ci      result.z = tmp.z - floor(tmp.z);
25745bd8deadSopenharmony_ci      result.w = tmp.w - floor(tmp.w);
25755bd8deadSopenharmony_ci
25765bd8deadSopenharmony_ci    The following special-case rules, which can be derived from the rules for
25775bd8deadSopenharmony_ci    FLR and ADD apply to fraction computation:
25785bd8deadSopenharmony_ci
25795bd8deadSopenharmony_ci      1. fraction(NaN) = NaN.
25805bd8deadSopenharmony_ci      2. fraction(+/-INF) = NaN.
25815bd8deadSopenharmony_ci      3. fraction(+/-0.0) = +0.0.
25825bd8deadSopenharmony_ci
25835bd8deadSopenharmony_ci
25845bd8deadSopenharmony_ci    Section 3.11.5.11,  KIL:  Conditionally Discard Fragment
25855bd8deadSopenharmony_ci
25865bd8deadSopenharmony_ci    The KIL instruction is unlike any other instruction in the instruction
25875bd8deadSopenharmony_ci    set.  This instruction evaluates components of a swizzled condition code
25885bd8deadSopenharmony_ci    using a test expression identical to that used to evaluate condition code
25895bd8deadSopenharmony_ci    write masks (Section 3.11.4.4).  If any condition code component evaluates
25905bd8deadSopenharmony_ci    to TRUE, the fragment is discarded.  Otherwise, the instruction has no
25915bd8deadSopenharmony_ci    effect.  The condition code components are specified, swizzled, and
25925bd8deadSopenharmony_ci    evaluated in the same manner as the condition code write mask.
25935bd8deadSopenharmony_ci
25945bd8deadSopenharmony_ci      if (TestCC(rc.c***) || TestCC(rc.*c**) || 
25955bd8deadSopenharmony_ci          TestCC(rc.**c*) || TestCC(rc.***c)) {
25965bd8deadSopenharmony_ci         // Discard the fragment.
25975bd8deadSopenharmony_ci      } else {
25985bd8deadSopenharmony_ci        // Do nothing.
25995bd8deadSopenharmony_ci      }
26005bd8deadSopenharmony_ci
26015bd8deadSopenharmony_ci    If the fragment is discarded, it is treated as though it were not produced
26025bd8deadSopenharmony_ci    by rasterization.  In particular, none of the per-fragment operations
26035bd8deadSopenharmony_ci    (such as stencil tests, blends, stencil, depth, or color buffer writes)
26045bd8deadSopenharmony_ci    are performed on the fragment.
26055bd8deadSopenharmony_ci
26065bd8deadSopenharmony_ci
26075bd8deadSopenharmony_ci    Section 3.11.5.12,  LG2:  Logarithm Base 2
26085bd8deadSopenharmony_ci
26095bd8deadSopenharmony_ci    The LG2 instruction approximates the base 2 logarithm of the scalar
26105bd8deadSopenharmony_ci    operand and replicates it to all four components of the result vector.
26115bd8deadSopenharmony_ci
26125bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
26135bd8deadSopenharmony_ci      result.x = ApproxLog2(tmp);
26145bd8deadSopenharmony_ci      result.y = ApproxLog2(tmp);
26155bd8deadSopenharmony_ci      result.z = ApproxLog2(tmp);
26165bd8deadSopenharmony_ci      result.w = ApproxLog2(tmp);
26175bd8deadSopenharmony_ci   
26185bd8deadSopenharmony_ci    The approximation function is accurate to at least 22 bits:
26195bd8deadSopenharmony_ci
26205bd8deadSopenharmony_ci      | ApproxLog2(x) - log_2(x) | < 1.0 / 2^22.
26215bd8deadSopenharmony_ci
26225bd8deadSopenharmony_ci    Note that for large values of x, there are not enough bits in the
26235bd8deadSopenharmony_ci    floating-point storage format to represent a result that precisely.
26245bd8deadSopenharmony_ci
26255bd8deadSopenharmony_ci    The following special-case rules apply to logarithm approximation:
26265bd8deadSopenharmony_ci
26275bd8deadSopenharmony_ci      1. ApproxLog2(NaN) = NaN.
26285bd8deadSopenharmony_ci      2. ApproxLog2(+INF) = +INF.
26295bd8deadSopenharmony_ci      3. ApproxLog2(+/-0.0) = -INF.
26305bd8deadSopenharmony_ci      4. ApproxLog2(x) = NaN, -INF < x < -0.0.
26315bd8deadSopenharmony_ci      5. ApproxLog2(-INF) = NaN.
26325bd8deadSopenharmony_ci
26335bd8deadSopenharmony_ci
26345bd8deadSopenharmony_ci    Section 3.11.5.13,  LIT:  Compute Light Coefficients
26355bd8deadSopenharmony_ci
26365bd8deadSopenharmony_ci    The LIT instruction accelerates per-fragment lighting by computing
26375bd8deadSopenharmony_ci    lighting coefficients for ambient, diffuse, and specular light
26385bd8deadSopenharmony_ci    contributions.  The "x" component of the operand is assumed to hold a
26395bd8deadSopenharmony_ci    diffuse dot product (n dot VP_pli, as in the vertex lighting equations in
26405bd8deadSopenharmony_ci    Section 2.13.1).  The "y" component of the operand is assumed to hold a
26415bd8deadSopenharmony_ci    specular dot product (n dot h_i).  The "w" component of the operand is
26425bd8deadSopenharmony_ci    assumed to hold the specular exponent of the material (s_rm).
26435bd8deadSopenharmony_ci
26445bd8deadSopenharmony_ci    The "x" component of the result vector receives the value that should be
26455bd8deadSopenharmony_ci    multiplied by the ambient light/material product (always 1.0).  The "y"
26465bd8deadSopenharmony_ci    component of the result vector receives the value that should be
26475bd8deadSopenharmony_ci    multiplied by the diffuse light/material product (n dot VP_pli).  The "z"
26485bd8deadSopenharmony_ci    component of the result vector receives the value that should be
26495bd8deadSopenharmony_ci    multiplied by the specular light/material product (f_i * (n dot h_i) ^
26505bd8deadSopenharmony_ci    s_rm).  The "w" component of the result is the constant 1.0.
26515bd8deadSopenharmony_ci
26525bd8deadSopenharmony_ci    Negative diffuse and specular dot products are clamped to 0.0, as is done
26535bd8deadSopenharmony_ci    in the standard per-vertex lighting operations.  In addition, if the
26545bd8deadSopenharmony_ci    diffuse dot product is zero or negative, the specular coefficient is
26555bd8deadSopenharmony_ci    forced to zero.
26565bd8deadSopenharmony_ci
26575bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
26585bd8deadSopenharmony_ci      if (t.x < 0) t.x = 0;
26595bd8deadSopenharmony_ci      if (t.y < 0) t.y = 0;
26605bd8deadSopenharmony_ci      result.x = 1.0;
26615bd8deadSopenharmony_ci      result.y = t.x;
26625bd8deadSopenharmony_ci      result.z = (t.x > 0) ? ApproxPower(t.y, t.w) : 0.0;
26635bd8deadSopenharmony_ci      result.w = 1.0;
26645bd8deadSopenharmony_ci
26655bd8deadSopenharmony_ci    The exponentiation approximation used to compute result.z are identical to
26665bd8deadSopenharmony_ci    that used in the POW instruction, including errors and the processing of
26675bd8deadSopenharmony_ci    any special cases.
26685bd8deadSopenharmony_ci
26695bd8deadSopenharmony_ci
26705bd8deadSopenharmony_ci    Section 3.11.5.14,  LRP:  Linear Interpolation
26715bd8deadSopenharmony_ci
26725bd8deadSopenharmony_ci    The LRP instruction performs a component-wise linear interpolation to
26735bd8deadSopenharmony_ci    yield a result vector.  It interpolates between the components of the
26745bd8deadSopenharmony_ci    second and third operands, using the first operand as a weight.
26755bd8deadSopenharmony_ci
26765bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
26775bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
26785bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
26795bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x + (1 - tmp0.x) * tmp2.x;
26805bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y + (1 - tmp0.y) * tmp2.y;
26815bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z + (1 - tmp0.z) * tmp2.z;
26825bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w + (1 - tmp0.w) * tmp2.w;
26835bd8deadSopenharmony_ci
26845bd8deadSopenharmony_ci
26855bd8deadSopenharmony_ci    Section 3.11.5.15,  MAD:  Multiply and Add
26865bd8deadSopenharmony_ci
26875bd8deadSopenharmony_ci    The MAD instruction performs a component-wise multiply of the first two
26885bd8deadSopenharmony_ci    operands, and then does a component-wise add of the product to the third
26895bd8deadSopenharmony_ci    operand to yield a result vector.
26905bd8deadSopenharmony_ci
26915bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
26925bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
26935bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
26945bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x + tmp2.x;
26955bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y + tmp2.y;
26965bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z + tmp2.z;
26975bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w + tmp2.w;
26985bd8deadSopenharmony_ci
26995bd8deadSopenharmony_ci
27005bd8deadSopenharmony_ci    Section 3.11.5.16,  MAX:  maximum
27015bd8deadSopenharmony_ci
27025bd8deadSopenharmony_ci    The MAX instruction computes component-wise maximums of the values in the
27035bd8deadSopenharmony_ci    two operands to yield a result vector.
27045bd8deadSopenharmony_ci
27055bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27065bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
27075bd8deadSopenharmony_ci      result.x = max(tmp0.x, tmp1.x);
27085bd8deadSopenharmony_ci      result.y = max(tmp0.y, tmp1.y);
27095bd8deadSopenharmony_ci      result.z = max(tmp0.z, tmp1.z);
27105bd8deadSopenharmony_ci      result.w = max(tmp0.w, tmp1.w);
27115bd8deadSopenharmony_ci
27125bd8deadSopenharmony_ci    The following special cases apply to the maximum operation:
27135bd8deadSopenharmony_ci
27145bd8deadSopenharmony_ci      1. max(A,B) is always equivalent to max(B,A).
27155bd8deadSopenharmony_ci      2. max(NaN, <x>) == NaN, for all <x>.
27165bd8deadSopenharmony_ci
27175bd8deadSopenharmony_ci    
27185bd8deadSopenharmony_ci
27195bd8deadSopenharmony_ci    Section 3.11.5.17,  MIN:  minimum
27205bd8deadSopenharmony_ci
27215bd8deadSopenharmony_ci    The MIN instruction computes component-wise minimums of the values in the
27225bd8deadSopenharmony_ci    two operands to yield a result vector.
27235bd8deadSopenharmony_ci
27245bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27255bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
27265bd8deadSopenharmony_ci      result.x = min(tmp0.x, tmp1.x);
27275bd8deadSopenharmony_ci      result.y = min(tmp0.y, tmp1.y);
27285bd8deadSopenharmony_ci      result.z = min(tmp0.z, tmp1.z);
27295bd8deadSopenharmony_ci      result.w = min(tmp0.w, tmp1.w);
27305bd8deadSopenharmony_ci
27315bd8deadSopenharmony_ci    The following special cases apply to the minimum operation:
27325bd8deadSopenharmony_ci
27335bd8deadSopenharmony_ci      1. min(A,B) is always equivalent to min(B,A).
27345bd8deadSopenharmony_ci      2. min(NaN, <x>) == NaN, for all <x>.
27355bd8deadSopenharmony_ci
27365bd8deadSopenharmony_ci
27375bd8deadSopenharmony_ci    Section 3.11.5.18,  MOV:  Move
27385bd8deadSopenharmony_ci
27395bd8deadSopenharmony_ci    The MOV instruction copies the value of the operand to yield a result
27405bd8deadSopenharmony_ci    vector.
27415bd8deadSopenharmony_ci
27425bd8deadSopenharmony_ci      result = VectorLoad(op0);
27435bd8deadSopenharmony_ci
27445bd8deadSopenharmony_ci
27455bd8deadSopenharmony_ci    Section 3.11.5.19,  MUL:  Multiply
27465bd8deadSopenharmony_ci
27475bd8deadSopenharmony_ci    The MUL instruction performs a component-wise multiply of the two operands
27485bd8deadSopenharmony_ci    to yield a result vector.
27495bd8deadSopenharmony_ci
27505bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27515bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
27525bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x;
27535bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y;
27545bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z;
27555bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w;
27565bd8deadSopenharmony_ci
27575bd8deadSopenharmony_ci    The following special-case rules apply to multiplication:
27585bd8deadSopenharmony_ci
27595bd8deadSopenharmony_ci      1. "A*B" is always equivalent to "B*A".
27605bd8deadSopenharmony_ci      2. NaN * <x> = NaN, for all <x>.
27615bd8deadSopenharmony_ci      3. +/-0.0 * +/-INF = NaN.
27625bd8deadSopenharmony_ci      4. +/-0.0 * <x> = +/-0.0, for all <x> except -INF, +INF, and NaN.  The
27635bd8deadSopenharmony_ci         sign of the result is positive if the signs of the two operands match
27645bd8deadSopenharmony_ci         and negative otherwise.
27655bd8deadSopenharmony_ci      5. +/-INF * <x> = +/-INF, for all <x> except -0.0, +0.0, and NaN.  The 
27665bd8deadSopenharmony_ci         sign of the result is positive if the signs of the two operands match
27675bd8deadSopenharmony_ci         and negative otherwise.
27685bd8deadSopenharmony_ci      6. +1.0 * <x> = <x>, for all <x>.
27695bd8deadSopenharmony_ci
27705bd8deadSopenharmony_ci
27715bd8deadSopenharmony_ci    Section 3.11.5.20,  PK2H:  Pack Two 16-bit Floats
27725bd8deadSopenharmony_ci
27735bd8deadSopenharmony_ci    The PK2H instruction converts the "x" and "y" components of the single
27745bd8deadSopenharmony_ci    operand into 16-bit floating-point format, packs the bit representation of
27755bd8deadSopenharmony_ci    these two floats into a 32-bit value, and replicates that value to all
27765bd8deadSopenharmony_ci    four components of the result vector.  The PK2H instruction can be
27775bd8deadSopenharmony_ci    reversed by the UP2H instruction below.
27785bd8deadSopenharmony_ci
27795bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27805bd8deadSopenharmony_ci      /* result obtained by combining raw bits of tmp0.x, tmp0.y */
27815bd8deadSopenharmony_ci      result.x = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
27825bd8deadSopenharmony_ci      result.y = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
27835bd8deadSopenharmony_ci      result.z = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
27845bd8deadSopenharmony_ci      result.w = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
27855bd8deadSopenharmony_ci
27865bd8deadSopenharmony_ci    The result must be written to a register with 32-bit components (an "R"
27875bd8deadSopenharmony_ci    register, o[COLR], or o[DEPR]).  A fragment program will fail to load if
27885bd8deadSopenharmony_ci    any other register type is specified.
27895bd8deadSopenharmony_ci
27905bd8deadSopenharmony_ci
27915bd8deadSopenharmony_ci    Section 3.11.5.21,  PK2US:  Pack Two Unsigned 16-bit Scalars
27925bd8deadSopenharmony_ci
27935bd8deadSopenharmony_ci    The PK2US instruction converts the "x" and "y" components of the single
27945bd8deadSopenharmony_ci    operand into a packed pair of 16-bit unsigned scalars.  The scalars are
27955bd8deadSopenharmony_ci    represented in a bit pattern where all '0' bits corresponds to 0.0 and all
27965bd8deadSopenharmony_ci    '1' bits corresponds to 1.0.  The bit representations of the two converted
27975bd8deadSopenharmony_ci    components are packed into a 32-bit value, and that value is replicated to
27985bd8deadSopenharmony_ci    all four components of the result vector.  The PK2US instruction can be
27995bd8deadSopenharmony_ci    reversed by the UP2US instruction below.
28005bd8deadSopenharmony_ci
28015bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
28025bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
28035bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
28045bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
28055bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
28065bd8deadSopenharmony_ci      us.x = round(65535.0 * tmp0.x);  /* us is a ushort vector */
28075bd8deadSopenharmony_ci      us.y = round(65535.0 * tmp0.y);
28085bd8deadSopenharmony_ci      /* result obtained by combining raw bits of us. */
28095bd8deadSopenharmony_ci      result.x = ((us.x) | (us.y << 16));
28105bd8deadSopenharmony_ci      result.y = ((us.x) | (us.y << 16));
28115bd8deadSopenharmony_ci      result.z = ((us.x) | (us.y << 16));
28125bd8deadSopenharmony_ci      result.w = ((us.x) | (us.y << 16));
28135bd8deadSopenharmony_ci
28145bd8deadSopenharmony_ci    The result must be written to a register with 32-bit components (an "R"
28155bd8deadSopenharmony_ci    register, o[COLR], or o[DEPR]).  A fragment program will fail to load if
28165bd8deadSopenharmony_ci    any other register type is specified.
28175bd8deadSopenharmony_ci
28185bd8deadSopenharmony_ci
28195bd8deadSopenharmony_ci    Section 3.11.5.22,  PK4B:  Pack Four Signed 8-bit Scalars
28205bd8deadSopenharmony_ci
28215bd8deadSopenharmony_ci    The PK4B instruction converts the four components of the single operand
28225bd8deadSopenharmony_ci    into 8-bit signed quantities.  The signed quantities are represented in a
28235bd8deadSopenharmony_ci    bit pattern where all '0' bits corresponds to -128/127 and all '1' bits
28245bd8deadSopenharmony_ci    corresponds to +127/127.  The bit representations of the four converted
28255bd8deadSopenharmony_ci    components are packed into a 32-bit value, and that value is replicated to
28265bd8deadSopenharmony_ci    all four components of the result vector.  The PK4B instruction can be
28275bd8deadSopenharmony_ci    reversed by the UP4B instruction below.
28285bd8deadSopenharmony_ci
28295bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
28305bd8deadSopenharmony_ci      if (tmp0.x < -128/127) tmp0.x = -128/127;
28315bd8deadSopenharmony_ci      if (tmp0.y < -128/127) tmp0.y = -128/127;
28325bd8deadSopenharmony_ci      if (tmp0.z < -128/127) tmp0.z = -128/127;
28335bd8deadSopenharmony_ci      if (tmp0.w < -128/127) tmp0.w = -128/127;
28345bd8deadSopenharmony_ci      if (tmp0.x > +127/127) tmp0.x = +127/127;
28355bd8deadSopenharmony_ci      if (tmp0.y > +127/127) tmp0.y = +127/127;
28365bd8deadSopenharmony_ci      if (tmp0.z > +127/127) tmp0.z = +127/127;
28375bd8deadSopenharmony_ci      if (tmp0.w > +127/127) tmp0.w = +127/127;
28385bd8deadSopenharmony_ci      ub.x = round(127.0 * tmp0.x + 128.0);  /* ub is a ubyte vector */
28395bd8deadSopenharmony_ci      ub.y = round(127.0 * tmp0.y + 128.0);
28405bd8deadSopenharmony_ci      ub.z = round(127.0 * tmp0.z + 128.0);
28415bd8deadSopenharmony_ci      ub.w = round(127.0 * tmp0.w + 128.0);
28425bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
28435bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28445bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28455bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28465bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28475bd8deadSopenharmony_ci
28485bd8deadSopenharmony_ci    The result must be written to a register with 32-bit components (an "R"
28495bd8deadSopenharmony_ci    register, o[COLR], or o[DEPR]).  A fragment program will fail to load if
28505bd8deadSopenharmony_ci    any other register type is specified.
28515bd8deadSopenharmony_ci
28525bd8deadSopenharmony_ci
28535bd8deadSopenharmony_ci    Section 3.11.5.23,  PK4UB:  Pack Four Unsigned 8-bit Scalars
28545bd8deadSopenharmony_ci
28555bd8deadSopenharmony_ci    The PK4UB instruction converts the four components of the single operand
28565bd8deadSopenharmony_ci    into a packed grouping of 8-bit unsigned scalars.  The scalars are
28575bd8deadSopenharmony_ci    represented in a bit pattern where all '0' bits corresponds to 0.0 and all
28585bd8deadSopenharmony_ci    '1' bits corresponds to 1.0.  The bit representations of the four
28595bd8deadSopenharmony_ci    converted components are packed into a 32-bit value, and that value is
28605bd8deadSopenharmony_ci    replicated to all four components of the result vector.  The PK4UB
28615bd8deadSopenharmony_ci    instruction can be reversed by the UP4UB instruction below.
28625bd8deadSopenharmony_ci
28635bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
28645bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
28655bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
28665bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
28675bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
28685bd8deadSopenharmony_ci      if (tmp0.z < 0.0) tmp0.z = 0.0;
28695bd8deadSopenharmony_ci      if (tmp0.z > 1.0) tmp0.z = 1.0;
28705bd8deadSopenharmony_ci      if (tmp0.w < 0.0) tmp0.w = 0.0;
28715bd8deadSopenharmony_ci      if (tmp0.w > 1.0) tmp0.w = 1.0;
28725bd8deadSopenharmony_ci      ub.x = round(255.0 * tmp0.x);  /* ub is a ubyte vector */
28735bd8deadSopenharmony_ci      ub.y = round(255.0 * tmp0.y);
28745bd8deadSopenharmony_ci      ub.z = round(255.0 * tmp0.z);
28755bd8deadSopenharmony_ci      ub.w = round(255.0 * tmp0.w);
28765bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
28775bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28785bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28795bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28805bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
28815bd8deadSopenharmony_ci
28825bd8deadSopenharmony_ci    The result must be written to a register with 32-bit components (an "R"
28835bd8deadSopenharmony_ci    register, o[COLR], or o[DEPR]).  A fragment program will fail to load if
28845bd8deadSopenharmony_ci    any other register type is specified.
28855bd8deadSopenharmony_ci
28865bd8deadSopenharmony_ci
28875bd8deadSopenharmony_ci    Section 3.11.5.24,  POW:  Exponentiation
28885bd8deadSopenharmony_ci
28895bd8deadSopenharmony_ci    The POW instruction approximates the value of the first scalar operand
28905bd8deadSopenharmony_ci    raised to the power of the second scalar operand and replicates it to all
28915bd8deadSopenharmony_ci    four components of the result vector.
28925bd8deadSopenharmony_ci
28935bd8deadSopenharmony_ci      tmp0 = ScalarLoad(op0);
28945bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
28955bd8deadSopenharmony_ci      result.x = ApproxPower(tmp0, tmp1);
28965bd8deadSopenharmony_ci      result.y = ApproxPower(tmp0, tmp1);
28975bd8deadSopenharmony_ci      result.z = ApproxPower(tmp0, tmp1);
28985bd8deadSopenharmony_ci      result.w = ApproxPower(tmp0, tmp1);
28995bd8deadSopenharmony_ci   
29005bd8deadSopenharmony_ci    The exponentiation approximation function is defined in terms of the base
29015bd8deadSopenharmony_ci    2 exponentiation and logarithm approximation operations in the EX2 and LG2
29025bd8deadSopenharmony_ci    instructions, including errors and the processing of any special cases.
29035bd8deadSopenharmony_ci    In particular,
29045bd8deadSopenharmony_ci
29055bd8deadSopenharmony_ci      ApproxPower(a,b) = ApproxExp2(b * ApproxLog2(a)).
29065bd8deadSopenharmony_ci
29075bd8deadSopenharmony_ci    The following special-case rules, which can be derived from the rules in
29085bd8deadSopenharmony_ci    the LG2, MUL, and EX2 instructions, apply to exponentiation:
29095bd8deadSopenharmony_ci
29105bd8deadSopenharmony_ci      1. ApproxPower(<x>, <y>) = NaN, if x < -0.0,
29115bd8deadSopenharmony_ci      2. ApproxPower(<x>, <y>) = NaN, if x or y is NaN.
29125bd8deadSopenharmony_ci      3. ApproxPower(+/-0.0, +/-0.0) = NaN.
29135bd8deadSopenharmony_ci      4. ApproxPower(+INF, +/-0.0) = NaN.
29145bd8deadSopenharmony_ci      5. ApproxPower(+1.0, +/-INF) = NaN.
29155bd8deadSopenharmony_ci      6. ApproxPower(+/-0.0, <x>) = +0.0, if x > +0.0.
29165bd8deadSopenharmony_ci      7. ApproxPower(+/-0.0, <x>) = +INF, if x < -0.0.
29175bd8deadSopenharmony_ci      8. ApproxPower(+1.0, <x>)   = +1.0, if -INF < x < +INF.
29185bd8deadSopenharmony_ci      9. ApproxPower(+INF, <x>) = +INF, if x > +0.0.
29195bd8deadSopenharmony_ci      10. ApproxPower(+INF, <x>) = +INF, if x < -0.0.
29205bd8deadSopenharmony_ci      11. ApproxPower(<x>, +/-0.0) = +1.0, if +0.0 < x < +INF.
29215bd8deadSopenharmony_ci      12. ApproxPower(<x>, +1.0) ~= <x>, if x >= +0.0.
29225bd8deadSopenharmony_ci      13. ApproxPower(<x>, +INF) = +0.0, if -0.0 <= x < +1.0,
29235bd8deadSopenharmony_ci                                   +INF, if x > +1.0,
29245bd8deadSopenharmony_ci      14. ApproxPower(<x>, -INF) = +INF, if -0.0 <= x < +1.0,
29255bd8deadSopenharmony_ci                                   +0.0, if x > +1.0,
29265bd8deadSopenharmony_ci
29275bd8deadSopenharmony_ci    Note that 0^0 is defined here as NaN, since ApproxLog2(0) = -INF, and
29285bd8deadSopenharmony_ci    0*(-INF) = NaN.  In many other applications, including the standard C
29295bd8deadSopenharmony_ci    pow() function, 0^0 is defined as 1.0.  This behavior can be emulated
29305bd8deadSopenharmony_ci    using additional instructions in much that same way that the pow()
29315bd8deadSopenharmony_ci    function is implemented on many CPUs.
29325bd8deadSopenharmony_ci
29335bd8deadSopenharmony_ci    Note that a logarithm is involved even if the exponent is an integer.
29345bd8deadSopenharmony_ci    This means that any exponentiating with a negative base will produce NaN.
29355bd8deadSopenharmony_ci    In constrast, it is possible in a "normal" mathematical formulation to
29365bd8deadSopenharmony_ci    raise negative numbers to integral powers (e.g., (-3)^2== 9, and
29375bd8deadSopenharmony_ci    (-0.5)^-2==4).
29385bd8deadSopenharmony_ci
29395bd8deadSopenharmony_ci
29405bd8deadSopenharmony_ci    Section 3.11.5.25,  RCP:  Reciprocal
29415bd8deadSopenharmony_ci
29425bd8deadSopenharmony_ci    The RCP instruction approximates the reciprocal of the scalar operand and
29435bd8deadSopenharmony_ci    replicates it to all four components of the result vector.
29445bd8deadSopenharmony_ci
29455bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
29465bd8deadSopenharmony_ci      result.x = ApproxReciprocal(tmp);
29475bd8deadSopenharmony_ci      result.y = ApproxReciprocal(tmp);
29485bd8deadSopenharmony_ci      result.z = ApproxReciprocal(tmp);
29495bd8deadSopenharmony_ci      result.w = ApproxReciprocal(tmp);
29505bd8deadSopenharmony_ci
29515bd8deadSopenharmony_ci    The approximation function is accurate to at least 22 bits:
29525bd8deadSopenharmony_ci
29535bd8deadSopenharmony_ci      | ApproxReciprocal(x) - (1/x) | < 1.0 / 2^22, if 1.0 <= x < 2.0.
29545bd8deadSopenharmony_ci
29555bd8deadSopenharmony_ci    The following special-case rules apply to reciprocation:
29565bd8deadSopenharmony_ci
29575bd8deadSopenharmony_ci      1. ApproxReciprocal(NaN) = NaN.
29585bd8deadSopenharmony_ci      2. ApproxReciprocal(+INF) = +0.0.
29595bd8deadSopenharmony_ci      3. ApproxReciprocal(-INF) = -0.0.
29605bd8deadSopenharmony_ci      4. ApproxReciprocal(+0.0) = +INF.
29615bd8deadSopenharmony_ci      5. ApproxReciprocal(-0.0) = -INF.
29625bd8deadSopenharmony_ci
29635bd8deadSopenharmony_ci
29645bd8deadSopenharmony_ci    Section 3.11.5.26,  RFL:  Reflection Vector
29655bd8deadSopenharmony_ci
29665bd8deadSopenharmony_ci    The RFL instruction computes the reflection of the second vector operand
29675bd8deadSopenharmony_ci    (the "direction" vector) about the vector specified by the first vector
29685bd8deadSopenharmony_ci    operand (the "axis" vector).  Both operands are treated as 3D vectors (the
29695bd8deadSopenharmony_ci    w components are ignored).  The result vector is another 3D vector (the
29705bd8deadSopenharmony_ci    "reflected direction" vector).  The length of the result vector, ignoring
29715bd8deadSopenharmony_ci    rounding errors, should equal that of the second operand.
29725bd8deadSopenharmony_ci
29735bd8deadSopenharmony_ci      axis = VectorLoad(op0);
29745bd8deadSopenharmony_ci      direction = VectorLoad(op1);
29755bd8deadSopenharmony_ci      tmp.w = (axis.x * axis.x + axis.y * axis.y +
29765bd8deadSopenharmony_ci               axis.z * axis.z);
29775bd8deadSopenharmony_ci      tmp.x = (axis.x * direction.x + axis.y * direction.y + 
29785bd8deadSopenharmony_ci               axis.z * direction.z);
29795bd8deadSopenharmony_ci      tmp.x = 2.0 * tmp.x;
29805bd8deadSopenharmony_ci      tmp.x = tmp.x / tmp.w;
29815bd8deadSopenharmony_ci      result.x = tmp.x * axis.x - direction.x;
29825bd8deadSopenharmony_ci      result.y = tmp.x * axis.y - direction.y;
29835bd8deadSopenharmony_ci      result.z = tmp.x * axis.z - direction.z;
29845bd8deadSopenharmony_ci
29855bd8deadSopenharmony_ci    A fragment program will fail to load if the w component of the result is
29865bd8deadSopenharmony_ci    enabled in the component write mask (see the <optionalWriteMask> rule in
29875bd8deadSopenharmony_ci    the grammar).
29885bd8deadSopenharmony_ci
29895bd8deadSopenharmony_ci
29905bd8deadSopenharmony_ci    Section 3.11.5.27,  RSQ:  Reciprocal Square Root
29915bd8deadSopenharmony_ci
29925bd8deadSopenharmony_ci    The RSQ instruction approximates the reciprocal of the square root of the
29935bd8deadSopenharmony_ci    scalar operand and replicates it to all four components of the result
29945bd8deadSopenharmony_ci    vector.
29955bd8deadSopenharmony_ci
29965bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
29975bd8deadSopenharmony_ci      result.x = ApproxRSQRT(tmp);
29985bd8deadSopenharmony_ci      result.y = ApproxRSQRT(tmp);
29995bd8deadSopenharmony_ci      result.z = ApproxRSQRT(tmp);
30005bd8deadSopenharmony_ci      result.w = ApproxRSQRT(tmp);
30015bd8deadSopenharmony_ci
30025bd8deadSopenharmony_ci    The approximation function is accurate to at least 22 bits:
30035bd8deadSopenharmony_ci
30045bd8deadSopenharmony_ci      | ApproxRSQRT(x) - (1/x) | < 1.0 / 2^22, if 1.0 <= x < 4.0.
30055bd8deadSopenharmony_ci
30065bd8deadSopenharmony_ci    The following special-case rules apply to reciprocal square roots:
30075bd8deadSopenharmony_ci
30085bd8deadSopenharmony_ci      1. ApproxRSQRT(NaN) = NaN.
30095bd8deadSopenharmony_ci      2. ApproxRSQRT(+INF) = +0.0.
30105bd8deadSopenharmony_ci      3. ApproxRSQRT(-INF) = NaN.
30115bd8deadSopenharmony_ci      4. ApproxRSQRT(+0.0) = +INF.
30125bd8deadSopenharmony_ci      5. ApproxRSQRT(-0.0) = -INF.
30135bd8deadSopenharmony_ci      6. ApproxRSQRT(x) = NaN, if -INF < x < -0.0.
30145bd8deadSopenharmony_ci
30155bd8deadSopenharmony_ci
30165bd8deadSopenharmony_ci    Section 3.11.5.28,  SEQ:  Set on Equal To
30175bd8deadSopenharmony_ci
30185bd8deadSopenharmony_ci    The SEQ instruction performs a component-wise comparison of the two
30195bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
30205bd8deadSopenharmony_ci    component of the first operand is equal to that of the second, and 0.0
30215bd8deadSopenharmony_ci    otherwise.
30225bd8deadSopenharmony_ci
30235bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30245bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
30255bd8deadSopenharmony_ci      result.x = (tmp0.x == tmp1.x) ? 1.0 : 0.0;
30265bd8deadSopenharmony_ci      result.y = (tmp0.y == tmp1.y) ? 1.0 : 0.0;
30275bd8deadSopenharmony_ci      result.z = (tmp0.z == tmp1.z) ? 1.0 : 0.0;
30285bd8deadSopenharmony_ci      result.w = (tmp0.w == tmp1.w) ? 1.0 : 0.0;
30295bd8deadSopenharmony_ci
30305bd8deadSopenharmony_ci    The following special-case rules apply to SEQ:
30315bd8deadSopenharmony_ci
30325bd8deadSopenharmony_ci      1. (<x> == <y>) and (<y> == <x>) always produce the same result.
30335bd8deadSopenharmony_ci      1. (NaN == <x>) is FALSE for all <x>, including NaN.
30345bd8deadSopenharmony_ci      2. (+INF == +INF) and (-INF == -INF) are TRUE.
30355bd8deadSopenharmony_ci      3. (-0.0 == +0.0) and (+0.0 == -0.0) are TRUE.
30365bd8deadSopenharmony_ci
30375bd8deadSopenharmony_ci
30385bd8deadSopenharmony_ci    Section 3.11.5.29,  SFL:  Set on False
30395bd8deadSopenharmony_ci
30405bd8deadSopenharmony_ci    The SFL instruction is a degenerate case of the other "Set on"
30415bd8deadSopenharmony_ci    instructions that sets all components of the result vector to
30425bd8deadSopenharmony_ci    0.0.
30435bd8deadSopenharmony_ci
30445bd8deadSopenharmony_ci      result.x = 0.0;
30455bd8deadSopenharmony_ci      result.y = 0.0;
30465bd8deadSopenharmony_ci      result.z = 0.0;
30475bd8deadSopenharmony_ci      result.w = 0.0;
30485bd8deadSopenharmony_ci
30495bd8deadSopenharmony_ci
30505bd8deadSopenharmony_ci    Section 3.11.5.30,  SGE:  Set on Greater Than or Equal
30515bd8deadSopenharmony_ci
30525bd8deadSopenharmony_ci    The SGE instruction performs a component-wise comparison of the two
30535bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
30545bd8deadSopenharmony_ci    component of the first operands is greater than or equal that of the
30555bd8deadSopenharmony_ci    second, and 0.0 otherwise.
30565bd8deadSopenharmony_ci
30575bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30585bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
30595bd8deadSopenharmony_ci      result.x = (tmp0.x >= tmp1.x) ? 1.0 : 0.0;
30605bd8deadSopenharmony_ci      result.y = (tmp0.y >= tmp1.y) ? 1.0 : 0.0;
30615bd8deadSopenharmony_ci      result.z = (tmp0.z >= tmp1.z) ? 1.0 : 0.0;
30625bd8deadSopenharmony_ci      result.w = (tmp0.w >= tmp1.w) ? 1.0 : 0.0;
30635bd8deadSopenharmony_ci
30645bd8deadSopenharmony_ci    The following special-case rules apply to SGE:
30655bd8deadSopenharmony_ci
30665bd8deadSopenharmony_ci      1. (NaN >= <x>) and (<x> >= NaN) are FALSE for all <x>.
30675bd8deadSopenharmony_ci      2. (+INF >= +INF) and (-INF >= -INF) are TRUE.
30685bd8deadSopenharmony_ci      3. (-0.0 >= +0.0) and (+0.0 >= -0.0) are TRUE.
30695bd8deadSopenharmony_ci
30705bd8deadSopenharmony_ci
30715bd8deadSopenharmony_ci    Section 3.11.5.31,  SGT:  Set on Greater Than
30725bd8deadSopenharmony_ci
30735bd8deadSopenharmony_ci    The SGT instruction performs a component-wise comparison of the two
30745bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
30755bd8deadSopenharmony_ci    component of the first operands is greater than that of the second, and
30765bd8deadSopenharmony_ci    0.0 otherwise.
30775bd8deadSopenharmony_ci
30785bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30795bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
30805bd8deadSopenharmony_ci      result.x = (tmp0.x > tmp1.x) ? 1.0 : 0.0;
30815bd8deadSopenharmony_ci      result.y = (tmp0.y > tmp1.y) ? 1.0 : 0.0;
30825bd8deadSopenharmony_ci      result.z = (tmp0.z > tmp1.z) ? 1.0 : 0.0;
30835bd8deadSopenharmony_ci      result.w = (tmp0.w > tmp1.w) ? 1.0 : 0.0;
30845bd8deadSopenharmony_ci
30855bd8deadSopenharmony_ci    The following special-case rules apply to SGT:
30865bd8deadSopenharmony_ci
30875bd8deadSopenharmony_ci      1. (NaN > <x>) and (<x> > NaN) are FALSE for all <x>.
30885bd8deadSopenharmony_ci      2. (-0.0 > +0.0) and (+0.0 > -0.0) are FALSE.
30895bd8deadSopenharmony_ci
30905bd8deadSopenharmony_ci
30915bd8deadSopenharmony_ci    Section 3.11.5.32,  SIN:  Sine
30925bd8deadSopenharmony_ci
30935bd8deadSopenharmony_ci    The SIN instruction approximates the sine of the angle specified by the
30945bd8deadSopenharmony_ci    scalar operand and replicates it to all four components of the result
30955bd8deadSopenharmony_ci    vector.  The angle is specified in radians and does not have to be in the
30965bd8deadSopenharmony_ci    range [0,2*PI].
30975bd8deadSopenharmony_ci
30985bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
30995bd8deadSopenharmony_ci      result.x = ApproxSine(tmp);
31005bd8deadSopenharmony_ci      result.y = ApproxSine(tmp);
31015bd8deadSopenharmony_ci      result.z = ApproxSine(tmp);
31025bd8deadSopenharmony_ci      result.w = ApproxSine(tmp);
31035bd8deadSopenharmony_ci
31045bd8deadSopenharmony_ci    The approximation function is accurate to at least 22 bits with an angle
31055bd8deadSopenharmony_ci    in the range [0,2*PI].
31065bd8deadSopenharmony_ci
31075bd8deadSopenharmony_ci      | ApproxSine(x) - sin(x) | < 1.0 / 2^22, if 0.0 <= x < 2.0 * PI.
31085bd8deadSopenharmony_ci
31095bd8deadSopenharmony_ci    The error in the approximation will typically increase with the absolute
31105bd8deadSopenharmony_ci    value of the angle when the angle falls outside the range [0,2*PI].
31115bd8deadSopenharmony_ci
31125bd8deadSopenharmony_ci    The following special-case rules apply to cosine approximation:
31135bd8deadSopenharmony_ci
31145bd8deadSopenharmony_ci      1. ApproxSine(NaN) = NaN.
31155bd8deadSopenharmony_ci      2. ApproxSine(+/-INF) = NaN.
31165bd8deadSopenharmony_ci      3. ApproxSine(+/-0.0) = +/-0.0.  The sign of the result is equal to the
31175bd8deadSopenharmony_ci         sign of the single operand.
31185bd8deadSopenharmony_ci
31195bd8deadSopenharmony_ci
31205bd8deadSopenharmony_ci    Section 3.11.5.33,  SLE:  Set on Less Than or Equal
31215bd8deadSopenharmony_ci
31225bd8deadSopenharmony_ci    The SLE instruction performs a component-wise comparison of the two
31235bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
31245bd8deadSopenharmony_ci    component of the first operand is less than or equal to that of the
31255bd8deadSopenharmony_ci    second, and 0.0 otherwise.
31265bd8deadSopenharmony_ci
31275bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
31285bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
31295bd8deadSopenharmony_ci      result.x = (tmp0.x <= tmp1.x) ? 1.0 : 0.0;
31305bd8deadSopenharmony_ci      result.y = (tmp0.y <= tmp1.y) ? 1.0 : 0.0;
31315bd8deadSopenharmony_ci      result.z = (tmp0.z <= tmp1.z) ? 1.0 : 0.0;
31325bd8deadSopenharmony_ci      result.w = (tmp0.w <= tmp1.w) ? 1.0 : 0.0;
31335bd8deadSopenharmony_ci
31345bd8deadSopenharmony_ci    The following special-case rules apply to SLE:
31355bd8deadSopenharmony_ci
31365bd8deadSopenharmony_ci      1. (NaN <= <x>) and (<x> <= NaN) are FALSE for all <x>.
31375bd8deadSopenharmony_ci      2. (+INF <= +INF) and (-INF <= -INF) are TRUE.
31385bd8deadSopenharmony_ci      3. (-0.0 <= +0.0) and (+0.0 <= -0.0) are TRUE.
31395bd8deadSopenharmony_ci
31405bd8deadSopenharmony_ci
31415bd8deadSopenharmony_ci    Section 3.11.5.34,  SLT:  Set on Less Than
31425bd8deadSopenharmony_ci
31435bd8deadSopenharmony_ci    The SLT instruction performs a component-wise comparison of the two
31445bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
31455bd8deadSopenharmony_ci    component of the first operand is less than that of the second, and 0.0
31465bd8deadSopenharmony_ci    otherwise.
31475bd8deadSopenharmony_ci
31485bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
31495bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
31505bd8deadSopenharmony_ci      result.x = (tmp0.x < tmp1.x) ? 1.0 : 0.0;
31515bd8deadSopenharmony_ci      result.y = (tmp0.y < tmp1.y) ? 1.0 : 0.0;
31525bd8deadSopenharmony_ci      result.z = (tmp0.z < tmp1.z) ? 1.0 : 0.0;
31535bd8deadSopenharmony_ci      result.w = (tmp0.w < tmp1.w) ? 1.0 : 0.0;
31545bd8deadSopenharmony_ci
31555bd8deadSopenharmony_ci    The following special-case rules apply to SLT:
31565bd8deadSopenharmony_ci
31575bd8deadSopenharmony_ci      1. (NaN < <x>) and (<x> < NaN) are FALSE for all <x>.
31585bd8deadSopenharmony_ci      2. (-0.0 < +0.0) and (+0.0 < -0.0) are FALSE.
31595bd8deadSopenharmony_ci
31605bd8deadSopenharmony_ci
31615bd8deadSopenharmony_ci    Section 3.11.5.35,  SNE:  Set on Not Equal
31625bd8deadSopenharmony_ci
31635bd8deadSopenharmony_ci    The SNE instruction performs a component-wise comparison of the two
31645bd8deadSopenharmony_ci    operands.  Each component of the result vector is 1.0 if the corresponding
31655bd8deadSopenharmony_ci    component of the first operand is not equal to that of the second, and 0.0
31665bd8deadSopenharmony_ci    otherwise.
31675bd8deadSopenharmony_ci
31685bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
31695bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
31705bd8deadSopenharmony_ci      result.x = (tmp0.x != tmp1.x) ? 1.0 : 0.0;
31715bd8deadSopenharmony_ci      result.y = (tmp0.y != tmp1.y) ? 1.0 : 0.0;
31725bd8deadSopenharmony_ci      result.z = (tmp0.z != tmp1.z) ? 1.0 : 0.0;
31735bd8deadSopenharmony_ci      result.w = (tmp0.w != tmp1.w) ? 1.0 : 0.0;
31745bd8deadSopenharmony_ci
31755bd8deadSopenharmony_ci    The following special-case rules apply to SNE:
31765bd8deadSopenharmony_ci
31775bd8deadSopenharmony_ci      1. (<x> != <y>) and (<y> != <x>) always produce the same result.
31785bd8deadSopenharmony_ci      2. (NaN != <x>) is TRUE for all <x>, including NaN.
31795bd8deadSopenharmony_ci      3. (+INF != +INF) and (-INF != -INF) are FALSE.
31805bd8deadSopenharmony_ci      4. (-0.0 != +0.0) and (+0.0 != -0.0) are TRUE.
31815bd8deadSopenharmony_ci
31825bd8deadSopenharmony_ci
31835bd8deadSopenharmony_ci    Section 3.11.5.36,  STR:  Set on True
31845bd8deadSopenharmony_ci
31855bd8deadSopenharmony_ci    The STR instruction is a degenerate case of the other "Set on"
31865bd8deadSopenharmony_ci    instructions that sets all components of the result vector to 1.0.
31875bd8deadSopenharmony_ci
31885bd8deadSopenharmony_ci      result.x = 1.0;
31895bd8deadSopenharmony_ci      result.y = 1.0;
31905bd8deadSopenharmony_ci      result.z = 1.0;
31915bd8deadSopenharmony_ci      result.w = 1.0;
31925bd8deadSopenharmony_ci
31935bd8deadSopenharmony_ci
31945bd8deadSopenharmony_ci    Section 3.11.5.37,  SUB:  Subtract
31955bd8deadSopenharmony_ci
31965bd8deadSopenharmony_ci    The SUB instruction performs a component-wise subtraction of the second
31975bd8deadSopenharmony_ci    operand from the first to yield a result vector.
31985bd8deadSopenharmony_ci
31995bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
32005bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
32015bd8deadSopenharmony_ci      result.x = tmp0.x - tmp1.x;
32025bd8deadSopenharmony_ci      result.y = tmp0.y - tmp1.y;
32035bd8deadSopenharmony_ci      result.z = tmp0.z - tmp1.z;
32045bd8deadSopenharmony_ci      result.w = tmp0.w - tmp1.w;
32055bd8deadSopenharmony_ci
32065bd8deadSopenharmony_ci    The SUB instruction is completely equivalent to an identical ADD
32075bd8deadSopenharmony_ci    instruction in which the negate operator on the second operand is
32085bd8deadSopenharmony_ci    reversed:
32095bd8deadSopenharmony_ci
32105bd8deadSopenharmony_ci      1. "SUB R0, R1, R2" is equivalent to "ADD R0, R1, -R2".
32115bd8deadSopenharmony_ci      2. "SUB R0, R1, -R2" is equivalent to "ADD R0, R1, R2".
32125bd8deadSopenharmony_ci      3. "SUB R0, R1, |R2|" is equivalent to "ADD R0, R1, -|R2|".
32135bd8deadSopenharmony_ci      4. "SUB R0, R1, -|R2|" is equivalent to "ADD R0, R1, |R2|".
32145bd8deadSopenharmony_ci
32155bd8deadSopenharmony_ci
32165bd8deadSopenharmony_ci    Section 3.11.5.38,  TEX: Texture Lookup
32175bd8deadSopenharmony_ci
32185bd8deadSopenharmony_ci    The TEX instruction performs a filtered texture lookup using the texture
32195bd8deadSopenharmony_ci    target given by <texImageTarget> belonging to the texture image unit given
32205bd8deadSopenharmony_ci    by <texImageUnit>.  <texImageTarget> values of "1D", "2D", "3D", "CUBE",
32215bd8deadSopenharmony_ci    and "RECT" correspond to the texture targets TEXTURE_1D, TEXTURE_2D,
32225bd8deadSopenharmony_ci    TEXTURE_3D, TEXTURE_CUBE_MAP_ARB, and TEXTURE_RECTANGLE_NV, respectively.
32235bd8deadSopenharmony_ci    
32245bd8deadSopenharmony_ci    The (s,t,r) texture coordinates used for the lookup are the x, y, and z
32255bd8deadSopenharmony_ci    components of the single operand.
32265bd8deadSopenharmony_ci
32275bd8deadSopenharmony_ci    The texture lookup is performed as specified in Section 3.8.  The LOD
32285bd8deadSopenharmony_ci    calculations in Section 3.8.5 are performed using an implementation
32295bd8deadSopenharmony_ci    dependent method to derive ds/dx, ds/dy, dt/dx, dt/dy, dr/dx, and dr/dy.
32305bd8deadSopenharmony_ci    The mapping of filtered texture components to the components of the result
32315bd8deadSopenharmony_ci    vector is dependent on the base internal format of the texture and is
32325bd8deadSopenharmony_ci    specified in Table X.5.
32335bd8deadSopenharmony_ci
32345bd8deadSopenharmony_ci                                 Result Vector Components
32355bd8deadSopenharmony_ci      Base Internal Format        X      Y      Z      W
32365bd8deadSopenharmony_ci      --------------------      -----  -----  -----  -----
32375bd8deadSopenharmony_ci      ALPHA                      0.0    0.0    0.0    At
32385bd8deadSopenharmony_ci      LUMINANCE                  Lt     Lt     Lt     1.0
32395bd8deadSopenharmony_ci      LUMINANCE_ALPHA            Lt     Lt     Lt     At
32405bd8deadSopenharmony_ci      INTENSITY                  It     It     It     It
32415bd8deadSopenharmony_ci      RGB                        Rt     Gt     Bt     1.0
32425bd8deadSopenharmony_ci      RGBA                       Rt     Gt     Bt     At
32435bd8deadSopenharmony_ci      HILO_NV (signed)           HIt    LOt    HEMI   1.0
32445bd8deadSopenharmony_ci      HILO_NV (unsigned)         HIt    LOt    1.0    1.0
32455bd8deadSopenharmony_ci      DSDT_NV                    DSt    DTt    0.0    1.0
32465bd8deadSopenharmony_ci      DSDT_MAG_NV                DSt    DTt    MAGt   1.0
32475bd8deadSopenharmony_ci      DSDT_MAG_INTENSITY_NV      DSt    DTt    MAGt   It
32485bd8deadSopenharmony_ci      FLOAT_R_NV                 Rt     0.0    0.0    1.0
32495bd8deadSopenharmony_ci      FLOAT_RG_NV                Rt     Gt     0.0    1.0
32505bd8deadSopenharmony_ci      FLOAT_RGB_NV               Rt     Gt     Bt     1.0
32515bd8deadSopenharmony_ci      FLOAT_RGBA_NV              Rt     Gt     Bt     At
32525bd8deadSopenharmony_ci      
32535bd8deadSopenharmony_ci      Table X.5:  Mapping of filtered texel components to result vector
32545bd8deadSopenharmony_ci      components for the TEX instruction.  0.0 and 1.0 indicate that the
32555bd8deadSopenharmony_ci      corresponding constant value is written to the result vector.
32565bd8deadSopenharmony_ci      DEPTH_COMPONENT textures are treated as ALPHA, LUMINANCE, or INTENSITY,
32575bd8deadSopenharmony_ci      as specified in the texture's depth texture mode.
32585bd8deadSopenharmony_ci
32595bd8deadSopenharmony_ci      For HILO_NV textures with signed components, "HEMI" is defined as
32605bd8deadSopenharmony_ci      sqrt(MAX(0, 1-(HIt^2+LOt^2))).
32615bd8deadSopenharmony_ci
32625bd8deadSopenharmony_ci    This instruction specifies a particular texture target, ignoring the
32635bd8deadSopenharmony_ci    standard hierarchy of texture enables (TEXTURE_CUBE_MAP_ARB, TEXTURE_3D,
32645bd8deadSopenharmony_ci    TEXTURE_2D, TEXTURE_1D) used to select a texture target in unextended
32655bd8deadSopenharmony_ci    OpenGL.  If the specified texture target has a consistent set of images, a
32665bd8deadSopenharmony_ci    lookup is performed.  Otherwise, the result of the instruction is the
32675bd8deadSopenharmony_ci    vector (0,0,0,0).
32685bd8deadSopenharmony_ci
32695bd8deadSopenharmony_ci    Although this instruction allows the selection of any texture target, a
32705bd8deadSopenharmony_ci    fragment program can not use more than one texture target for any given
32715bd8deadSopenharmony_ci    texture image unit.
32725bd8deadSopenharmony_ci      
32735bd8deadSopenharmony_ci
32745bd8deadSopenharmony_ci    Section 3.11.5.39,  TXD: Texture Lookup with Derivatives
32755bd8deadSopenharmony_ci
32765bd8deadSopenharmony_ci    The TXD instruction performs a filtered texture lookup using the texture
32775bd8deadSopenharmony_ci    target given by <texImageTarget> belonging to the texture image unit given
32785bd8deadSopenharmony_ci    by <texImageUnit>.  <texImageTarget> values of "1D", "2D", "3D", "CUBE",
32795bd8deadSopenharmony_ci    and "RECT" correspond to the texture targets TEXTURE_1D, TEXTURE_2D,
32805bd8deadSopenharmony_ci    TEXTURE_3D, TEXTURE_CUBE_MAP_ARB, and TEXTURE_RECTANGLE_NV, respectively.
32815bd8deadSopenharmony_ci    
32825bd8deadSopenharmony_ci    The (s,t,r) texture coordinates used for the lookup are the x, y, and z
32835bd8deadSopenharmony_ci    components of the first operand.  The partial derivatives in the X
32845bd8deadSopenharmony_ci    direction (ds/dx, dt/dx, dr/dx) are specified by the x, y, and z
32855bd8deadSopenharmony_ci    components of the second operand.  The partial derivatives in the Y
32865bd8deadSopenharmony_ci    direction (ds/dy, dt/dy, dr/dy) are specified by the x, y, and z
32875bd8deadSopenharmony_ci    components of the third operand.
32885bd8deadSopenharmony_ci
32895bd8deadSopenharmony_ci    The texture lookup is performed as specified in Section 3.8.  The LOD
32905bd8deadSopenharmony_ci    calculations in Section 3.8.5 are performed using the specified partial
32915bd8deadSopenharmony_ci    derivatives.  The mapping of filtered texture components to the components
32925bd8deadSopenharmony_ci    of the result vector is dependent on the base internal format of the
32935bd8deadSopenharmony_ci    texture and is specified in Table X.5.
32945bd8deadSopenharmony_ci
32955bd8deadSopenharmony_ci    This instruction specifies a particular texture target, ignoring the
32965bd8deadSopenharmony_ci    standard hierarchy of texture enables (TEXTURE_CUBE_MAP_ARB, TEXTURE_3D,
32975bd8deadSopenharmony_ci    TEXTURE_2D, TEXTURE_1D) used to select a texture target in unextended
32985bd8deadSopenharmony_ci    OpenGL.  If the specified texture target has a consistent set of images, a
32995bd8deadSopenharmony_ci    lookup is performed.  Otherwise, the result of the instruction is the
33005bd8deadSopenharmony_ci    vector (0,0,0,0).
33015bd8deadSopenharmony_ci      
33025bd8deadSopenharmony_ci    Although this instruction allows the selection of any texture target, a
33035bd8deadSopenharmony_ci    fragment program can not use more than one texture target for any given
33045bd8deadSopenharmony_ci    texture image unit.
33055bd8deadSopenharmony_ci      
33065bd8deadSopenharmony_ci
33075bd8deadSopenharmony_ci    Section 3.11.5.40,  TXP: Projective Texture Lookup
33085bd8deadSopenharmony_ci
33095bd8deadSopenharmony_ci    The TXP instruction performs a filtered texture lookup using the texture
33105bd8deadSopenharmony_ci    target given by <texImageTarget> belonging to the texture image unit given
33115bd8deadSopenharmony_ci    by <texImageUnit>.  <texImageTarget> values of "1D", "2D", "3D", "CUBE",
33125bd8deadSopenharmony_ci    and "RECT" correspond to the texture targets TEXTURE_1D, TEXTURE_2D,
33135bd8deadSopenharmony_ci    TEXTURE_3D, TEXTURE_CUBE_MAP_ARB, and TEXTURE_RECTANGLE_NV, respectively.
33145bd8deadSopenharmony_ci
33155bd8deadSopenharmony_ci    For cube map textures, the (s,t,r) texture coordinates used for the lookup
33165bd8deadSopenharmony_ci    are given by x, y, and z, respectively.  For all other textures, the
33175bd8deadSopenharmony_ci    (s,t,r) texture coordinates used for the lookup are given by x/w, y/w, and
33185bd8deadSopenharmony_ci    z/w, respectively, where x, y, z, and w are the corresponding components
33195bd8deadSopenharmony_ci    of the operand.
33205bd8deadSopenharmony_ci
33215bd8deadSopenharmony_ci    The texture lookup is performed as specified in Section 3.8.  The LOD
33225bd8deadSopenharmony_ci    calculations in Section 3.8.5 are performed using an implementation
33235bd8deadSopenharmony_ci    dependent method to derive ds/dx, ds/dy, dt/dx, dt/dy, dr/dx, and dr/dy.
33245bd8deadSopenharmony_ci    The mapping of filtered texture components to the components of the result
33255bd8deadSopenharmony_ci    vector is dependent on the base internal format of the texture and is
33265bd8deadSopenharmony_ci    specified in Table X.5.
33275bd8deadSopenharmony_ci
33285bd8deadSopenharmony_ci    This instruction specifies a particular texture target, ignoring the
33295bd8deadSopenharmony_ci    standard hierarchy of texture enables (TEXTURE_CUBE_MAP_ARB, TEXTURE_3D,
33305bd8deadSopenharmony_ci    TEXTURE_2D, TEXTURE_1D) used to select a texture target in unextended
33315bd8deadSopenharmony_ci    OpenGL.  If the specified texture target has a consistent set of images, a
33325bd8deadSopenharmony_ci    lookup is performed.  Otherwise, the result of the instruction is the
33335bd8deadSopenharmony_ci    vector (0,0,0,0).
33345bd8deadSopenharmony_ci      
33355bd8deadSopenharmony_ci    Although this instruction allows the selection of any texture target, a
33365bd8deadSopenharmony_ci    fragment program can not use more than one texture target for any given
33375bd8deadSopenharmony_ci    texture image unit.
33385bd8deadSopenharmony_ci      
33395bd8deadSopenharmony_ci
33405bd8deadSopenharmony_ci    Section 3.11.5.41,  UP2H:  Unpack Two 16-Bit Floats
33415bd8deadSopenharmony_ci
33425bd8deadSopenharmony_ci    The UP2H instruction unpacks two 16-bit floats stored together in a 32-bit
33435bd8deadSopenharmony_ci    scalar operand.  The first 16-bit float (stored in the 16 least
33445bd8deadSopenharmony_ci    significant bits) is written into the "x" and "z" components of the result
33455bd8deadSopenharmony_ci    vector; the second is written into the "y" and "w" components of the
33465bd8deadSopenharmony_ci    result vector.
33475bd8deadSopenharmony_ci
33485bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by the
33495bd8deadSopenharmony_ci    PK2H instruction.
33505bd8deadSopenharmony_ci
33515bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
33525bd8deadSopenharmony_ci      result.x = (fp16) (RawBits(tmp) & 0xFFFF);
33535bd8deadSopenharmony_ci      result.y = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
33545bd8deadSopenharmony_ci      result.z = (fp16) (RawBits(tmp) & 0xFFFF);
33555bd8deadSopenharmony_ci      result.w = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
33565bd8deadSopenharmony_ci    
33575bd8deadSopenharmony_ci    Since the source operand must be a 32-bit scalar, a fragment program will
33585bd8deadSopenharmony_ci    fail to load if the operand is not obtained from a register with 32-bit
33595bd8deadSopenharmony_ci    components or from a program parameter.
33605bd8deadSopenharmony_ci
33615bd8deadSopenharmony_ci
33625bd8deadSopenharmony_ci    Section 3.11.5.42,  UP2US:  Unpack Two Unsigned 16-Bit Scalars
33635bd8deadSopenharmony_ci
33645bd8deadSopenharmony_ci    The UP2US instruction unpacks two 16-bit unsigned values packed together
33655bd8deadSopenharmony_ci    in a 32-bit scalar operand.  The unsigned quantities are encoded where a
33665bd8deadSopenharmony_ci    bit pattern of all '0' bits corresponds to 0.0 and a pattern of all '1'
33675bd8deadSopenharmony_ci    bits corresponds to 1.0.  The "x" and "z" components of the result vector
33685bd8deadSopenharmony_ci    are obtained from the 16 least significant bits of the operand; the "y"
33695bd8deadSopenharmony_ci    and "w" components are obtained from the 16 most significant bits.
33705bd8deadSopenharmony_ci
33715bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by the
33725bd8deadSopenharmony_ci    PK2US instruction.
33735bd8deadSopenharmony_ci
33745bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
33755bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
33765bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
33775bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
33785bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
33795bd8deadSopenharmony_ci
33805bd8deadSopenharmony_ci    Since the source operand must be a 32-bit scalar, a fragment program will
33815bd8deadSopenharmony_ci    fail to load if the operand is not obtained from a register with 32-bit
33825bd8deadSopenharmony_ci    components or from a program parameter.
33835bd8deadSopenharmony_ci
33845bd8deadSopenharmony_ci
33855bd8deadSopenharmony_ci    Section 3.11.5.43,  UP4B:  Unpack Four Signed 8-Bit Values
33865bd8deadSopenharmony_ci
33875bd8deadSopenharmony_ci    The UP4B instruction unpacks four 8-bit signed values packed together in a
33885bd8deadSopenharmony_ci    32-bit scalar operand.  The signed quantities are encoded where a bit
33895bd8deadSopenharmony_ci    pattern of all '0' bits corresponds to -128/127 and a pattern of all '1'
33905bd8deadSopenharmony_ci    bits corresponds to +127/127.  The "x" component of the result vector is
33915bd8deadSopenharmony_ci    the converted value corresponding to the 8 least significant bits of the
33925bd8deadSopenharmony_ci    operand; the "w" component corresponds to the 8 most significant bits.
33935bd8deadSopenharmony_ci
33945bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by the
33955bd8deadSopenharmony_ci    PK4B instruction.
33965bd8deadSopenharmony_ci
33975bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
33985bd8deadSopenharmony_ci      result.x = (((RawBits(tmp) >> 0) & 0xFF) - 128) / 127.0;
33995bd8deadSopenharmony_ci      result.y = (((RawBits(tmp) >> 8) & 0xFF) - 128) / 127.0;
34005bd8deadSopenharmony_ci      result.z = (((RawBits(tmp) >> 16) & 0xFF) - 128) / 127.0;
34015bd8deadSopenharmony_ci      result.w = (((RawBits(tmp) >> 24) & 0xFF) - 128) / 127.0;
34025bd8deadSopenharmony_ci
34035bd8deadSopenharmony_ci    Since the source operand must be a 32-bit scalar, a fragment program will
34045bd8deadSopenharmony_ci    fail to load if the operand is not obtained from a register with 32-bit
34055bd8deadSopenharmony_ci    components or from a program parameter.
34065bd8deadSopenharmony_ci
34075bd8deadSopenharmony_ci
34085bd8deadSopenharmony_ci    Section 3.11.5.44,  UP4UB:  Unpack Four Unsigned 8-Bit Scalars
34095bd8deadSopenharmony_ci
34105bd8deadSopenharmony_ci    The UP4UB instruction unpacks four 8-bit unsigned values packed together
34115bd8deadSopenharmony_ci    in a 32-bit scalar operand.  The unsigned quantities are encoded where a
34125bd8deadSopenharmony_ci    bit pattern of all '0' bits corresponds to 0.0 and a pattern of all '1'
34135bd8deadSopenharmony_ci    bits corresponds to 1.0.  The "x" component of the result vector is
34145bd8deadSopenharmony_ci    obtained from the 8 least significant bits of the operand; the "w"
34155bd8deadSopenharmony_ci    component is obtained from the 8 most significant bits.
34165bd8deadSopenharmony_ci
34175bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by the
34185bd8deadSopenharmony_ci    PK4UB instruction.
34195bd8deadSopenharmony_ci
34205bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
34215bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFF) / 255.0;
34225bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 8)  & 0xFF) / 255.0;
34235bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 16) & 0xFF) / 255.0;
34245bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 24) & 0xFF) / 255.0;
34255bd8deadSopenharmony_ci
34265bd8deadSopenharmony_ci    Since the source operand must be a 32-bit scalar, a fragment program will
34275bd8deadSopenharmony_ci    fail to load if the operand is not obtained from a register with 32-bit
34285bd8deadSopenharmony_ci    components or from a program parameter.
34295bd8deadSopenharmony_ci
34305bd8deadSopenharmony_ci
34315bd8deadSopenharmony_ci    Section 3.11.5.45,  X2D:  2D Coordinate Transformation
34325bd8deadSopenharmony_ci
34335bd8deadSopenharmony_ci    The X2D instruction multiplies the 2D offset vector specified by the "x"
34345bd8deadSopenharmony_ci    and "y" components of the second vector operand by the 2x2 matrix
34355bd8deadSopenharmony_ci    specified by the four components of the third vector operand, and adds the
34365bd8deadSopenharmony_ci    transformed offset vector to the 2D vector specified by the "x" and "y"
34375bd8deadSopenharmony_ci    components of the first vector operand.  The first component of the sum is
34385bd8deadSopenharmony_ci    written to the "x" and "z" components of the result; the second component
34395bd8deadSopenharmony_ci    is written to the "y" and "w" components of the result.
34405bd8deadSopenharmony_ci
34415bd8deadSopenharmony_ci    The X2D instruction can be used to displace texture coordinates in the
34425bd8deadSopenharmony_ci    same manner as the OFFSET_TEXTURE_2D_NV mode in the GL_NV_texture_shader
34435bd8deadSopenharmony_ci    extension.
34445bd8deadSopenharmony_ci
34455bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
34465bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
34475bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
34485bd8deadSopenharmony_ci      result.x = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
34495bd8deadSopenharmony_ci      result.y = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
34505bd8deadSopenharmony_ci      result.z = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
34515bd8deadSopenharmony_ci      result.w = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
34525bd8deadSopenharmony_ci
34535bd8deadSopenharmony_ci
34545bd8deadSopenharmony_ci    Section 3.11.6, Fragment Program Outputs
34555bd8deadSopenharmony_ci
34565bd8deadSopenharmony_ci    Upon completion of fragment program execution, the output registers are
34575bd8deadSopenharmony_ci    used to replace the fragment's associated data.
34585bd8deadSopenharmony_ci
34595bd8deadSopenharmony_ci    The RGBA color of the fragment is taken from the color output register
34605bd8deadSopenharmony_ci    used by the program (COLR or COLH).  The R, G, B, and A color components
34615bd8deadSopenharmony_ci    are extracted from the "x", "y", "z", and "w" components, respectively, of
34625bd8deadSopenharmony_ci    the output register and are clamped to the range [0,1].
34635bd8deadSopenharmony_ci
34645bd8deadSopenharmony_ci    If the DEPR output register is written by the fragment program, the depth
34655bd8deadSopenharmony_ci    value of the fragment is taken from the z component of the DEPR output
34665bd8deadSopenharmony_ci    register.  If depth clamping is enabled, the depth value is clamped to the
34675bd8deadSopenharmony_ci    range [min(n,f), max(n,f)], where n and f are the near and far depth range
34685bd8deadSopenharmony_ci    values.  If depth clamping is disabled, the fragment is discarded if its
34695bd8deadSopenharmony_ci    depth value is outside the range [min(n,f), max(n,f)].
34705bd8deadSopenharmony_ci
34715bd8deadSopenharmony_ci
34725bd8deadSopenharmony_ci    Section 3.11.7, Required Fragment Program State
34735bd8deadSopenharmony_ci
34745bd8deadSopenharmony_ci    The state required for managing fragment programs consists of:
34755bd8deadSopenharmony_ci
34765bd8deadSopenharmony_ci      a bit indicating whether or not fragment program mode is enabled;
34775bd8deadSopenharmony_ci
34785bd8deadSopenharmony_ci      an unsigned integer naming the currently bound fragment program
34795bd8deadSopenharmony_ci
34805bd8deadSopenharmony_ci      and the state that must be maintained to indicate which integers are
34815bd8deadSopenharmony_ci      currently in use as fragment program names.
34825bd8deadSopenharmony_ci
34835bd8deadSopenharmony_ci    Fragment program mode is initially disabled.  The initial state of all 128
34845bd8deadSopenharmony_ci    fragment program parameter registers is (0,0,0,0).  The initial currently
34855bd8deadSopenharmony_ci    bound fragment program is zero.
34865bd8deadSopenharmony_ci
34875bd8deadSopenharmony_ci    Each fragment program object consists of:
34885bd8deadSopenharmony_ci
34895bd8deadSopenharmony_ci      an enumerant given the program target (FRAGMENT_PROGRAM_NV);
34905bd8deadSopenharmony_ci
34915bd8deadSopenharmony_ci      a boolean indicating whether the program is resident;
34925bd8deadSopenharmony_ci
34935bd8deadSopenharmony_ci      an array of type ubyte containing the program string;
34945bd8deadSopenharmony_ci
34955bd8deadSopenharmony_ci      an integer representing the length of the program string array;
34965bd8deadSopenharmony_ci
34975bd8deadSopenharmony_ci      one four-component floating-point vector for each named local
34985bd8deadSopenharmony_ci      parameter in the program;
34995bd8deadSopenharmony_ci
35005bd8deadSopenharmony_ci      and a set of MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV four-component
35015bd8deadSopenharmony_ci      floating-point vectors to hold numbered local parameters, each initially
35025bd8deadSopenharmony_ci      set to (0,0,0,0).
35035bd8deadSopenharmony_ci
35045bd8deadSopenharmony_ci    Initially, no program objects exist.
35055bd8deadSopenharmony_ci
35065bd8deadSopenharmony_ci    Additionally, the state required during the execution of a fragment
35075bd8deadSopenharmony_ci    program consists of:  twelve 4-component floating-point fragment attribute
35085bd8deadSopenharmony_ci    registers, thirty-two 128-bit physical temporary registers, and a single
35095bd8deadSopenharmony_ci    4-component condition code, whose components have one of four values (LT,
35105bd8deadSopenharmony_ci    EQ, GT, or UN).
35115bd8deadSopenharmony_ci
35125bd8deadSopenharmony_ci    Each time a fragment program is executed, the fragment attribute registers
35135bd8deadSopenharmony_ci    are initialized with the fragment's location and associated data, all
35145bd8deadSopenharmony_ci    temporary register components are initialized to zero, and all condition
35155bd8deadSopenharmony_ci    code components are initialized to EQ.
35165bd8deadSopenharmony_ci
35175bd8deadSopenharmony_ci
35185bd8deadSopenharmony_ci    Renumber Section 3.11 to Section 3.12, Antialiasing Application (p.140).
35195bd8deadSopenharmony_ci    No changes to the text of the section.
35205bd8deadSopenharmony_ci
35215bd8deadSopenharmony_ci
35225bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
35235bd8deadSopenharmony_ciOperations and the Framebuffer) 
35245bd8deadSopenharmony_ci
35255bd8deadSopenharmony_ci    None
35265bd8deadSopenharmony_ci
35275bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 
35285bd8deadSopenharmony_ci
35295bd8deadSopenharmony_ci    Add new section 5.7, Programs (after "Flush and Finish")
35305bd8deadSopenharmony_ci
35315bd8deadSopenharmony_ci    Programs are specified as an array of ubytes used to control the operation
35325bd8deadSopenharmony_ci    of portions of the GL.  The array is a string of ASCII characters encoding
35335bd8deadSopenharmony_ci    the program.
35345bd8deadSopenharmony_ci
35355bd8deadSopenharmony_ci    The command
35365bd8deadSopenharmony_ci
35375bd8deadSopenharmony_ci      LoadProgramNV(enum target, uint id, sizei len, const ubyte *program);
35385bd8deadSopenharmony_ci
35395bd8deadSopenharmony_ci    loads a program.  The target parameter specifies the type of program
35405bd8deadSopenharmony_ci    loaded and can be VERTEX_PROGRAM_NV, VERTEX_STATE_PROGRAM_NV, or
35415bd8deadSopenharmony_ci    FRAGMENT_PROGRAM_NV.  VERTEX_PROGRAM_NV specifies a program to be executed
35425bd8deadSopenharmony_ci    in vertex program mode as each vertex is specified.  VERTEX_STATE_PROGRAM
35435bd8deadSopenharmony_ci    specifies a program to be run manually to update vertex state.
35445bd8deadSopenharmony_ci    FRAGMENT_PROGRAM specifies a program to be executed in fragment program
35455bd8deadSopenharmony_ci    mode as each fragment is rasterized.
35465bd8deadSopenharmony_ci
35475bd8deadSopenharmony_ci    Multiple programs can be loaded with different names.  id names the
35485bd8deadSopenharmony_ci    program to load.  The name space for programs is the set of positive
35495bd8deadSopenharmony_ci    integers (zero is reserved).  The error INVALID_VALUE is generated by
35505bd8deadSopenharmony_ci    LoadProgramNV if a program is loaded with an id of zero.  The error
35515bd8deadSopenharmony_ci    INVALID_OPERATION is generated by LoadProgramNV or if a program is loaded
35525bd8deadSopenharmony_ci    for an id that is currently loaded with a program of a different program
35535bd8deadSopenharmony_ci    target.  program is a pointer to an array of ubytes that represents the
35545bd8deadSopenharmony_ci    program being loaded.  The length of the array in ubytes is indicated by
35555bd8deadSopenharmony_ci    len.
35565bd8deadSopenharmony_ci
35575bd8deadSopenharmony_ci    At program load time, the program is parsed into a set of tokens possibly
35585bd8deadSopenharmony_ci    separated by white space.  Spaces, tabs, newlines, carriage returns, and
35595bd8deadSopenharmony_ci    comments are considered whitespace.  Comments begin with the character "#"
35605bd8deadSopenharmony_ci    and are terminated by a newline, a carriage return, or the end of the
35615bd8deadSopenharmony_ci    program array.  Tokens are processed in a case-sensitive manner:  upper
35625bd8deadSopenharmony_ci    and lower-case letters are not considered equivalent.
35635bd8deadSopenharmony_ci
35645bd8deadSopenharmony_ci    Each program target has a corresponding Backus-Naur Form (BNF) grammar
35655bd8deadSopenharmony_ci    specifying the syntactically valid sequences for programs of the specified
35665bd8deadSopenharmony_ci    type.  The set of valid tokens can be inferred from the grammar.  The
35675bd8deadSopenharmony_ci    token "" represents an empty string and is used to indicate optional
35685bd8deadSopenharmony_ci    rules.  A program is invalid if it contains any undefined tokens or
35695bd8deadSopenharmony_ci    characters.
35705bd8deadSopenharmony_ci
35715bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by LoadProgramNV if a program
35725bd8deadSopenharmony_ci    fails to load because it is not syntactically correct or fails to satisfy
35735bd8deadSopenharmony_ci    all of the semantic restrictions corresponding to the program target.
35745bd8deadSopenharmony_ci
35755bd8deadSopenharmony_ci    A successfully loaded program is parsed into a sequence of instructions.
35765bd8deadSopenharmony_ci    Each instruction is identified by its tokenized name.  The operation of
35775bd8deadSopenharmony_ci    these instructions is specific to the program target and is defined
35785bd8deadSopenharmony_ci    elsewhere.
35795bd8deadSopenharmony_ci
35805bd8deadSopenharmony_ci    A successfully loaded program replaces the program previously assigned to
35815bd8deadSopenharmony_ci    the name specified by id.  If the OUT_OF_MEMORY error is generated by
35825bd8deadSopenharmony_ci    LoadProgramNV, no change is made to the previous contents of the named
35835bd8deadSopenharmony_ci    program.
35845bd8deadSopenharmony_ci
35855bd8deadSopenharmony_ci    Querying the value of PROGRAM_ERROR_POSITION_NV returns a ubyte offset
35865bd8deadSopenharmony_ci    into the program string most recently passed to LoadProgramNV indicating
35875bd8deadSopenharmony_ci    the position of the first error, if any, in the program.  If the program
35885bd8deadSopenharmony_ci    fails to load because of a semantic restriction that cannot be determined
35895bd8deadSopenharmony_ci    until the program is fully scanned, the error position will be len, the
35905bd8deadSopenharmony_ci    length of the program.  If the program loads successfully, the value of
35915bd8deadSopenharmony_ci    PROGRAM_ERROR_POSITION_NV is assigned the value negative one.
35925bd8deadSopenharmony_ci
35935bd8deadSopenharmony_ci    For targets whose programs are executed automatically (e.g., vertex and
35945bd8deadSopenharmony_ci    fragment programs), there must be a current program.  The current vertex
35955bd8deadSopenharmony_ci    program is executed automatically in vertex program mode as vertices are
35965bd8deadSopenharmony_ci    specified.  The current fragment program is executed automatically in
35975bd8deadSopenharmony_ci    fragment program mode as fragments are generated by rasterization.
35985bd8deadSopenharmony_ci    Current programs for a program target are updated by
35995bd8deadSopenharmony_ci
36005bd8deadSopenharmony_ci      BindProgramNV(enum target, uint id);
36015bd8deadSopenharmony_ci
36025bd8deadSopenharmony_ci    where target must be VERTEX_PROGRAM_NV or FRAGMENT_PROGRAM_NV.  The error
36035bd8deadSopenharmony_ci    INVALID_OPERATION is generated by BindProgramNV if id names a program that
36045bd8deadSopenharmony_ci    has a type different than target (for example, if id names a vertex state
36055bd8deadSopenharmony_ci    program as described in section 2.14.4).
36065bd8deadSopenharmony_ci
36075bd8deadSopenharmony_ci    Binding to a nonexistent program id does not generate an error.  In
36085bd8deadSopenharmony_ci    particular, binding to program id zero does not generate an error.
36095bd8deadSopenharmony_ci    However, because program zero cannot be loaded, program zero is always
36105bd8deadSopenharmony_ci    nonexistent.  If a program id is successfully loaded with a new vertex
36115bd8deadSopenharmony_ci    program and id is also the currently bound vertex program, the new program
36125bd8deadSopenharmony_ci    is considered the currently bound vertex program.
36135bd8deadSopenharmony_ci
36145bd8deadSopenharmony_ci    The INVALID_OPERATION error is generated when both vertex program mode is
36155bd8deadSopenharmony_ci    enabled and Begin is called (or when a command that performs an implicit
36165bd8deadSopenharmony_ci    Begin is called) if the current vertex program is nonexistent or not
36175bd8deadSopenharmony_ci    valid.  A vertex program may not be valid for reasons explained in section
36185bd8deadSopenharmony_ci    2.14.5.
36195bd8deadSopenharmony_ci
36205bd8deadSopenharmony_ci    The INVALID_OPERATION error is generated when both fragment program mode
36215bd8deadSopenharmony_ci    is enabled and Begin, another GL command that performs an implicit Begin,
36225bd8deadSopenharmony_ci    or any other GL command that generates fragments is called, if the current
36235bd8deadSopenharmony_ci    fragment program is nonexistent or not valid.  A fragment program may be
36245bd8deadSopenharmony_ci    invalid for reasons explained in Section 3.11.3.
36255bd8deadSopenharmony_ci
36265bd8deadSopenharmony_ci    Programs are deleted by calling
36275bd8deadSopenharmony_ci
36285bd8deadSopenharmony_ci      void DeleteProgramsNV(sizei n, const uint *ids);
36295bd8deadSopenharmony_ci
36305bd8deadSopenharmony_ci    ids contains n names of programs to be deleted.  After a program is
36315bd8deadSopenharmony_ci    deleted, it becomes nonexistent, and its name is again unused.  If a
36325bd8deadSopenharmony_ci    program that is currently bound is deleted, it is as though BindProgramNV
36335bd8deadSopenharmony_ci    has been executed with the same target as the deleted program and program
36345bd8deadSopenharmony_ci    zero.  Unused names in ids are silently ignored, as is the value zero.
36355bd8deadSopenharmony_ci
36365bd8deadSopenharmony_ci    The command
36375bd8deadSopenharmony_ci
36385bd8deadSopenharmony_ci      void GenProgramsNV(sizei n, uint *ids);
36395bd8deadSopenharmony_ci
36405bd8deadSopenharmony_ci    returns n currently unused program names in ids.  These names are marked
36415bd8deadSopenharmony_ci    as used, for the purposes of GenProgramsNV only, but they become existent
36425bd8deadSopenharmony_ci    programs only when the are first loaded using LoadProgramNV.
36435bd8deadSopenharmony_ci
36445bd8deadSopenharmony_ci    An implementation may choose to establish a working set of programs on
36455bd8deadSopenharmony_ci    which binding and/or manual execution are performed with higher
36465bd8deadSopenharmony_ci    performance.  A program that is currently part of this working set is said
36475bd8deadSopenharmony_ci    to be resident.
36485bd8deadSopenharmony_ci
36495bd8deadSopenharmony_ci    The command
36505bd8deadSopenharmony_ci      
36515bd8deadSopenharmony_ci      boolean AreProgramsResidentNV(sizei n, const uint *ids,
36525bd8deadSopenharmony_ci                                    boolean *residences);
36535bd8deadSopenharmony_ci
36545bd8deadSopenharmony_ci    returns TRUE if all of the n programs named in ids are resident, or if the
36555bd8deadSopenharmony_ci    implementation does not distinguish a working set.  If at least one of the
36565bd8deadSopenharmony_ci    programs named in ids is not resident, then FALSE is returned, and the
36575bd8deadSopenharmony_ci    residence of each program is returned in residences.  Otherwise the
36585bd8deadSopenharmony_ci    contents of residences are not changed.  If any of the names in ids are
36595bd8deadSopenharmony_ci    nonexistent or zero, FALSE is returned, the error INVALID_VALUE is
36605bd8deadSopenharmony_ci    generated, and the contents of residences are indeterminate.  The
36615bd8deadSopenharmony_ci    residence status of a single named program can also be queried by calling
36625bd8deadSopenharmony_ci    GetProgramivNV (Section 6.1.13) with id set to the name of the program and
36635bd8deadSopenharmony_ci    pname set to PROGRAM_RESIDENT_NV.
36645bd8deadSopenharmony_ci
36655bd8deadSopenharmony_ci    AreProgramsResidentNV indicates only whether a program is currently
36665bd8deadSopenharmony_ci    resident, not whether it could not be made resident.  An implementation
36675bd8deadSopenharmony_ci    may choose to make a program resident only on first use, for example.  The
36685bd8deadSopenharmony_ci    client may guide the GL implementation in determining which programs
36695bd8deadSopenharmony_ci    should be resident by requesting a set of programs to make resident.
36705bd8deadSopenharmony_ci
36715bd8deadSopenharmony_ci    The command
36725bd8deadSopenharmony_ci
36735bd8deadSopenharmony_ci      void RequestResidentProgramsNV(sizei n, const uint *ids);
36745bd8deadSopenharmony_ci
36755bd8deadSopenharmony_ci    requests that the n programs named in ids should be made resident.
36765bd8deadSopenharmony_ci    While all the programs are not guaranteed to become resident,
36775bd8deadSopenharmony_ci    the implementation should make a best effort to make as many of
36785bd8deadSopenharmony_ci    the programs resident as possible.  As a result of making the
36795bd8deadSopenharmony_ci    requested programs resident, program names not among the requested
36805bd8deadSopenharmony_ci    programs may become non-resident.  Higher priority for residency
36815bd8deadSopenharmony_ci    should be given to programs listed earlier in the ids array.
36825bd8deadSopenharmony_ci    RequestResidentProgramsNV silently ignores attempts to make resident
36835bd8deadSopenharmony_ci    nonexistent program names or zero.  AreProgramsResidentNV can be
36845bd8deadSopenharmony_ci    called after RequestResidentProgramsNV to determine which programs
36855bd8deadSopenharmony_ci    actually became resident.
36865bd8deadSopenharmony_ci
36875bd8deadSopenharmony_ci    The commands
36885bd8deadSopenharmony_ci
36895bd8deadSopenharmony_ci      void ProgramNamedParameter4fNV(uint id, sizei len, const ubyte *name,
36905bd8deadSopenharmony_ci                                     float x, float y, float z, float w);
36915bd8deadSopenharmony_ci      void ProgramNamedParameter4dNV(uint id, sizei len, const ubyte *name,
36925bd8deadSopenharmony_ci                                     double x, double y, double z, double w);
36935bd8deadSopenharmony_ci      void ProgramNamedParameter4fvNV(uint id, sizei len, const ubyte *name,
36945bd8deadSopenharmony_ci                                      const float v[]);
36955bd8deadSopenharmony_ci      void ProgramNamedParameter4dvNV(uint id, sizei len, const ubyte *name,
36965bd8deadSopenharmony_ci                                      const double v[]);
36975bd8deadSopenharmony_ci
36985bd8deadSopenharmony_ci    specify a new value for the named program local parameter <name> belonging
36995bd8deadSopenharmony_ci    to the fragment program specified by <id>.  <name> is a pointer to an
37005bd8deadSopenharmony_ci    array of ubytes holding the parameter name.  <len> specifies the number of
37015bd8deadSopenharmony_ci    ubytes in the array given by <name>.  The new x, y, z, and w components of
37025bd8deadSopenharmony_ci    the named local parameter are given by x, y, z, and w, respectively, for
37035bd8deadSopenharmony_ci    ProgramNamedParameter4fNV and ProgramNamedParameter4dNV, and by v[0],
37045bd8deadSopenharmony_ci    v[1], v[2], and v[3], respectively, for ProgramNamedParameter4fvNV and
37055bd8deadSopenharmony_ci    ProgramNamedParameter4dvNV.  The error INVALID_OPERATION is generated if
37065bd8deadSopenharmony_ci    <id> specifies a nonexistent program or a program whose type does not
37075bd8deadSopenharmony_ci    suport named local parameters.  The error INVALID_VALUE error is generated
37085bd8deadSopenharmony_ci    if <name> does not specify the name of a local parameter in the program
37095bd8deadSopenharmony_ci    corresponding to <id>.  The error INVALID_VALUE is also generated if <len>
37105bd8deadSopenharmony_ci    is zero.
37115bd8deadSopenharmony_ci
37125bd8deadSopenharmony_ci    The commands
37135bd8deadSopenharmony_ci
37145bd8deadSopenharmony_ci      void ProgramLocalParameter4fARB(enum target, uint index,
37155bd8deadSopenharmony_ci                                      float x, float y, float z, float w);
37165bd8deadSopenharmony_ci      void ProgramLocalParameter4fvARB(enum target, uint index, 
37175bd8deadSopenharmony_ci                                       const float *params);
37185bd8deadSopenharmony_ci      void ProgramLocalParameter4dARB(enum target, uint index,
37195bd8deadSopenharmony_ci                                      double x, double y, double z, double w);
37205bd8deadSopenharmony_ci      void ProgramLocalParameter4dvARB(enum target, uint index, 
37215bd8deadSopenharmony_ci                                       const double *params);
37225bd8deadSopenharmony_ci
37235bd8deadSopenharmony_ci    update the values of the numbered program local parameter <index>
37245bd8deadSopenharmony_ci    belonging to the program object currently bound to <target>.  For
37255bd8deadSopenharmony_ci    ProgramLocalParameter4fARB and ProgramLocalParameter4dARB, the four
37265bd8deadSopenharmony_ci    components of the parameter are updated with the values of <x>, <y>, <z>,
37275bd8deadSopenharmony_ci    and <w>, respectively.  For ProgramLocalParameter4fvARB and
37285bd8deadSopenharmony_ci    ProgramLocalParameter4dvARB, the four components of the parameter are
37295bd8deadSopenharmony_ci    updated with the array of four values pointed to by <params>.  The error
37305bd8deadSopenharmony_ci    INVALID_VALUE is generated if <index> is greater than or equal to the
37315bd8deadSopenharmony_ci    number of numbered program local parameters supported by <target>.
37325bd8deadSopenharmony_ci
37335bd8deadSopenharmony_ci
37345bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
37355bd8deadSopenharmony_ciState Requests)
37365bd8deadSopenharmony_ci
37375bd8deadSopenharmony_ci    Modify Section 6.1.11, Pointer and String Queries (p. 206)
37385bd8deadSopenharmony_ci
37395bd8deadSopenharmony_ci    (modify last paragraph, p. 206) ... The possible values for <name> are
37405bd8deadSopenharmony_ci    VENDOR, RENDERER, VERSION, EXTENSIONS, and PROGRAM_ERROR_STRING_NV.
37415bd8deadSopenharmony_ci
37425bd8deadSopenharmony_ci    (add after last paragraph of section, p. 207) Queries of
37435bd8deadSopenharmony_ci    PROGRAM_ERROR_STRING_NV return a pointer to an implementation-dependent
37445bd8deadSopenharmony_ci    program load error string.  If the last call to LoadProgramNV failed to
37455bd8deadSopenharmony_ci    load a program, the returned string describes a reason that the program
37465bd8deadSopenharmony_ci    failed to load.  Otherwise, a pointer to an empty string (containing only
37475bd8deadSopenharmony_ci    a terminator) is returned.
37485bd8deadSopenharmony_ci
37495bd8deadSopenharmony_ci    Rename and modify Section 6.1.13, Vertex and Fragment Program Queries
37505bd8deadSopenharmony_ci    (from GL_NV_fragment_program).  Portions of this section pertaining to
37515bd8deadSopenharmony_ci    fragment programs are copied verbatim.
37525bd8deadSopenharmony_ci
37535bd8deadSopenharmony_ci    (insert after discussion of GetProgramParameter[fd]vNV)
37545bd8deadSopenharmony_ci
37555bd8deadSopenharmony_ci    The commands
37565bd8deadSopenharmony_ci
37575bd8deadSopenharmony_ci      void GetProgramNamedParameterfvNV(uint id, sizei len,
37585bd8deadSopenharmony_ci                                        const ubyte *name, float *params);
37595bd8deadSopenharmony_ci      void GetProgramNamedParameterdvNV(uint id, sizei len,
37605bd8deadSopenharmony_ci                                        const ubyte *name, double *params);
37615bd8deadSopenharmony_ci
37625bd8deadSopenharmony_ci    obtain the current program named local parameter value for the parameter
37635bd8deadSopenharmony_ci    named <name> belonging to the program given by <id>.  <name> is a pointer
37645bd8deadSopenharmony_ci    to an array of ubytes holding the parameter name.  <len> specifies the
37655bd8deadSopenharmony_ci    number of ubytes in the array given by <name>.  The error
37665bd8deadSopenharmony_ci    INVALID_OPERATION is generated if <id> specifies a nonexistent program or
37675bd8deadSopenharmony_ci    a program whose type does not suport named local parameters.  The error
37685bd8deadSopenharmony_ci    INVALID_VALUE is generated if <name> does not specify the name of a local
37695bd8deadSopenharmony_ci    parameter in the program corresponding to <id>.  The error INVALID_VALUE
37705bd8deadSopenharmony_ci    is also generated if <len> is zero.  Each named program local parameter is
37715bd8deadSopenharmony_ci    an array of four values.
37725bd8deadSopenharmony_ci
37735bd8deadSopenharmony_ci    The commands
37745bd8deadSopenharmony_ci
37755bd8deadSopenharmony_ci      void GetProgramLocalParameterdvARB(enum target, uint index,
37765bd8deadSopenharmony_ci                                         double *params);
37775bd8deadSopenharmony_ci      void GetProgramLocalParameterfvARB(enum target, uint index,
37785bd8deadSopenharmony_ci                                         float *params);
37795bd8deadSopenharmony_ci
37805bd8deadSopenharmony_ci    obtain the current value for the numbered program local parameter <index>
37815bd8deadSopenharmony_ci    belonging to the program object currently bound to <target>, and places
37825bd8deadSopenharmony_ci    the information in the array <params>.  The error INVALID_ENUM is
37835bd8deadSopenharmony_ci    generated if <target> specifies a nonexistent program target or a program
37845bd8deadSopenharmony_ci    target that does not support numbered program local parameters.  The error
37855bd8deadSopenharmony_ci    INVALID_VALUE is generated if <index> is greater than or equal to the
37865bd8deadSopenharmony_ci    implementation-dependent number of supported numbered program local
37875bd8deadSopenharmony_ci    parameters for the program target.
37885bd8deadSopenharmony_ci
37895bd8deadSopenharmony_ci    When the program target type is FRAGMENT_PROGRAM_NV, each numbered program
37905bd8deadSopenharmony_ci    local parameter returned is an array of four values.  ...
37915bd8deadSopenharmony_ci
37925bd8deadSopenharmony_ci    The command
37935bd8deadSopenharmony_ci
37945bd8deadSopenharmony_ci      void GetProgramivNV(uint id, enum pname, int *params);
37955bd8deadSopenharmony_ci
37965bd8deadSopenharmony_ci    obtains program state named by pname for the program named id in the array
37975bd8deadSopenharmony_ci    params.  pname must be one of PROGRAM_TARGET_NV, PROGRAM_LENGTH_NV, or
37985bd8deadSopenharmony_ci    PROGRAM_RESIDENT_NV.  The error INVALID_OPERATION is generated if the
37995bd8deadSopenharmony_ci    program named id does not exist.
38005bd8deadSopenharmony_ci
38015bd8deadSopenharmony_ci    The command
38025bd8deadSopenharmony_ci
38035bd8deadSopenharmony_ci      void GetProgramStringNV(uint id, enum pname,
38045bd8deadSopenharmony_ci                              ubyte *program);
38055bd8deadSopenharmony_ci
38065bd8deadSopenharmony_ci    obtains the program string for program id.  pname must be
38075bd8deadSopenharmony_ci    PROGRAM_STRING_NV.  n ubytes are returned into the array program
38085bd8deadSopenharmony_ci    where n is the length of the program in ubytes.  GetProgramivNV with
38095bd8deadSopenharmony_ci    PROGRAM_LENGTH_NV can be used to query the length of a program's
38105bd8deadSopenharmony_ci    string.  The INVALID_OPERATION error is generated if the program
38115bd8deadSopenharmony_ci    named id does not exist.
38125bd8deadSopenharmony_ci
38135bd8deadSopenharmony_ci    ...
38145bd8deadSopenharmony_ci
38155bd8deadSopenharmony_ci    The command
38165bd8deadSopenharmony_ci
38175bd8deadSopenharmony_ci      boolean IsProgramNV(uint id);
38185bd8deadSopenharmony_ci
38195bd8deadSopenharmony_ci    returns TRUE if program is the name of a program object.  If program
38205bd8deadSopenharmony_ci    is zero or is a non-zero value that is not the name of a program
38215bd8deadSopenharmony_ci    object, or if an error condition occurs, IsProgramNV returns FALSE.
38225bd8deadSopenharmony_ci    A name returned by GenProgramsNV but not yet loaded with a program
38235bd8deadSopenharmony_ci    is not the name of a program object."
38245bd8deadSopenharmony_ci
38255bd8deadSopenharmony_ci
38265bd8deadSopenharmony_ciAdditions to Appendix F of the OpenGL 1.2.1 Specification (ARB Extensions)
38275bd8deadSopenharmony_ci
38285bd8deadSopenharmony_ci    Modify Section F.2.3 (Changes to Section 2.6), p.240
38295bd8deadSopenharmony_ci 
38305bd8deadSopenharmony_ci    (modify last paragraph on p.240) ... Multiple sets of texture coordinates
38315bd8deadSopenharmony_ci    may be used to specify how multiple texture images are mapped onto a
38325bd8deadSopenharmony_ci    primitive.  The number of texture coordinate sets supported is
38335bd8deadSopenharmony_ci    implementation dependent, but must be at least 1.  The number of texture
38345bd8deadSopenharmony_ci    coordinate sets supported may be queried with the state
38355bd8deadSopenharmony_ci    MAX_TEXTURE_COORDS_NV.
38365bd8deadSopenharmony_ci
38375bd8deadSopenharmony_ci    Modify Section F.2.4 (Changes to Section 2.7), p.241
38385bd8deadSopenharmony_ci
38395bd8deadSopenharmony_ci    (modify the last paragraph on p.241, carrying over to p.243)
38405bd8deadSopenharmony_ci    Implementations may support more than one set of texture coordinates.  The
38415bd8deadSopenharmony_ci    commands
38425bd8deadSopenharmony_ci
38435bd8deadSopenharmony_ci        void MultiTexCoord{1234}{sifd}ARB(enum texture, T coords)
38445bd8deadSopenharmony_ci        void MultiTexCoord{1234}{sifd}vARB(enum texture, T coords)
38455bd8deadSopenharmony_ci
38465bd8deadSopenharmony_ci    take the coordinate set to be modified as the <texture> parameter.
38475bd8deadSopenharmony_ci    <texture> is a symbolic constant of the form TEXTUREi_ARB, indicating that
38485bd8deadSopenharmony_ci    texture coordinate set i is to be modified.  The constants obey
38495bd8deadSopenharmony_ci    TEXTUREi_ARB = TEXTURE0_ARB + i (i is in the range 0 to k-1, where k is
38505bd8deadSopenharmony_ci    the implementation dependent number of texture units defined by
38515bd8deadSopenharmony_ci    MAX_TEXTURE_COORDS_NV).
38525bd8deadSopenharmony_ci
38535bd8deadSopenharmony_ci
38545bd8deadSopenharmony_ci    Modify Section F.2.5 (Changes to Section 2.8), p.243
38555bd8deadSopenharmony_ci
38565bd8deadSopenharmony_ci    (modify first and second paragraphs of section) ... The client may specify
38575bd8deadSopenharmony_ci    up to 5 plus the value of MAX_TEXTURE_COORDS_NV arrays; one each to store
38585bd8deadSopenharmony_ci    vertex coordinates...
38595bd8deadSopenharmony_ci
38605bd8deadSopenharmony_ci    In implementations which support more than one texture coordinate set, the
38615bd8deadSopenharmony_ci    command
38625bd8deadSopenharmony_ci
38635bd8deadSopenharmony_ci        void ClientActiveTextureARB(enum texture)
38645bd8deadSopenharmony_ci
38655bd8deadSopenharmony_ci    is used to select the vertex array client state parameters to be modified
38665bd8deadSopenharmony_ci    by the TexCoordPointer command and the array affected by EnableClientState
38675bd8deadSopenharmony_ci    and DisableClientState with the parameter TEXTURE_COORD_ARRAY.  This
38685bd8deadSopenharmony_ci    command sets the state variable CLIENT_ACTIVE_TEXTURE_ARB.  Each texture
38695bd8deadSopenharmony_ci    coordinate set has a client state vector which is selected when this
38705bd8deadSopenharmony_ci    command is invoked.  This state vector also includes the vertex array
38715bd8deadSopenharmony_ci    state.  This command also selects the texture coordinate set state used
38725bd8deadSopenharmony_ci    for queries of client state.
38735bd8deadSopenharmony_ci
38745bd8deadSopenharmony_ci    (modify first paragraph on p.244) If the number of supported texture
38755bd8deadSopenharmony_ci    coordinate sets (the value of MAX_TEXTURE_COORDS_NV) is k, ...
38765bd8deadSopenharmony_ci
38775bd8deadSopenharmony_ci
38785bd8deadSopenharmony_ci    Modify Section F.2.6 (Changes to Section 2.10.2), p.244
38795bd8deadSopenharmony_ci
38805bd8deadSopenharmony_ci    (modify first paragraph)  For each texture coordinate set, a 4x4 matrix is
38815bd8deadSopenharmony_ci    applied to the corresponding texture coordinates...
38825bd8deadSopenharmony_ci
38835bd8deadSopenharmony_ci    (replace second and third paragraphs) The command
38845bd8deadSopenharmony_ci
38855bd8deadSopenharmony_ci      void ActiveTextureARB(enum texture);
38865bd8deadSopenharmony_ci
38875bd8deadSopenharmony_ci    specifies the active texture unit selector, ACTIVE_TEXTURE_ARB.  Each
38885bd8deadSopenharmony_ci    texture unit contains up to two distinct sub-units:  a texture coordinate
38895bd8deadSopenharmony_ci    processing unit (consisting of a texture matrix stack and texture
38905bd8deadSopenharmony_ci    coordinate generation state) and a texture image unit (consisting of all
38915bd8deadSopenharmony_ci    the texture state defined in Section 3.8).  In implementations with a
38925bd8deadSopenharmony_ci    different number of supported texture coordinate sets and texture image
38935bd8deadSopenharmony_ci    units, some texture units may consist of only one of the two sub-units.
38945bd8deadSopenharmony_ci
38955bd8deadSopenharmony_ci    The active texture unit selector specifies the texture unit accessed by
38965bd8deadSopenharmony_ci    commands involving texture coordinate processing.  Such commands include
38975bd8deadSopenharmony_ci    those accessing the current matrix stack (if MATRIX_MODE is TEXTURE),
38985bd8deadSopenharmony_ci    TexGen (Section 2.10.4), Enable/Disable (if any texture coordinate
38995bd8deadSopenharmony_ci    generation enum is selected), as well as queries of the current texture
39005bd8deadSopenharmony_ci    coordinates and current raster texture coordinates.  If the texture unit
39015bd8deadSopenharmony_ci    number corresponding to the current value of ACTIVE_TEXTURE_ARB is greater
39025bd8deadSopenharmony_ci    than or equal to the implementation dependent constant
39035bd8deadSopenharmony_ci    MAX_TEXTURE_COORDS_NV, the error INVALID_OPERATION is generated by any
39045bd8deadSopenharmony_ci    such command.
39055bd8deadSopenharmony_ci
39065bd8deadSopenharmony_ci    The active texture unit selector also selects the texture unit accessed by
39075bd8deadSopenharmony_ci    commands involving texture image processing (Section 3.8).  Such commands
39085bd8deadSopenharmony_ci    include all variants of TexEnv, TexParameter, and TexImage commands,
39095bd8deadSopenharmony_ci    BindTexture, Enable/Disable for any texture target (e.g., TEXTURE_2D), and
39105bd8deadSopenharmony_ci    queries of all such state.  If the texture unit number corresponding to
39115bd8deadSopenharmony_ci    the current value of ACTIVE_TEXTURE_ARB is greater than or equal to the
39125bd8deadSopenharmony_ci    implementation dependent constant MAX_TEXTURE_IMAGE_UNITS_NV, the error
39135bd8deadSopenharmony_ci    INVALID_OPERATION is generated by any such command.
39145bd8deadSopenharmony_ci
39155bd8deadSopenharmony_ci    ActiveTextureARB generates the error INVALID_ENUM if an invalid <texture>
39165bd8deadSopenharmony_ci    is specified.  <texture> is a symbolic constant of the form TEXTUREi_ARB,
39175bd8deadSopenharmony_ci    indicating that texture unit i is to be modified.  The constants obey
39185bd8deadSopenharmony_ci    TEXTUREi_ARB = TEXTURE0_ARB + i (i is in the range 0 to k-1, where k is
39195bd8deadSopenharmony_ci    the larger of the MAX_TEXTURE_COORDS_NV and MAX_TEXTURE_IMAGE_UNITS_NV).
39205bd8deadSopenharmony_ci    For compatibility with old OpenGL specifications, the implementation
39215bd8deadSopenharmony_ci    dependent constant MAX_TEXTURE_UNITS_ARB specifies the number of
39225bd8deadSopenharmony_ci    conventional texture units supported by the implementation.  Its value
39235bd8deadSopenharmony_ci    must be no larger than the minimum of MAX_TEXTURE_COORDS_NV and
39245bd8deadSopenharmony_ci    MAX_TEXTURE_IMAGE_UNITS_NV.
39255bd8deadSopenharmony_ci
39265bd8deadSopenharmony_ci    Modify Section F.2.12 (Changes to Section 3.8.10), p.249
39275bd8deadSopenharmony_ci
39285bd8deadSopenharmony_ci    (modify next-to-last paragraph) Texturing is enabled and disabled
39295bd8deadSopenharmony_ci    individually for each texture unit.  If texturing is disabled for one of
39305bd8deadSopenharmony_ci    the units, then the fragment resulting from the previous unit is passed
39315bd8deadSopenharmony_ci    unaltered to the following unit.  Individual texture units beyond those
39325bd8deadSopenharmony_ci    specified by MAX_TEXTURE_UNITS_ARB may be incomplete and are always
39335bd8deadSopenharmony_ci    treated as disabled.
39345bd8deadSopenharmony_ci
39355bd8deadSopenharmony_ci    Modify Section F.2.15 (Changes to Section 6.1.2), p.251
39365bd8deadSopenharmony_ci    
39375bd8deadSopenharmony_ci    (add to end of paragraph) Queries of texture state variables corresponding
39385bd8deadSopenharmony_ci    to texture coordinate processing unit (namely, TexGen state and enables,
39395bd8deadSopenharmony_ci    and matrices) will produce an INVALID_OPERATION error if the value of
39405bd8deadSopenharmony_ci    ACTIVE_TEXTURE_ARB is greater than or equal to MAX_TEXTURE_COORDS_NV.  All
39415bd8deadSopenharmony_ci    other texture state queries will result in an INVALID_OPERATION error if
39425bd8deadSopenharmony_ci    the value of ACTIVE_TEXTURE_ARB is greater than or equal to
39435bd8deadSopenharmony_ci    MAX_TEXTURE_IMAGE_UNITS_NV.
39445bd8deadSopenharmony_ci
39455bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
39465bd8deadSopenharmony_ci
39475bd8deadSopenharmony_ci    Program objects are shared between AGL/GLX/WGL rendering contexts if
39485bd8deadSopenharmony_ci    and only if the rendering contexts share display lists.  No change
39495bd8deadSopenharmony_ci    is made to the AGL/GLX/WGL API.
39505bd8deadSopenharmony_ci
39515bd8deadSopenharmony_ciDependencies on GL_NV_vertex_program
39525bd8deadSopenharmony_ci
39535bd8deadSopenharmony_ci    If NV_vertex_program is supported, the description of LoadProgramNV in
39545bd8deadSopenharmony_ci    Section 2.14.1.7 (up to the BNF description of vertex programs) is
39555bd8deadSopenharmony_ci    deleted, as it is replaced by the contents of Section 5.7 in this
39565bd8deadSopenharmony_ci    specification.  The general error descriptions in Section 2.14.1.7 common
39575bd8deadSopenharmony_ci    to Section 5.7 (like INVALID_OPERATION if the program fails to compile)
39585bd8deadSopenharmony_ci    should also be deleted.  Section 2.14.1.8 should also be deleted.  Section
39595bd8deadSopenharmony_ci    6.1.13 is modified by this specification as described above.
39605bd8deadSopenharmony_ci
39615bd8deadSopenharmony_ciDependencies on NV_texture_shader
39625bd8deadSopenharmony_ci
39635bd8deadSopenharmony_ci    If NV_texture_shader is not supported, the comment about texture shaders
39645bd8deadSopenharmony_ci    being disabled in fragment program mode is not applicable.
39655bd8deadSopenharmony_ci
39665bd8deadSopenharmony_ciDependencies on NV_texture_rectangle
39675bd8deadSopenharmony_ci  
39685bd8deadSopenharmony_ci    If NV_texture_rectangle is not supported, the references to "RECT" in the
39695bd8deadSopenharmony_ci    <texImageTarget> grammar rule and TEXTURE_RECTANGLE_NV are not applicable.
39705bd8deadSopenharmony_ci
39715bd8deadSopenharmony_ciDependencies on ARB_texture_cube_map
39725bd8deadSopenharmony_ci  
39735bd8deadSopenharmony_ci    If ARB_texture_cube_map is not supported, the references to "CUBE" in the
39745bd8deadSopenharmony_ci    <texImageTarget> grammar rule and TEXTURE_CUBE_MAP_ARB are not applicable.
39755bd8deadSopenharmony_ci
39765bd8deadSopenharmony_ciDependencies on EXT_fog_coord
39775bd8deadSopenharmony_ci
39785bd8deadSopenharmony_ci    If EXT_fog_coord is not supported, references to "fog coordinate" in the
39795bd8deadSopenharmony_ci    definition of the "FOGC" fragment attribute register should be removed.
39805bd8deadSopenharmony_ci
39815bd8deadSopenharmony_ciDependencies on NV_depth_clamp
39825bd8deadSopenharmony_ci
39835bd8deadSopenharmony_ci    If NV_depth_clamp is not supported, section 3.11.6 is modified to remove
39845bd8deadSopenharmony_ci    discussion of the depth clamp enable and instead indicate that fragments
39855bd8deadSopenharmony_ci    with depth values outside [min(n,f), max(n,f)] are always discarded.
39865bd8deadSopenharmony_ci
39875bd8deadSopenharmony_ciDependencies on ARB_depth_texture and SGIX_depth_texture
39885bd8deadSopenharmony_ci
39895bd8deadSopenharmony_ci    If ARB_depth_texture is not supported, but SGIX_depth_texture is
39905bd8deadSopenharmony_ci    supported, the discussion of Table X.5 is modified to indicate that
39915bd8deadSopenharmony_ci    DEPTH_COMPONENT textures are treated as LUMINANCE.
39925bd8deadSopenharmony_ci
39935bd8deadSopenharmony_ci    If neither extension is supported, the discussion of DEPTH_COMPONENT
39945bd8deadSopenharmony_ci    textures in Table X.5 should be removed.
39955bd8deadSopenharmony_ci
39965bd8deadSopenharmony_ciDependencies on NV_float_buffer
39975bd8deadSopenharmony_ci
39985bd8deadSopenharmony_ci    If NV_float_buffer is not supported, references to FLOAT_R_NV,
39995bd8deadSopenharmony_ci    FLOAT_RG_NV, FLOAT_RGB_NV, and FLOAT_RGBA_NV internal texture formats in
40005bd8deadSopenharmony_ci    Table X.5 should be removed.
40015bd8deadSopenharmony_ci
40025bd8deadSopenharmony_ciDependencies on ARB_vertex_program
40035bd8deadSopenharmony_ci
40045bd8deadSopenharmony_ci    This extension does not have any explicit dependencies, but the APIs for
40055bd8deadSopenharmony_ci    setting and querying numbered local parameters (ProgramLocalParameter*ARB
40065bd8deadSopenharmony_ci    and GetProgramLocalParameter*ARB) were taken directly from this extension,
40075bd8deadSopenharmony_ci
40085bd8deadSopenharmony_ciDependencies on ARB_fragment_program
40095bd8deadSopenharmony_ci
40105bd8deadSopenharmony_ci    If ARB_fragment_program is not supported, the maximum number of executable
40115bd8deadSopenharmony_ci    instructions in any !!FP1.0 program is 1024.  If ARB_fragment_program is
40125bd8deadSopenharmony_ci    supported, the maximum number of executable instructions for an !!FP1.0 is
40135bd8deadSopenharmony_ci    at least 1024, but can be larger.  The limit can be queried by calling
40145bd8deadSopenharmony_ci    GetProgramiv with <target> set to FRAGMENT_PROGRAM_ARB and <pname> set to
40155bd8deadSopenharmony_ci    MAX_PROGRAM_INSTRUCTIONS_ARB.
40165bd8deadSopenharmony_ci
40175bd8deadSopenharmony_ci
40185bd8deadSopenharmony_ciGLX Protocol
40195bd8deadSopenharmony_ci
40205bd8deadSopenharmony_ci    Most of the GLX protocol needed to implement this extension is described
40215bd8deadSopenharmony_ci    in the GL_NV_vertex_program extension specification and will not be
40225bd8deadSopenharmony_ci    repeated here.
40235bd8deadSopenharmony_ci
40245bd8deadSopenharmony_ci    The following two rendering commands are potentially large, and hence can
40255bd8deadSopenharmony_ci    be sent in a glXRender or glXRenderLarge request.
40265bd8deadSopenharmony_ci
40275bd8deadSopenharmony_ci        ProgramNamedParameter4fvNV
40285bd8deadSopenharmony_ci            2           28+len+p        rendering command length
40295bd8deadSopenharmony_ci            2           4218            rendering command opcode
40305bd8deadSopenharmony_ci            4           CARD32          id
40315bd8deadSopenharmony_ci            4           CARD32          len
40325bd8deadSopenharmony_ci            4           FLOAT32         params[0]
40335bd8deadSopenharmony_ci            4           FLOAT32         params[1]
40345bd8deadSopenharmony_ci            4           FLOAT32         params[2]
40355bd8deadSopenharmony_ci            4           FLOAT32         params[3]
40365bd8deadSopenharmony_ci            len         LISTofCARD8     name
40375bd8deadSopenharmony_ci            p                           unused, p=pad(len)
40385bd8deadSopenharmony_ci
40395bd8deadSopenharmony_ci         If the command is encoded in a glxRenderLarge request, the command
40405bd8deadSopenharmony_ci         opcode and command length fields above are expanded to 4 bytes each:
40415bd8deadSopenharmony_ci
40425bd8deadSopenharmony_ci            4           32+len+p        rendering command length
40435bd8deadSopenharmony_ci            4           4218            rendering command opcode
40445bd8deadSopenharmony_ci
40455bd8deadSopenharmony_ci
40465bd8deadSopenharmony_ci        ProgramNamedParameter4dvNV
40475bd8deadSopenharmony_ci            2           44+len+p        rendering command length
40485bd8deadSopenharmony_ci            2           4219            rendering command opcode
40495bd8deadSopenharmony_ci            4           CARD32          id
40505bd8deadSopenharmony_ci            4           CARD32          len
40515bd8deadSopenharmony_ci            8           FLOAT64         params[0]
40525bd8deadSopenharmony_ci            8           FLOAT64         params[1]
40535bd8deadSopenharmony_ci            8           FLOAT64         params[2]
40545bd8deadSopenharmony_ci            8           FLOAT64         params[3]
40555bd8deadSopenharmony_ci            len         LISTofCARD8     name
40565bd8deadSopenharmony_ci            p                           unused, p=pad(len)
40575bd8deadSopenharmony_ci
40585bd8deadSopenharmony_ci         If the command is encoded in a glxRenderLarge request, the command
40595bd8deadSopenharmony_ci         opcode and command length fields above are expanded to 4 bytes each:
40605bd8deadSopenharmony_ci
40615bd8deadSopenharmony_ci            4           48+len+p        rendering command length
40625bd8deadSopenharmony_ci            4           4219            rendering command opcode
40635bd8deadSopenharmony_ci
40645bd8deadSopenharmony_ci
40655bd8deadSopenharmony_ci    The remaining two commands are non-rendering commands.  These commands are
40665bd8deadSopenharmony_ci    sent separately (i.e., not as part of a glXRender or glXRenderLarge
40675bd8deadSopenharmony_ci    request), using the glXVendorPrivateWithReply request:
40685bd8deadSopenharmony_ci
40695bd8deadSopenharmony_ci        GetProgramNamedParameterfvNV
40705bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
40715bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
40725bd8deadSopenharmony_ci            2           4+(len+p)/4     request length
40735bd8deadSopenharmony_ci            4           1310            vendor specific opcode
40745bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
40755bd8deadSopenharmony_ci            4           INT32           len
40765bd8deadSopenharmony_ci            len         LISTofCARD8     name
40775bd8deadSopenharmony_ci            p                           unused, p=pad(len)
40785bd8deadSopenharmony_ci          =>
40795bd8deadSopenharmony_ci
40805bd8deadSopenharmony_ci          If the command succeeds, 4 floats are sent in the reply:
40815bd8deadSopenharmony_ci
40825bd8deadSopenharmony_ci            1           1               reply
40835bd8deadSopenharmony_ci            1                           unused
40845bd8deadSopenharmony_ci            2           CARD16          sequence number
40855bd8deadSopenharmony_ci            4           4               reply length
40865bd8deadSopenharmony_ci            24                          unused
40875bd8deadSopenharmony_ci            16          LISTofFLOAT32   params
40885bd8deadSopenharmony_ci
40895bd8deadSopenharmony_ci          Otherwise, an empty reply is sent, indicating that a GL error
40905bd8deadSopenharmony_ci          occured:
40915bd8deadSopenharmony_ci
40925bd8deadSopenharmony_ci            1           1               reply
40935bd8deadSopenharmony_ci            1                           unused
40945bd8deadSopenharmony_ci            2           CARD16          sequence number
40955bd8deadSopenharmony_ci            4           0               reply length
40965bd8deadSopenharmony_ci            24                          unused
40975bd8deadSopenharmony_ci
40985bd8deadSopenharmony_ci
40995bd8deadSopenharmony_ci        GetProgramNamedParameterdvNV
41005bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
41015bd8deadSopenharmony_ci            1           17              GLX opcode (glXVendorPrivateWithReply)
41025bd8deadSopenharmony_ci            2           4+(len+p)/4     request length
41035bd8deadSopenharmony_ci            4           1311            vendor specific opcode
41045bd8deadSopenharmony_ci            4           GLX_CONTEXT_TAG context tag
41055bd8deadSopenharmony_ci            4           INT32           len
41065bd8deadSopenharmony_ci            len         LISTofCARD8     name
41075bd8deadSopenharmony_ci            p                           unused, p=pad(len)
41085bd8deadSopenharmony_ci          =>
41095bd8deadSopenharmony_ci
41105bd8deadSopenharmony_ci          If the command succeeds, 4 doubles are sent in the reply:
41115bd8deadSopenharmony_ci
41125bd8deadSopenharmony_ci            1           1               reply
41135bd8deadSopenharmony_ci            1                           unused
41145bd8deadSopenharmony_ci            2           CARD16          sequence number
41155bd8deadSopenharmony_ci            4           8               reply length
41165bd8deadSopenharmony_ci            24                          unused
41175bd8deadSopenharmony_ci            32          LISTofFLOAT64   params
41185bd8deadSopenharmony_ci
41195bd8deadSopenharmony_ci          Otherwise, an empty reply is sent, indicating that a GL error
41205bd8deadSopenharmony_ci          occured:
41215bd8deadSopenharmony_ci
41225bd8deadSopenharmony_ci            1           1               reply
41235bd8deadSopenharmony_ci            1                           unused
41245bd8deadSopenharmony_ci            2           CARD16          sequence number
41255bd8deadSopenharmony_ci            4           0               reply length
41265bd8deadSopenharmony_ci            24                          unused
41275bd8deadSopenharmony_ci
41285bd8deadSopenharmony_ci
41295bd8deadSopenharmony_ciErrors 
41305bd8deadSopenharmony_ci
41315bd8deadSopenharmony_ci    INVALID_OPERATION is generated by Begin, DrawPixels, Bitmap, CopyPixels,
41325bd8deadSopenharmony_ci    or a command that performs an explicit Begin if FRAGMENT_PROGRAM_NV is
41335bd8deadSopenharmony_ci    enabled and the currently bound fragment program does not exist.
41345bd8deadSopenharmony_ci
41355bd8deadSopenharmony_ci    INVALID_OPERATION is generated by ProgramNamedParameter4fNV,
41365bd8deadSopenharmony_ci    ProgramNamedParameter4dNV, ProgramNamedParameter4fvNV,
41375bd8deadSopenharmony_ci    ProgramNamedParameter4dvNV, GetProgramNamedParameterfvNV, or
41385bd8deadSopenharmony_ci    GetProgramNamedParameterdvNV if <id> specifies a nonexistent program or a
41395bd8deadSopenharmony_ci    program whose type does not suport local parameters.
41405bd8deadSopenharmony_ci
41415bd8deadSopenharmony_ci    INVALID_VALUE is generated by ProgramNamedParameter4fNV,
41425bd8deadSopenharmony_ci    ProgramNamedParameter4dNV, ProgramNamedParameter4fvNV,
41435bd8deadSopenharmony_ci    ProgramNamedParameter4dvNV, GetProgramNamedParameterfvNV, or
41445bd8deadSopenharmony_ci    GetProgramNamedParameterdvNV if <len> is zero.
41455bd8deadSopenharmony_ci
41465bd8deadSopenharmony_ci    INVALID_VALUE is generated by ProgramNamedParameter4fNV,
41475bd8deadSopenharmony_ci    ProgramNamedParameter4dNV, ProgramNamedParameter4fvNV,
41485bd8deadSopenharmony_ci    ProgramNamedParameter4dvNV, GetProgramNamedParameterfvNV, or
41495bd8deadSopenharmony_ci    GetProgramNamedParameterdvNV if <name> does not specify the name of a
41505bd8deadSopenharmony_ci    local parameter in the program corresponding to <id>.
41515bd8deadSopenharmony_ci
41525bd8deadSopenharmony_ci    INVALID_OPERATION is generated by any command accessing texture coordinate
41535bd8deadSopenharmony_ci    processing state if the texture unit number corresponding to the current
41545bd8deadSopenharmony_ci    value of ACTIVE_TEXTURE_ARB is greater than or equal to the implementation
41555bd8deadSopenharmony_ci    dependent constant MAX_TEXTURE_COORDS_NV.
41565bd8deadSopenharmony_ci
41575bd8deadSopenharmony_ci    INVALID_OPERATION is generated by any command accessing texture image
41585bd8deadSopenharmony_ci    processing state if the texture unit number corresponding to the current
41595bd8deadSopenharmony_ci    value of ACTIVE_TEXTURE_ARB is greater than or equal to the implementation
41605bd8deadSopenharmony_ci    dependent constant MAX_TEXTURE_IMAGE_UNITS_NV.
41615bd8deadSopenharmony_ci
41625bd8deadSopenharmony_ci
41635bd8deadSopenharmony_ci    (The following are error descriptions copied from GL_NV_vertex_program
41645bd8deadSopenharmony_ci     that apply to this extension as well.  These modifications do not affect
41655bd8deadSopenharmony_ci     the behavior of that extension.)
41665bd8deadSopenharmony_ci
41675bd8deadSopenharmony_ci    INVALID_VALUE is generated by LoadProgramNV if id is zero.
41685bd8deadSopenharmony_ci
41695bd8deadSopenharmony_ci    INVALID_OPERATION is generated by LoadProgramNV if the program
41705bd8deadSopenharmony_ci    corresponding to id is currently loaded but has a program type different
41715bd8deadSopenharmony_ci    from that given by target.
41725bd8deadSopenharmony_ci
41735bd8deadSopenharmony_ci    INVALID_OPERATION is generated by LoadProgramNV if the program specified
41745bd8deadSopenharmony_ci    is syntactically incorrect for the program type specified by target.  The
41755bd8deadSopenharmony_ci    value of PROGRAM_ERROR_POSITION_NV is still updated when this error is
41765bd8deadSopenharmony_ci    generated.
41775bd8deadSopenharmony_ci
41785bd8deadSopenharmony_ci    INVALID_OPERATION is generated by LoadProgramNV if the program specified
41795bd8deadSopenharmony_ci    fails to conform to any of the semantic restrictions imposed on programs
41805bd8deadSopenharmony_ci    of the type specified by target.  The value of PROGRAM_ERROR_POSITION_NV
41815bd8deadSopenharmony_ci    is still updated when this error is generated.
41825bd8deadSopenharmony_ci
41835bd8deadSopenharmony_ci    INVALID_OPERATION is generated by BindProgramNV if target does not match
41845bd8deadSopenharmony_ci    the type of the program named by id.
41855bd8deadSopenharmony_ci
41865bd8deadSopenharmony_ci    INVALID_VALUE is generated by AreProgramsResidentNV if any of the queried
41875bd8deadSopenharmony_ci    programs are zero or do not exist.
41885bd8deadSopenharmony_ci
41895bd8deadSopenharmony_ci    INVALID_OPERATION is generated by GetProgramivNV or GetProgramStringNV if
41905bd8deadSopenharmony_ci    the program named id does not exist.
41915bd8deadSopenharmony_ci
41925bd8deadSopenharmony_ci
41935bd8deadSopenharmony_ciNew State
41945bd8deadSopenharmony_ci
41955bd8deadSopenharmony_ciGet Value                          Type  Get Command              Initial Value  Description         Section   Attribute
41965bd8deadSopenharmony_ci---------------------------------  ----  -----------------------  -------------  ------------------  --------  ------------
41975bd8deadSopenharmony_ciFRAGMENT_PROGRAM_NV                B     IsEnabled                FALSE          fragment program    3.11      enable
41985bd8deadSopenharmony_ci                                                                                 mode enable
41995bd8deadSopenharmony_ciFRAGMENT_PROGRAM_BINDING_NV        Z+    GetIntegerv              0              bound fragment      5.7       -
42005bd8deadSopenharmony_ci                                                                                 program
42015bd8deadSopenharmony_ci
42025bd8deadSopenharmony_ciTable X.6.  New State Introduced by NV_fragment_program.
42035bd8deadSopenharmony_ci
42045bd8deadSopenharmony_ci
42055bd8deadSopenharmony_ciGet Value                  Type    Get Command          Initial Value  Description         Section   Attribute
42065bd8deadSopenharmony_ci-------------------------  ------  ------------------   -------------  ------------------  --------  ---------
42075bd8deadSopenharmony_ciPROGRAM_ERROR_POSITION_NV  Z       GetIntegerv          -1             program error       5.7       -
42085bd8deadSopenharmony_ci                                                                       position
42095bd8deadSopenharmony_ciPROGRAM_TARGET_NV          Z2      GetProgramivNV       0              program target      6.1.13    -
42105bd8deadSopenharmony_ciPROGRAM_LENGTH_NV          Z+      GetProgramivNV       0              program length      6.1.13    -
42115bd8deadSopenharmony_ciPROGRAM_RESIDENT_NV        Z2      GetProgramivNV       False          program residency   6.1.13    -
42125bd8deadSopenharmony_ciPROGRAM_STRING_NV          ubxn    GetProgramStringNV   ""             program string      6.1.13    -
42135bd8deadSopenharmony_ci-                          nxR4    GetProgramNamed-     (0,0,0,0)      named program local 5.7       -
42145bd8deadSopenharmony_ci                                   ParameterNV                         parameter value
42155bd8deadSopenharmony_ci-                          64+xR4  GetProgramLocal-     (0,0,0,0)      numbered program    5.7       -
42165bd8deadSopenharmony_ci                                   ParameterARB                        local parameter
42175bd8deadSopenharmony_ci
42185bd8deadSopenharmony_ciTable X.7.  Program Object State common to NV_vertex_program and NV_fragment_program.
42195bd8deadSopenharmony_ci
42205bd8deadSopenharmony_ci
42215bd8deadSopenharmony_ciGet Value    Type    Get Command   Initial Value  Description               Section   Attribute
42225bd8deadSopenharmony_ci---------    ------  -----------   -------------  -----------------------   --------  ---------
42235bd8deadSopenharmony_ci-            12xR4   -             fragment data  fragment attribute
42245bd8deadSopenharmony_ci                                                  registers                 3.11.1.1  -
42255bd8deadSopenharmony_ci-            16xR4   -             (0,0,0,0)      fp32 temporary registers  3.11.1.2  -
42265bd8deadSopenharmony_ci-            32xR4   -             (0,0,0,0)      fp16 temporary registers  3.11.1.2  -
42275bd8deadSopenharmony_ci             (Z_4)4  -             (EQ,EQ,EQ,EQ)  condition code register   3.11.1.4  -
42285bd8deadSopenharmony_ci                                                  address register
42295bd8deadSopenharmony_ci
42305bd8deadSopenharmony_ciTable X.8.  Fragment Program Per-Fragment Execution State.
42315bd8deadSopenharmony_ci
42325bd8deadSopenharmony_ci
42335bd8deadSopenharmony_ciNew Implementation Dependent State
42345bd8deadSopenharmony_ci
42355bd8deadSopenharmony_ci                                                 Minimum
42365bd8deadSopenharmony_ciGet Value                   Type   Get Command    Value       Description    Section  Attribute
42375bd8deadSopenharmony_ci---------                   ----   -----------   -------  -----------------  -------  ---------
42385bd8deadSopenharmony_ciMAX_TEXTURE_COORDS_NV       Z+     GetIntegerv      2     number of texture  2.6      -
42395bd8deadSopenharmony_ci                                                          coordinate sets
42405bd8deadSopenharmony_ci                                                          supported
42415bd8deadSopenharmony_ciMAX_TEXTURE_IMAGE_UNITS_NV  Z+     GetIntegerv      2     number of texture  2.10.2   -
42425bd8deadSopenharmony_ci                                                          image units
42435bd8deadSopenharmony_ci                                                          supported
42445bd8deadSopenharmony_ciMAX_FRAGMENT_PROGRAM_       Z+     GetIntegerv     64     number of numbered 3.11.7   -
42455bd8deadSopenharmony_ci  LOCAL_PARAMETERS_NV                                     local parameters
42465bd8deadSopenharmony_ci                                                          supported
42475bd8deadSopenharmony_ci
42485bd8deadSopenharmony_ci
42495bd8deadSopenharmony_ciRevision History
42505bd8deadSopenharmony_ci
42515bd8deadSopenharmony_ci    Rev.    Date    Author   Changes
42525bd8deadSopenharmony_ci    ----  -------- --------  --------------------------------------------
42535bd8deadSopenharmony_ci     73   05/23/05  pbrown   Fixed cut-and-paste error in the dependency 
42545bd8deadSopenharmony_ci                             section where it said "NV_texture_rectangle"
42555bd8deadSopenharmony_ci                             instead of "ARB_texture_cube_map".
42565bd8deadSopenharmony_ci
42575bd8deadSopenharmony_ci     72   05/16/04  pbrown   Documented that it's not possible to results from
42585bd8deadSopenharmony_ci                             LG2 that are any more precise than what is
42595bd8deadSopenharmony_ci                             available in the fp32 storage format.
42605bd8deadSopenharmony_ci
42615bd8deadSopenharmony_ci     71   04/23/04  pbrown   Fixed incorrect example.
42625bd8deadSopenharmony_ci
42635bd8deadSopenharmony_ci     70   03/20/03  pbrown   Made the instruction count limit for !!FP1.0
42645bd8deadSopenharmony_ci                             programs queryable instead of a hard-wired value
42655bd8deadSopenharmony_ci                             of 1024.  The limit can be queried using
42665bd8deadSopenharmony_ci                             ARB_fragment_program mechanisms, and remains 1024
42675bd8deadSopenharmony_ci                             if ARB_fragment_program is unsupported.
42685bd8deadSopenharmony_ci
42695bd8deadSopenharmony_ci     69   02/01/03  pbrown   Removed support for combiner fragment programs
42705bd8deadSopenharmony_ci                             (!!FCP1.0).
42715bd8deadSopenharmony_ci
42725bd8deadSopenharmony_ci     68   01/08/03  pbrown   Correct spec language providing examples of NaNs,
42735bd8deadSopenharmony_ci                             such as sqrt(-1) or log(-1).  Division by zero
42745bd8deadSopenharmony_ci                             produces an infinity, not a NaN.
42755bd8deadSopenharmony_ci
42765bd8deadSopenharmony_ci     67   12/23/02  pbrown   Fix incorrect syntax of examples of "KIL"
42775bd8deadSopenharmony_ci                             instruction. The condition code test is not
42785bd8deadSopenharmony_ci                             parenthesized in KIL. 
42795bd8deadSopenharmony_ci
42805bd8deadSopenharmony_ci     66   10/31/02  pbrown   Cleaned up special cases of POW, including the
42815bd8deadSopenharmony_ci                             fact that "POW dst, 0, 0" produces NaN in this
42825bd8deadSopenharmony_ci                             spec, not 1.0.
42835bd8deadSopenharmony_ci
42845bd8deadSopenharmony_ci     65   10/28/02  pbrown   Documented that signed HILO textures will have
42855bd8deadSopenharmony_ci                             the hemisphere remapping applied, but unsigned
42865bd8deadSopenharmony_ci                             textures will not.
42875bd8deadSopenharmony_ci
42885bd8deadSopenharmony_ci     64   09/17/02  pbrown   Minor typo fixes.
42895bd8deadSopenharmony_ci
42905bd8deadSopenharmony_ci     63   08/14/02  pbrown   Clarified the value of the "other" components
42915bd8deadSopenharmony_ci                             of f[FOGC].
42925bd8deadSopenharmony_ci
42935bd8deadSopenharmony_ci     62   07/24/02  pbrown   Removed PK4UBG and UP4UBG instructions.
42945bd8deadSopenharmony_ci                             Simplified the implementation of the temporary
42955bd8deadSopenharmony_ci                             and output register limit for combiner
42965bd8deadSopenharmony_ci                             programs by counting all four o[TEXn] registers
42975bd8deadSopenharmony_ci                             against the limit, whether or not they are
42985bd8deadSopenharmony_ci                             written.
42995bd8deadSopenharmony_ci
43005bd8deadSopenharmony_ci     61   07/19/02  pbrown   Renamed ProgramLocalParameter*NV to
43015bd8deadSopenharmony_ci                             ProgramNamedParameter*NV to eliminate naming
43025bd8deadSopenharmony_ci                             conflicts with ARB_vertex_program (and presumably
43035bd8deadSopenharmony_ci                             ARB_fragment_program).
43045bd8deadSopenharmony_ci                             
43055bd8deadSopenharmony_ci                             Added support for numbered program local
43065bd8deadSopenharmony_ci                             parameters for compatibility with the ARB vertex
43075bd8deadSopenharmony_ci                             program extension (and upcoming ARB fragment
43085bd8deadSopenharmony_ci                             program extension), so it's possible to set local
43095bd8deadSopenharmony_ci                             parameters the same way in both extensions.
43105bd8deadSopenharmony_ci
43115bd8deadSopenharmony_ci                             Eliminated the language describing "register
43125bd8deadSopenharmony_ci                             slots" and how the "H" and "R" registers overlap.
43135bd8deadSopenharmony_ci                             Instead, registers are guaranteed not to overlap,
43145bd8deadSopenharmony_ci                             and a semantic limit is added on the number of
43155bd8deadSopenharmony_ci                             temporaries and output registers that can be used
43165bd8deadSopenharmony_ci                             by a program.
43175bd8deadSopenharmony_ci
43185bd8deadSopenharmony_ci                             Eliminated the requirement that non-combiner
43195bd8deadSopenharmony_ci                             programs actually write a color value; the only
43205bd8deadSopenharmony_ci                             requirement is that one output register be
43215bd8deadSopenharmony_ci                             written.  When using fragment programs that use
43225bd8deadSopenharmony_ci                             depth replacement, there may not be a need to
43235bd8deadSopenharmony_ci                             compute color if color writes are currently
43245bd8deadSopenharmony_ci                             disabled
43255bd8deadSopenharmony_ci
43265bd8deadSopenharmony_ci                             Cleaned up the issues section.  Added several
43275bd8deadSopenharmony_ci                             examples of fragment program operation.
43285bd8deadSopenharmony_ci
43295bd8deadSopenharmony_ci                             Cleaned up GLX protocol.
43305bd8deadSopenharmony_ci
43315bd8deadSopenharmony_ci     59   07/07/02  pbrown   Minor clarifications of texture lookup handling.
43325bd8deadSopenharmony_ci                             Documented that DDX and DDY may not always
43335bd8deadSopenharmony_ci                             produce infinities.
43345bd8deadSopenharmony_ci
43355bd8deadSopenharmony_ci     58   06/27/02  pbrown   Added clarification that instructions can use the
43365bd8deadSopenharmony_ci                             same attribute or parameter register more than
43375bd8deadSopenharmony_ci                             once.  Added support for "X" precision on the
43385bd8deadSopenharmony_ci                             "set on" instructions.  Removed "X" precision
43395bd8deadSopenharmony_ci                             support from DST.
43405bd8deadSopenharmony_ci
43415bd8deadSopenharmony_ci     57   06/27/02  pbrown   Added missing table entries covering the use of
43425bd8deadSopenharmony_ci                             floating-point textures.
43435bd8deadSopenharmony_ci
43445bd8deadSopenharmony_ci     56   06/27/02  pbrown   Modified the spec to indicate that depth textures
43455bd8deadSopenharmony_ci                             are treated as alpha, luminance, or intensity
43465bd8deadSopenharmony_ci                             according to the depth texture mode in ARB_shadow.
43475bd8deadSopenharmony_ci
43485bd8deadSopenharmony_ci     55   06/26/02  pbrown   Fixed the correct aliased register number and
43495bd8deadSopenharmony_ci                             "read-only" mappings for o[DEPR] in combiner
43505bd8deadSopenharmony_ci                             programs.
43515bd8deadSopenharmony_ci
43525bd8deadSopenharmony_ci     54   06/05/02  pbrown   Fixed the spec to indicate that near and far
43535bd8deadSopenharmony_ci                             frustum clipping is disabled for depth
43545bd8deadSopenharmony_ci                             replacement programs.  Fixed the spec to indicate
43555bd8deadSopenharmony_ci                             that the register combiners enable is overridden
43565bd8deadSopenharmony_ci                             for fragment programs (enabled for combiner
43575bd8deadSopenharmony_ci                             programs, disabled for color programs).
43585bd8deadSopenharmony_ci
43595bd8deadSopenharmony_ci     53   05/20/02  pbrown   Miscellaneous bug fixes for wording and
43605bd8deadSopenharmony_ci                             special-case handling errors.
43615bd8deadSopenharmony_ci
43625bd8deadSopenharmony_ci     52   05/16/02  pbrown   Added "_SAT" suffix to clamp result vector
43635bd8deadSopenharmony_ci                             components to [0,1].  Fixed special case rules
43645bd8deadSopenharmony_ci                             for MUL instruction and the "UN" condition code.
43655bd8deadSopenharmony_ci
43665bd8deadSopenharmony_ci     50   04/19/02  pbrown   Added "$" as a legal character in an identifier
43675bd8deadSopenharmony_ci                             name.  Added example for fixed and conditional
43685bd8deadSopenharmony_ci                             write masks and condition code updates.
43695bd8deadSopenharmony_ci
43705bd8deadSopenharmony_ci     49   04/16/02  pbrown   Added new query of PROGRAM_ERROR_STRING_NV to
43715bd8deadSopenharmony_ci                             return more detailed information on program load
43725bd8deadSopenharmony_ci                             failures.
43735bd8deadSopenharmony_ci
43745bd8deadSopenharmony_ci     48   04/02/02  pbrown   Added missing enum value for the
43755bd8deadSopenharmony_ci                             FRAGMENT_PROGRAM_BINDING_NV query. 
43765bd8deadSopenharmony_ci
43775bd8deadSopenharmony_ci     47   03/15/02  pbrown   Fixed various typos, and an incorrect description
43785bd8deadSopenharmony_ci                             of the MAX operation.
43795bd8deadSopenharmony_ci
43805bd8deadSopenharmony_ci     45   01/31/02  pbrown   Renamed the packing and unpacking opcode to more
43815bd8deadSopenharmony_ci                             closely match OpenGL data type naming conventions
43825bd8deadSopenharmony_ci                             (PK2 becomes PK2H, PK16 becomes PH2US, PK4
43835bd8deadSopenharmony_ci                             becomes PK4B, PKB becomes PK4UB).  Renamed "BEM"
43845bd8deadSopenharmony_ci                             instruction to "X2D" to reflect the fact that it
43855bd8deadSopenharmony_ci                             does a 2D coordinate transformation (not just a
43865bd8deadSopenharmony_ci                             bump mapping operation).  Added PK4UBG and UP4UBG
43875bd8deadSopenharmony_ci                             instructions to support sRGB gamma correction
43885bd8deadSopenharmony_ci                             when packing and unpacking components.
43895bd8deadSopenharmony_ci
43905bd8deadSopenharmony_ci     44   01/18/02  pbrown   Double the number of available temporaries (16 to
43915bd8deadSopenharmony_ci                             32 fp32 vectors).  Add BEM (texture coordinate
43925bd8deadSopenharmony_ci                             offset), PKB/UPB (unsigned byte packing), and
43935bd8deadSopenharmony_ci                             PK16/UP16 (unsigned short packing) instructions.
43945bd8deadSopenharmony_ci
43955bd8deadSopenharmony_ci     43   01/04/02  pbrown   Documented special cases for comparisons,
43965bd8deadSopenharmony_ci                             including the handling of NaN in the SNE
43975bd8deadSopenharmony_ci                             instruction. Added automatic generation of a
43985bd8deadSopenharmony_ci                             third normal component for HILO textures.
43995bd8deadSopenharmony_ci                             Documented the restriction that RFL can't write
44005bd8deadSopenharmony_ci                             to the w component of the result.  Trivial fix of
44015bd8deadSopenharmony_ci                             the special-cases for RCP.  Fixed minor typo on
44025bd8deadSopenharmony_ci                             the TEX instruction.
44035bd8deadSopenharmony_ci
44045bd8deadSopenharmony_ci     40   11/26/01  pbrown   Eliminated "X" precision specifier on those
44055bd8deadSopenharmony_ci                             instructions that do complicated math or don't
44065bd8deadSopenharmony_ci                             otherwise need it (e.g., "SGE").  Fixed special
44075bd8deadSopenharmony_ci                             case math on LG2 instruction.  Eliminated
44085bd8deadSopenharmony_ci                             incorrectly specified exponent clamping on LIT
44095bd8deadSopenharmony_ci                             instruction.  Fixed description and special-case
44105bd8deadSopenharmony_ci                             math on LIT/POW instructions.  Specified that
44115bd8deadSopenharmony_ci                             combiner program outputs are clamped to [-1,+1],
44125bd8deadSopenharmony_ci                             not [+0,+1].
44135bd8deadSopenharmony_ci
44145bd8deadSopenharmony_ci     39   11/16/01  pbrown   Added semantic restriction that PK2/PK4 must
44155bd8deadSopenharmony_ci                             write to a 32-bit register.  Cleaned up the
44165bd8deadSopenharmony_ci                             converse restrictions on UP2/UP4, making sure to
44175bd8deadSopenharmony_ci                             allow UP2/UP4 from a program parameter.  Fix
44185bd8deadSopenharmony_ci                             section numberings and a few typos.
44195bd8deadSopenharmony_ci
44205bd8deadSopenharmony_ci     36   11/07/01  pbrown   Cleaned up explanation of the "negative q is
44215bd8deadSopenharmony_ci                             undefined" for texture mapping spec restriction.
44225bd8deadSopenharmony_ci                             Fixed a nit on the number of condition code
44235bd8deadSopenharmony_ci                             values (now 4 with UN - unordered).
44245bd8deadSopenharmony_ci
44255bd8deadSopenharmony_ci     35   10/29/01  pbrown   Add a SUB instruction for programmer
44265bd8deadSopenharmony_ci                             convenience. Moved unresolved issue list back to
44275bd8deadSopenharmony_ci                             the "Issues" section.  Fix several minor wording
44285bd8deadSopenharmony_ci                             issues.  Clarify register combiners/texture
44295bd8deadSopenharmony_ci                             shader/fragment program flow control diagram.
44305bd8deadSopenharmony_ci
44315bd8deadSopenharmony_ci     32   10/19/01  pbrown   Document the fragment program restriction that
44325bd8deadSopenharmony_ci                             instructions involving f[FOGC] and f[TEX0-TEX7]
44335bd8deadSopenharmony_ci                             are always carried out at fp32 precision.
44345bd8deadSopenharmony_ci
44355bd8deadSopenharmony_ci     31   10/19/01  pbrown   Fixed incorrect description of encoding of fp16
44365bd8deadSopenharmony_ci                             denorms.
44375bd8deadSopenharmony_ci
44385bd8deadSopenharmony_ci     30   10/12/01  pbrown   Documented (0,0,0,0) local parameter
44395bd8deadSopenharmony_ci                             initialization.  Disallow multiple defines of the
44405bd8deadSopenharmony_ci                             same token.  Allow tokens that look like a
44415bd8deadSopenharmony_ci                             possible register or texture name, but have
44425bd8deadSopenharmony_ci                             numbers that are too big (e.g., "TEX24", "R37").
44435bd8deadSopenharmony_ci                             Fixed up several grammar bugs.  Documented that
44445bd8deadSopenharmony_ci                             LG2 and RSQ now do not automatically take
44455bd8deadSopenharmony_ci                             absolute values, plus new math special cases.
4446