15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_gpu_program4
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_gpu_program4
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciStatus
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Shipping for GeForce 8 Series (November 2006) 
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciVersion
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Last Modified Date:         09/11/2014
205bd8deadSopenharmony_ci    NVIDIA Revision:            11
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciNumber
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    322
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciDependencies
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    This extension is written against to OpenGL 2.0 specification.  
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    OpenGL 2.0 is not required, but we expect all implementations of this
315bd8deadSopenharmony_ci    extension will also support OpenGL 2.0.
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    This extension is also written against the ARB_vertex_program
345bd8deadSopenharmony_ci    specification, which provides the basic mechanisms for the assembly
355bd8deadSopenharmony_ci    programming model used by this extension.
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    This extension serves as the basis for the NV_fragment_program4,
385bd8deadSopenharmony_ci    NV_geometry_program4, and NV_vertex_program4, which all build on this
395bd8deadSopenharmony_ci    extension to support fragment, geometry, and vertex programs,
405bd8deadSopenharmony_ci    respectively.  If "GL_NV_gpu_program4" is found in the extension string,
415bd8deadSopenharmony_ci    all of these extensions are supported.
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    NV_parameter_buffer_object affects the definition of this extension.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    ARB_texture_rectangle trivially affects the definition of this extension.
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    EXT_gpu_program_parameters trivially affects the definition of this
485bd8deadSopenharmony_ci    extension.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    EXT_texture_integer trivially affects the definition of this extension.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    EXT_texture_array trivially affects the definition of this extension.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    EXT_texture_buffer_object trivially affects the definition of this
555bd8deadSopenharmony_ci    extension.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    NV_primitive_restart trivially affects the definition of this extension.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ciOverview
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    This specification documents the common instruction set and basic
625bd8deadSopenharmony_ci    functionality provided by NVIDIA's 4th generation of assembly instruction
635bd8deadSopenharmony_ci    sets supporting programmable graphics pipeline stages.  
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    The instruction set builds upon the basic framework provided by the
665bd8deadSopenharmony_ci    ARB_vertex_program and ARB_fragment_program extensions to expose
675bd8deadSopenharmony_ci    considerably more capable hardware.  In addition to new capabilities for
685bd8deadSopenharmony_ci    vertex and fragment programs, this extension provides a new program type
695bd8deadSopenharmony_ci    (geometry programs) further described in the NV_geometry_program4
705bd8deadSopenharmony_ci    specification.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    NV_gpu_program4 provides a unified instruction set -- all instruction set
735bd8deadSopenharmony_ci    features are available for all program types, except for a small number of
745bd8deadSopenharmony_ci    features that make sense only for a specific program type.  It provides
755bd8deadSopenharmony_ci    fully capable signed and unsigned integer data types, along with a set of
765bd8deadSopenharmony_ci    arithmetic, logical, and data type conversion instructions capable of
775bd8deadSopenharmony_ci    operating on integers.  It also provides a uniform set of structured
785bd8deadSopenharmony_ci    branching constructs (if tests, loops, and subroutines) that fully support
795bd8deadSopenharmony_ci    run-time condition testing.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    This extension provides several new texture mapping capabilities.  Shadow
825bd8deadSopenharmony_ci    cube maps are supported, where cube map faces can encode depth values.
835bd8deadSopenharmony_ci    Texture lookup instructions can include an immediate texel offset, which
845bd8deadSopenharmony_ci    can assist in advanced filtering.  New instructions are provided to fetch
855bd8deadSopenharmony_ci    a single texel by address in a texture map (TXF) and query the size of a
865bd8deadSopenharmony_ci    specified texture level (TXQ).
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    By and large, vertex and fragment programs written to ARB_vertex_program
895bd8deadSopenharmony_ci    and ARB_fragment_program can be ported directly by simply changing the
905bd8deadSopenharmony_ci    program header from "!!ARBvp1.0" or "!!ARBfp1.0" to "!!NVvp4.0" or
915bd8deadSopenharmony_ci    "!!NVfp4.0", and then modifying the code to take advantage of the expanded
925bd8deadSopenharmony_ci    feature set.  There are a small number of areas where this extension is
935bd8deadSopenharmony_ci    not a functional superset of previous vertex program extensions, which are
945bd8deadSopenharmony_ci    documented in this specification.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ciNew Procedures and Functions
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    void ProgramLocalParameterI4iNV(enum target, uint index, 
1005bd8deadSopenharmony_ci                                    int x, int y, int z, int w);
1015bd8deadSopenharmony_ci    void ProgramLocalParameterI4ivNV(enum target, uint index, 
1025bd8deadSopenharmony_ci                                     const int *params);
1035bd8deadSopenharmony_ci    void ProgramLocalParametersI4ivNV(enum target, uint index, 
1045bd8deadSopenharmony_ci                                      sizei count, const int *params);
1055bd8deadSopenharmony_ci    void ProgramLocalParameterI4uiNV(enum target, uint index, 
1065bd8deadSopenharmony_ci                                     uint x, uint y, uint z, uint w);
1075bd8deadSopenharmony_ci    void ProgramLocalParameterI4uivNV(enum target, uint index, 
1085bd8deadSopenharmony_ci                                      const uint *params);
1095bd8deadSopenharmony_ci    void ProgramLocalParametersI4uivNV(enum target, uint index, 
1105bd8deadSopenharmony_ci                                       sizei count, const uint *params);
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    void ProgramEnvParameterI4iNV(enum target, uint index, 
1135bd8deadSopenharmony_ci                                  int x, int y, int z, int w);
1145bd8deadSopenharmony_ci    void ProgramEnvParameterI4ivNV(enum target, uint index, 
1155bd8deadSopenharmony_ci                                   const int *params);
1165bd8deadSopenharmony_ci    void ProgramEnvParametersI4ivNV(enum target, uint index, 
1175bd8deadSopenharmony_ci                                    sizei count, const int *params);
1185bd8deadSopenharmony_ci    void ProgramEnvParameterI4uiNV(enum target, uint index, 
1195bd8deadSopenharmony_ci                                   uint x, uint y, uint z, uint w);
1205bd8deadSopenharmony_ci    void ProgramEnvParameterI4uivNV(enum target, uint index, 
1215bd8deadSopenharmony_ci                                    const uint *params);
1225bd8deadSopenharmony_ci    void ProgramEnvParametersI4uivNV(enum target, uint index, 
1235bd8deadSopenharmony_ci                                     sizei count, const uint *params);
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    void GetProgramLocalParameterIivNV(enum target, uint index,
1265bd8deadSopenharmony_ci                                       int *params);
1275bd8deadSopenharmony_ci    void GetProgramLocalParameterIuivNV(enum target, uint index,
1285bd8deadSopenharmony_ci                                        uint *params);
1295bd8deadSopenharmony_ci    void GetProgramEnvParameterIivNV(enum target, uint index,
1305bd8deadSopenharmony_ci                                     int *params);
1315bd8deadSopenharmony_ci    void GetProgramEnvParameterIuivNV(enum target, uint index,
1325bd8deadSopenharmony_ci                                      uint *params);
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ciNew Tokens
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1385bd8deadSopenharmony_ci    GetFloatv, and GetDoublev: 
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci        MIN_PROGRAM_TEXEL_OFFSET_EXT                    0x8904
1415bd8deadSopenharmony_ci        MAX_PROGRAM_TEXEL_OFFSET_EXT                    0x8905
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    (note:  these tokens are shared with the EXT_gpu_shader4 extension.)
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetProgramivARB:
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci        PROGRAM_ATTRIB_COMPONENTS_NV                    0x8906
1485bd8deadSopenharmony_ci        PROGRAM_RESULT_COMPONENTS_NV                    0x8907
1495bd8deadSopenharmony_ci        MAX_PROGRAM_ATTRIB_COMPONENTS_NV                0x8908
1505bd8deadSopenharmony_ci        MAX_PROGRAM_RESULT_COMPONENTS_NV                0x8909
1515bd8deadSopenharmony_ci        MAX_PROGRAM_GENERIC_ATTRIBS_NV                  0x8DA5
1525bd8deadSopenharmony_ci        MAX_PROGRAM_GENERIC_RESULTS_NV                  0x8DA6
1535bd8deadSopenharmony_ci      
1545bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.5 Specification (OpenGL Operation)
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    (Modify "Section 2.14.1" of the ARB_vertex_program specification,
1575bd8deadSopenharmony_ci    describing program parameters.)
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    Each program object has an associated array of program local parameters.
1605bd8deadSopenharmony_ci    Program local parameters are four-component vectors whose components can
1615bd8deadSopenharmony_ci    hold floating-point, signed integer, or unsigned integer values.  The data
1625bd8deadSopenharmony_ci    type of each local parameter is established when the parameter's values
1635bd8deadSopenharmony_ci    are assigned.  If a program attempts to read a local parameter using a
1645bd8deadSopenharmony_ci    data type other than the one used when the parameter is set, the values
1655bd8deadSopenharmony_ci    returned are undefined.  ... The commands
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci      void ProgramLocalParameter4fARB(enum target, uint index,
1685bd8deadSopenharmony_ci                                      float x, float y, float z, float w);
1695bd8deadSopenharmony_ci      void ProgramLocalParameter4fvARB(enum target, uint index, 
1705bd8deadSopenharmony_ci                                       const float *params);
1715bd8deadSopenharmony_ci      void ProgramLocalParameter4dARB(enum target, uint index,
1725bd8deadSopenharmony_ci                                      double x, double y, double z, double w);
1735bd8deadSopenharmony_ci      void ProgramLocalParameter4dvARB(enum target, uint index, 
1745bd8deadSopenharmony_ci                                       const double *params);
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci      void ProgramLocalParameterI4iNV(enum target, uint index, 
1775bd8deadSopenharmony_ci                                      int x, int y, int z, int w);
1785bd8deadSopenharmony_ci      void ProgramLocalParameterI4ivNV(enum target, uint index, 
1795bd8deadSopenharmony_ci                                       const int *params);
1805bd8deadSopenharmony_ci      void ProgramLocalParameterI4uiNV(enum target, uint index, 
1815bd8deadSopenharmony_ci                                       uint x, uint y, uint z, uint w);
1825bd8deadSopenharmony_ci      void ProgramLocalParameterI4uivNV(enum target, uint index, 
1835bd8deadSopenharmony_ci                                        const uint *params);
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    update the values of the program local parameter numbered <index>
1865bd8deadSopenharmony_ci    belonging to the program object currently bound to <target>.  For the
1875bd8deadSopenharmony_ci    non-vector versions of these commands, the four components of the
1885bd8deadSopenharmony_ci    parameter are updated with the values of <x>, <y>, <z>, and <w>,
1895bd8deadSopenharmony_ci    respectively.  For the vector versions, the components of the parameter
1905bd8deadSopenharmony_ci    are updated with the array of four values pointed to by <params>.  The
1915bd8deadSopenharmony_ci    error INVALID_VALUE is generated if <index> is greater than or equal to
1925bd8deadSopenharmony_ci    the number of program local parameters supported by <target>.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    The commands
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci      void ProgramLocalParameters4fvNV(enum target, uint index, 
1975bd8deadSopenharmony_ci                                       sizei count, const float *params);
1985bd8deadSopenharmony_ci      void ProgramLocalParametersI4ivNV(enum target, uint index, 
1995bd8deadSopenharmony_ci                                        sizei count, const int *params);
2005bd8deadSopenharmony_ci      void ProgramLocalParametersI4uivNV(enum target, uint index, 
2015bd8deadSopenharmony_ci                                         sizei count, const uint *params);
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci    update the values of the program local parameters numbered <index> through
2045bd8deadSopenharmony_ci    <index> + <count> - 1 with the array of 4 * <count> values pointed to by
2055bd8deadSopenharmony_ci    <params>.  The error INVALID_VALUE is generated if the sum of <index> and
2065bd8deadSopenharmony_ci    <count> is greater than the number of program local parameters supported
2075bd8deadSopenharmony_ci    by <target>.
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    When a program local parameter is updated, the data type of its components
2105bd8deadSopenharmony_ci    is assigned according to the data type of the provided values.  If values
2115bd8deadSopenharmony_ci    provided are of type "float" or "double", the components of the parameter
2125bd8deadSopenharmony_ci    are floating-point.  If the values provided are of type "int", the
2135bd8deadSopenharmony_ci    components of the parameter are signed integers.  If the values provided
2145bd8deadSopenharmony_ci    are of type "uint", the components of the parameter are unsigned integers.
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    Additionally, each program target has an associated array of program
2175bd8deadSopenharmony_ci    environment parameters.  Unlike program local parameters, program
2185bd8deadSopenharmony_ci    environment parameters are shared by all program objects of a given
2195bd8deadSopenharmony_ci    target.  Program environment parameters are four-component vectors whose
2205bd8deadSopenharmony_ci    components can hold floating-point, signed integer, or unsigned integer
2215bd8deadSopenharmony_ci    values.  The data type of each environment parameter is established when
2225bd8deadSopenharmony_ci    the parameter's values are assigned.  If a program attempts to read an
2235bd8deadSopenharmony_ci    environment parameter using a data type other than the one used when the
2245bd8deadSopenharmony_ci    parameter is set, the values returned are undefined.  ... The commands
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci      void ProgramEnvParameter4fARB(enum target, uint index,
2275bd8deadSopenharmony_ci                                    float x, float y, float z, float w);
2285bd8deadSopenharmony_ci      void ProgramEnvParameter4fvARB(enum target, uint index,
2295bd8deadSopenharmony_ci                                     const float *params);
2305bd8deadSopenharmony_ci      void ProgramEnvParameter4dARB(enum target, uint index,
2315bd8deadSopenharmony_ci                                    double x, double y, double z, double w);
2325bd8deadSopenharmony_ci      void ProgramEnvParameter4dvARB(enum target, uint index,
2335bd8deadSopenharmony_ci                                     const double *params);
2345bd8deadSopenharmony_ci      void ProgramEnvParameterI4iNV(enum target, uint index, 
2355bd8deadSopenharmony_ci                                    int x, int y, int z, int w);
2365bd8deadSopenharmony_ci      void ProgramEnvParameterI4ivNV(enum target, uint index, 
2375bd8deadSopenharmony_ci                                     const int *params);
2385bd8deadSopenharmony_ci      void ProgramEnvParameterI4uiNV(enum target, uint index, 
2395bd8deadSopenharmony_ci                                     uint x, uint y, uint z, uint w);
2405bd8deadSopenharmony_ci      void ProgramEnvParameterI4uivNV(enum target, uint index, 
2415bd8deadSopenharmony_ci                                      const uint *params);
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    update the values of the program environment parameter numbered <index>
2445bd8deadSopenharmony_ci    for the given program target <target>.  For the non-vector versions of
2455bd8deadSopenharmony_ci    these commands, the four components of the parameter are updated with the
2465bd8deadSopenharmony_ci    values of <x>, <y>, <z>, and <w>, respectively.  For the vector versions,
2475bd8deadSopenharmony_ci    the four components of the parameter are updated with the array of four
2485bd8deadSopenharmony_ci    values pointed to by <params>.  The error INVALID_VALUE is generated if
2495bd8deadSopenharmony_ci    <index> is greater than or equal to the number of program environment
2505bd8deadSopenharmony_ci    parameters supported by <target>.
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    The commands
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci      void ProgramEnvParameters4fvNV(enum target, uint index, 
2555bd8deadSopenharmony_ci                                     sizei count, const float *params);
2565bd8deadSopenharmony_ci      void ProgramEnvParametersI4ivNV(enum target, uint index, 
2575bd8deadSopenharmony_ci                                      sizei count, const int *params);
2585bd8deadSopenharmony_ci      void ProgramEnvParametersI4uivNV(enum target, uint index, 
2595bd8deadSopenharmony_ci                                       sizei count, const uint *params);
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    update the values of the program environment parameters numbered <index>
2625bd8deadSopenharmony_ci    through <index> + <count> - 1 with the array of 4 * <count> values pointed
2635bd8deadSopenharmony_ci    to by <params>.  The error INVALID_VALUE is generated if the sum of
2645bd8deadSopenharmony_ci    <index> and <count> is greater than the number of program local parameters
2655bd8deadSopenharmony_ci    supported by <target>.
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    When a program environment parameter is updated, the data type of its
2685bd8deadSopenharmony_ci    components is assigned according to the data type of the provided values.
2695bd8deadSopenharmony_ci    If values provided are of type "float" or "double", the components of the
2705bd8deadSopenharmony_ci    parameter are floating-point.  If the values provided are of type "int",
2715bd8deadSopenharmony_ci    the components of the parameter are signed integers.  If the values
2725bd8deadSopenharmony_ci    provided are of type "uint", the components of the parameter are unsigned
2735bd8deadSopenharmony_ci    integers.
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci    ...
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci    Insert New Section 2.X between Sections 2.Y and 2.Z:
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci    Section 2.X, GPU Programs
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    The GL provides a number of different program targets that allow an
2835bd8deadSopenharmony_ci    application to either replace certain fixed-function pipeline stages with
2845bd8deadSopenharmony_ci    a fully programmable model or use a program to control aspects of the GL
2855bd8deadSopenharmony_ci    pipeline that previously had only hard-wired behavior.
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    A common base instruction set is available for all program types, 
2885bd8deadSopenharmony_ci    providing both integer and floating-point operations.  Structured
2895bd8deadSopenharmony_ci    branching operations and subroutine calls are available.  Texture
2905bd8deadSopenharmony_ci    mapping (loading data from external images) is supported for all
2915bd8deadSopenharmony_ci    program types.  The main differences between the different program
2925bd8deadSopenharmony_ci    types are the set of available inputs and outputs, which are program type-
2935bd8deadSopenharmony_ci    specific, and a few instructions that are meaningful for only a subset
2945bd8deadSopenharmony_ci    of program types.
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci    Section 2.X.2, Program Grammar
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci    GPU program strings are specified as an array of ASCII characters
3015bd8deadSopenharmony_ci    containing the program text.  When a GPU program is loaded by a call to
3025bd8deadSopenharmony_ci    ProgramStringARB, the program string is parsed into a set of tokens
3035bd8deadSopenharmony_ci    possibly separated by whitespace.  Spaces, tabs, newlines, carriage
3045bd8deadSopenharmony_ci    returns, and comments are considered whitespace.  Comments begin with the
3055bd8deadSopenharmony_ci    character "#" and are terminated by a newline, a carriage return, or the
3065bd8deadSopenharmony_ci    end of the program array.
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    The Backus-Naur Form (BNF) grammar below specifies the syntactically valid
3095bd8deadSopenharmony_ci    sequences for GPU programs.  The set of valid tokens can be inferred
3105bd8deadSopenharmony_ci    from the grammar.  A line containing "/* empty */" represents an empty
3115bd8deadSopenharmony_ci    string and is used to indicate optional rules.  A program is invalid if it
3125bd8deadSopenharmony_ci    contains any tokens or characters not defined in this specification.
3135bd8deadSopenharmony_ci
3145bd8deadSopenharmony_ci    Note that this extension is not a standalone extension and a small number
3155bd8deadSopenharmony_ci    of grammar rules are left to be defined in the extensions defining the
3165bd8deadSopenharmony_ci    specific vertex, fragment, and geometry program types.
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    <program>               ::= <optionSequence> <declSequence> 
3205bd8deadSopenharmony_ci                                <statementSequence> "END"
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    <optionSequence>        ::= <option> <optionSequence>
3235bd8deadSopenharmony_ci                              | /* empty */
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci    <option>                ::= "OPTION" <identifier> ";"
3265bd8deadSopenharmony_ci
3275bd8deadSopenharmony_ci    <declSequence>          ::= /* empty */
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    <statementSequence>     ::= <statement> <statementSequence>
3305bd8deadSopenharmony_ci                              | /* empty */
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci    <statement>             ::= <instruction> ";"
3335bd8deadSopenharmony_ci                              | <namingStatement> ";"
3345bd8deadSopenharmony_ci                              | <instLabel> ":"
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    <instruction>           ::= <ALUInstruction>
3375bd8deadSopenharmony_ci                              | <TexInstruction>
3385bd8deadSopenharmony_ci                              | <FlowInstruction>
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    <ALUInstruction>        ::= <VECTORop_instruction>
3415bd8deadSopenharmony_ci                              | <SCALARop_instruction>
3425bd8deadSopenharmony_ci                              | <BINSCop_instruction>
3435bd8deadSopenharmony_ci                              | <BINop_instruction>
3445bd8deadSopenharmony_ci                              | <VECSCAop_instruction>
3455bd8deadSopenharmony_ci                              | <TRIop_instruction>
3465bd8deadSopenharmony_ci                              | <SWZop_instruction>
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci    <TexInstruction>        ::= <TEXop_instruction>
3495bd8deadSopenharmony_ci                              | <TXDop_instruction>
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci    <FlowInstruction>       ::= <BRAop_instruction>
3525bd8deadSopenharmony_ci                              | <FLOWCCop_instruction>
3535bd8deadSopenharmony_ci                              | <IFop_instruction>
3545bd8deadSopenharmony_ci                              | <REPop_instruction>
3555bd8deadSopenharmony_ci                              | <ENDFLOWop_instruction>
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci    <VECTORop_instruction>  ::= <VECTORop> <opModifiers> <instResult> "," 
3585bd8deadSopenharmony_ci                                <instOperandV>
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    <VECTORop>              ::= "ABS"
3615bd8deadSopenharmony_ci                              | "CEIL"
3625bd8deadSopenharmony_ci                              | "FLR"
3635bd8deadSopenharmony_ci                              | "FRC"
3645bd8deadSopenharmony_ci                              | "I2F"
3655bd8deadSopenharmony_ci                              | "LIT"
3665bd8deadSopenharmony_ci                              | "MOV"
3675bd8deadSopenharmony_ci                              | "NOT"
3685bd8deadSopenharmony_ci                              | "NRM"
3695bd8deadSopenharmony_ci                              | "PK2H"
3705bd8deadSopenharmony_ci                              | "PK2US"
3715bd8deadSopenharmony_ci                              | "PK4B"
3725bd8deadSopenharmony_ci                              | "PK4UB"
3735bd8deadSopenharmony_ci                              | "ROUND"
3745bd8deadSopenharmony_ci                              | "SSG"
3755bd8deadSopenharmony_ci                              | "TRUNC"
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ci    <SCALARop_instruction>  ::= <SCALARop> <opModifiers> <instResult> "," 
3785bd8deadSopenharmony_ci                                <instOperandS>
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    <SCALARop>              ::= "COS"
3815bd8deadSopenharmony_ci                              | "EX2"
3825bd8deadSopenharmony_ci                              | "LG2"
3835bd8deadSopenharmony_ci                              | "RCC"
3845bd8deadSopenharmony_ci                              | "RCP"
3855bd8deadSopenharmony_ci                              | "RSQ"
3865bd8deadSopenharmony_ci                              | "SCS"
3875bd8deadSopenharmony_ci                              | "SIN"
3885bd8deadSopenharmony_ci                              | "UP2H"
3895bd8deadSopenharmony_ci                              | "UP2US"
3905bd8deadSopenharmony_ci                              | "UP4B"
3915bd8deadSopenharmony_ci                              | "UP4UB"
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    <BINSCop_instruction>   ::= <BINSCop> <opModifiers> <instResult> "," 
3945bd8deadSopenharmony_ci                                <instOperandS> "," <instOperandS>
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    <BINSCop>               ::= "POW"
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci    <VECSCAop_instruction>  ::= <VECSCAop> <opModifiers> <instResult> "," 
3995bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandS>
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    <VECSCAop>              ::= "DIV"
4025bd8deadSopenharmony_ci                              | "SHL"
4035bd8deadSopenharmony_ci                              | "SHR"
4045bd8deadSopenharmony_ci                              | "MOD"
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    <BINop_instruction>     ::= <BINop> <opModifiers> <instResult> "," 
4075bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandV>
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    <BINop>                 ::= "ADD"
4105bd8deadSopenharmony_ci                              | "AND"
4115bd8deadSopenharmony_ci                              | "DP3"
4125bd8deadSopenharmony_ci                              | "DP4"
4135bd8deadSopenharmony_ci                              | "DPH"
4145bd8deadSopenharmony_ci                              | "DST"
4155bd8deadSopenharmony_ci                              | "MAX"
4165bd8deadSopenharmony_ci                              | "MIN"
4175bd8deadSopenharmony_ci                              | "MUL"
4185bd8deadSopenharmony_ci                              | "OR"
4195bd8deadSopenharmony_ci                              | "RFL"
4205bd8deadSopenharmony_ci                              | "SEQ"
4215bd8deadSopenharmony_ci                              | "SFL"
4225bd8deadSopenharmony_ci                              | "SGE"
4235bd8deadSopenharmony_ci                              | "SGT"
4245bd8deadSopenharmony_ci                              | "SLE"
4255bd8deadSopenharmony_ci                              | "SLT"
4265bd8deadSopenharmony_ci                              | "SNE"
4275bd8deadSopenharmony_ci                              | "STR"
4285bd8deadSopenharmony_ci                              | "SUB"
4295bd8deadSopenharmony_ci                              | "XPD"
4305bd8deadSopenharmony_ci                              | "DP2"
4315bd8deadSopenharmony_ci                              | "XOR"
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci    <TRIop_instruction>     ::= <TRIop> <opModifiers> <instResult> "," 
4345bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandV> "," 
4355bd8deadSopenharmony_ci                                <instOperandV>
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    <TRIop>                 ::= "CMP"
4385bd8deadSopenharmony_ci                              | "DP2A"
4395bd8deadSopenharmony_ci                              | "LRP"
4405bd8deadSopenharmony_ci                              | "MAD"
4415bd8deadSopenharmony_ci                              | "SAD"
4425bd8deadSopenharmony_ci                              | "X2D"
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    <SWZop_instruction>     ::= <SWZop> <opModifiers> <instResult> "," 
4455bd8deadSopenharmony_ci                                <instOperandVNS> "," <extendedSwizzle>
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    <SWZop>                 ::= "SWZ"
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci    <TEXop_instruction>     ::= <TEXop> <opModifiers> <instResult> "," 
4505bd8deadSopenharmony_ci                                <instOperandV> "," <texAccess>
4515bd8deadSopenharmony_ci
4525bd8deadSopenharmony_ci    <TEXop>                 ::= "TEX"
4535bd8deadSopenharmony_ci                              | "TXB"
4545bd8deadSopenharmony_ci                              | "TXF"
4555bd8deadSopenharmony_ci                              | "TXL"
4565bd8deadSopenharmony_ci                              | "TXP"
4575bd8deadSopenharmony_ci                              | "TXQ"
4585bd8deadSopenharmony_ci
4595bd8deadSopenharmony_ci    <TXDop_instruction>     ::= <TXDop> <opModifiers> <instResult> "," 
4605bd8deadSopenharmony_ci                                <instOperandV> "," <instOperandV> "," 
4615bd8deadSopenharmony_ci                                <instOperandV> "," <texAccess>
4625bd8deadSopenharmony_ci
4635bd8deadSopenharmony_ci    <TXDop>                 ::= "TXD"
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci    <BRAop_instruction>     ::= <BRAop> <opModifiers> <instTarget> 
4665bd8deadSopenharmony_ci                                <optBranchCond>
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci    <BRAop>                 ::= "CAL"
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci    <FLOWCCop_instruction>  ::= <FLOWCCop> <opModifiers> <optBranchCond>
4715bd8deadSopenharmony_ci
4725bd8deadSopenharmony_ci    <FLOWCCop>              ::= "RET"
4735bd8deadSopenharmony_ci                              | "BRK"
4745bd8deadSopenharmony_ci                              | "CONT"
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    <IFop_instruction>      ::= <IFop> <opModifiers> <ccTest>
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    <IFop>                  ::= "IF"
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    <REPop_instruction>     ::= <REPop> <opModifiers> <instOperandV>
4815bd8deadSopenharmony_ci                              | <REPop> <opModifiers>
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    <REPop>                 ::= "REP"
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci    <ENDFLOWop_instruction> ::= <ENDFLOWop> <opModifiers>
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ci    <ENDFLOWop>             ::= "ELSE"
4885bd8deadSopenharmony_ci                              | "ENDIF"
4895bd8deadSopenharmony_ci                              | "ENDREP"
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci    <opModifiers>           ::= <opModifierItem> <opModifiers>
4925bd8deadSopenharmony_ci                              | /* empty */
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci    <opModifierItem>        ::= "." <opModifier>
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci    <opModifier>            ::= "F"
4975bd8deadSopenharmony_ci                              | "U"
4985bd8deadSopenharmony_ci                              | "S"
4995bd8deadSopenharmony_ci                              | "CC"
5005bd8deadSopenharmony_ci                              | "CC0"
5015bd8deadSopenharmony_ci                              | "CC1"
5025bd8deadSopenharmony_ci                              | "SAT"
5035bd8deadSopenharmony_ci                              | "SSAT"
5045bd8deadSopenharmony_ci                              | "NTC"
5055bd8deadSopenharmony_ci                              | "S24"
5065bd8deadSopenharmony_ci                              | "U24"
5075bd8deadSopenharmony_ci                              | "HI"
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci    <texAccess>             ::= <texImageUnit> "," <texTarget>
5105bd8deadSopenharmony_ci                              | <texImageUnit> "," <texTarget> "," <texOffset>
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    <texImageUnit>          ::= "texture" <optArrayMemAbs>
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci    <texTarget>             ::= "1D"
5155bd8deadSopenharmony_ci                              | "2D"
5165bd8deadSopenharmony_ci                              | "3D"
5175bd8deadSopenharmony_ci                              | "CUBE"
5185bd8deadSopenharmony_ci                              | "RECT"
5195bd8deadSopenharmony_ci                              | "SHADOW1D"
5205bd8deadSopenharmony_ci                              | "SHADOW2D"
5215bd8deadSopenharmony_ci                              | "SHADOWRECT"
5225bd8deadSopenharmony_ci                              | "ARRAY1D"
5235bd8deadSopenharmony_ci                              | "ARRAY2D"
5245bd8deadSopenharmony_ci                              | "SHADOWCUBE"
5255bd8deadSopenharmony_ci                              | "SHADOWARRAY1D"
5265bd8deadSopenharmony_ci                              | "SHADOWARRAY2D"
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci    <texOffset>             ::= "(" <texOffsetComp> ")"
5295bd8deadSopenharmony_ci                              | "(" <texOffsetComp> "," <texOffsetComp> ")"
5305bd8deadSopenharmony_ci                              | "(" <texOffsetComp> "," <texOffsetComp> "," 
5315bd8deadSopenharmony_ci                                <texOffsetComp> ")"
5325bd8deadSopenharmony_ci
5335bd8deadSopenharmony_ci    <texOffsetComp>         ::= <optSign> <int>
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    <optBranchCond>         ::= /* empty */
5365bd8deadSopenharmony_ci                              | <ccMask>
5375bd8deadSopenharmony_ci
5385bd8deadSopenharmony_ci    <instOperandV>          ::= <instOperandAbsV>
5395bd8deadSopenharmony_ci                              | <instOperandBaseV>
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    <instOperandAbsV>       ::= <operandAbsNeg> "|" <instOperandBaseV> "|"
5425bd8deadSopenharmony_ci
5435bd8deadSopenharmony_ci    <instOperandBaseV>      ::= <operandNeg> <attribUseV>
5445bd8deadSopenharmony_ci                              | <operandNeg> <tempUseV>
5455bd8deadSopenharmony_ci                              | <operandNeg> <paramUseV>
5465bd8deadSopenharmony_ci                              | <operandNeg> <bufferUseV>
5475bd8deadSopenharmony_ci
5485bd8deadSopenharmony_ci    <instOperandS>          ::= <instOperandAbsS>
5495bd8deadSopenharmony_ci                              | <instOperandBaseS>
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci    <instOperandAbsS>       ::= <operandAbsNeg> "|" <instOperandBaseS> "|"
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci    <instOperandBaseS>      ::= <operandNeg> <attribUseS>
5545bd8deadSopenharmony_ci                              | <operandNeg> <tempUseS>
5555bd8deadSopenharmony_ci                              | <operandNeg> <paramUseS>
5565bd8deadSopenharmony_ci                              | <operandNeg> <bufferUseS>
5575bd8deadSopenharmony_ci
5585bd8deadSopenharmony_ci    <instOperandVNS>        ::= <attribUseVNS>
5595bd8deadSopenharmony_ci                              | <tempUseVNS>
5605bd8deadSopenharmony_ci                              | <paramUseVNS>
5615bd8deadSopenharmony_ci                              | <bufferUseVNS>
5625bd8deadSopenharmony_ci
5635bd8deadSopenharmony_ci    <operandAbsNeg>         ::= <optSign>
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci    <operandNeg>            ::= <optSign>
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci    <instResult>            ::= <instResultCC>
5685bd8deadSopenharmony_ci                              | <instResultBase>
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci    <instResultCC>          ::= <instResultBase> <ccMask>
5715bd8deadSopenharmony_ci
5725bd8deadSopenharmony_ci    <instResultBase>        ::= <tempUseW>
5735bd8deadSopenharmony_ci                              | <resultUseW>
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ci    <namingStatement>       ::= <varMods> <ATTRIB_statement>
5765bd8deadSopenharmony_ci                              | <varMods> <PARAM_statement>
5775bd8deadSopenharmony_ci                              | <varMods> <TEMP_statement>
5785bd8deadSopenharmony_ci                              | <varMods> <OUTPUT_statement>
5795bd8deadSopenharmony_ci                              | <varMods> <BUFFER_statement>
5805bd8deadSopenharmony_ci                              | <ALIAS_statement>
5815bd8deadSopenharmony_ci
5825bd8deadSopenharmony_ci    <ATTRIB_statement>      ::= "ATTRIB" <establishName> "=" <attribUseD>
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci    <PARAM_statement>       ::= <PARAM_singleStmt>
5855bd8deadSopenharmony_ci                              | <PARAM_multipleStmt>
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci    <PARAM_singleStmt>      ::= "PARAM" <establishName> <paramSingleInit>
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci    <PARAM_multipleStmt>    ::= "PARAM" <establishName> <optArraySize> 
5905bd8deadSopenharmony_ci                                <paramMultipleInit>
5915bd8deadSopenharmony_ci
5925bd8deadSopenharmony_ci    <paramSingleInit>       ::= "=" <paramUseDB>
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci    <paramMultipleInit>     ::= "=" "{" <paramMultInitList> "}"
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci    <paramMultInitList>     ::= <paramUseDM>
5975bd8deadSopenharmony_ci                              | <paramUseDM> "," <paramMultInitList>
5985bd8deadSopenharmony_ci
5995bd8deadSopenharmony_ci    <TEMP_statement>        ::= "TEMP" <varNameList>
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    <OUTPUT_statement>      ::= "OUTPUT" <establishName> "=" <resultUseD>
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    <varMods>               ::= <varModifier> <varMods>
6045bd8deadSopenharmony_ci                              | /* empty */
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci    <varModifier>           ::= "SHORT"
6075bd8deadSopenharmony_ci                              | "LONG"
6085bd8deadSopenharmony_ci                              | "INT"
6095bd8deadSopenharmony_ci                              | "UINT"
6105bd8deadSopenharmony_ci                              | "FLOAT"
6115bd8deadSopenharmony_ci
6125bd8deadSopenharmony_ci    <ALIAS_statement>       ::= "ALIAS" <establishName> "=" <establishedName>
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci    <BUFFER_statement>      ::= <bufferDeclType> <establishName> "=" 
6155bd8deadSopenharmony_ci                                <bufferSingleInit>
6165bd8deadSopenharmony_ci                              | <bufferDeclType> <establishName> 
6175bd8deadSopenharmony_ci                                <optArraySize> "=" <bufferMultInit>
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    <bufferDeclType>        ::= "BUFFER"
6205bd8deadSopenharmony_ci                              | "BUFFER4"
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci    <bufferSingleInit>      ::= "=" <bufferUseDB>
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci    <bufferMultInit>        ::= "=" "{" <bufferMultInitList> "}"
6255bd8deadSopenharmony_ci
6265bd8deadSopenharmony_ci    <bufferMultInitList>    ::= <bufferUseDM>
6275bd8deadSopenharmony_ci                              | <bufferUseDM> "," <bufferMultInitList>
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ci    <varNameList>           ::= <establishName>
6305bd8deadSopenharmony_ci                              | <establishName> "," <varNameList>
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ci    <attribUseV>            ::= <attribBasic> <swizzleSuffix>
6335bd8deadSopenharmony_ci                              | <attribVarName> <swizzleSuffix>
6345bd8deadSopenharmony_ci                              | <attribVarName> <arrayMem> <swizzleSuffix>
6355bd8deadSopenharmony_ci                              | <attribColor> <swizzleSuffix>
6365bd8deadSopenharmony_ci                              | <attribColor> "." <colorType> <swizzleSuffix>
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ci    <attribUseS>            ::= <attribBasic> <scalarSuffix>
6395bd8deadSopenharmony_ci                              | <attribVarName> <scalarSuffix>
6405bd8deadSopenharmony_ci                              | <attribVarName> <arrayMem> <scalarSuffix>
6415bd8deadSopenharmony_ci                              | <attribColor> <scalarSuffix>
6425bd8deadSopenharmony_ci                              | <attribColor> "." <colorType> <scalarSuffix>
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    <attribUseVNS>          ::= <attribBasic>
6455bd8deadSopenharmony_ci                              | <attribVarName>
6465bd8deadSopenharmony_ci                              | <attribVarName> <arrayMem>
6475bd8deadSopenharmony_ci                              | <attribColor>
6485bd8deadSopenharmony_ci                              | <attribColor> "." <colorType>
6495bd8deadSopenharmony_ci
6505bd8deadSopenharmony_ci    <attribUseD>            ::= <attribBasic>
6515bd8deadSopenharmony_ci                              | <attribColor>
6525bd8deadSopenharmony_ci                              | <attribColor> "." <colorType>
6535bd8deadSopenharmony_ci                              | <attribMulti>
6545bd8deadSopenharmony_ci
6555bd8deadSopenharmony_ci    <paramUseV>             ::= <paramVarName> <optArrayMem> <swizzleSuffix>
6565bd8deadSopenharmony_ci                              | <stateSingleItem> <swizzleSuffix>
6575bd8deadSopenharmony_ci                              | <programSingleItem> <swizzleSuffix>
6585bd8deadSopenharmony_ci                              | <constantVector> <swizzleSuffix>
6595bd8deadSopenharmony_ci                              | <constantScalar>
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    <paramUseS>             ::= <paramVarName> <optArrayMem> <scalarSuffix>
6625bd8deadSopenharmony_ci                              | <stateSingleItem> <scalarSuffix>
6635bd8deadSopenharmony_ci                              | <programSingleItem> <scalarSuffix>
6645bd8deadSopenharmony_ci                              | <constantVector> <scalarSuffix>
6655bd8deadSopenharmony_ci                              | <constantScalar>
6665bd8deadSopenharmony_ci
6675bd8deadSopenharmony_ci    <paramUseVNS>           ::= <paramVarName> <optArrayMem>
6685bd8deadSopenharmony_ci                              | <stateSingleItem>
6695bd8deadSopenharmony_ci                              | <programSingleItem>
6705bd8deadSopenharmony_ci                              | <constantVector>
6715bd8deadSopenharmony_ci                              | <constantScalar>
6725bd8deadSopenharmony_ci
6735bd8deadSopenharmony_ci    <paramUseDB>            ::= <stateSingleItem>
6745bd8deadSopenharmony_ci                              | <programSingleItem>
6755bd8deadSopenharmony_ci                              | <constantVector>
6765bd8deadSopenharmony_ci                              | <signedConstantScalar>
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    <paramUseDM>            ::= <stateMultipleItem>
6795bd8deadSopenharmony_ci                              | <programMultipleItem>
6805bd8deadSopenharmony_ci                              | <constantVector>
6815bd8deadSopenharmony_ci                              | <signedConstantScalar>
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ci    <stateMultipleItem>     ::= <stateSingleItem>
6845bd8deadSopenharmony_ci                              | "state" "." <stateMatrixRows>
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci    <stateSingleItem>       ::= "state" "." <stateMaterialItem>
6875bd8deadSopenharmony_ci                              | "state" "." <stateLightItem>
6885bd8deadSopenharmony_ci                              | "state" "." <stateLightModelItem>
6895bd8deadSopenharmony_ci                              | "state" "." <stateLightProdItem>
6905bd8deadSopenharmony_ci                              | "state" "." <stateFogItem>
6915bd8deadSopenharmony_ci                              | "state" "." <stateMatrixRow>
6925bd8deadSopenharmony_ci                              | "state" "." <stateTexGenItem>
6935bd8deadSopenharmony_ci                              | "state" "." <stateClipPlaneItem>
6945bd8deadSopenharmony_ci                              | "state" "." <statePointItem>
6955bd8deadSopenharmony_ci                              | "state" "." <stateTexEnvItem>
6965bd8deadSopenharmony_ci                              | "state" "." <stateDepthItem>
6975bd8deadSopenharmony_ci
6985bd8deadSopenharmony_ci    <stateMaterialItem>     ::= "material" "." <stateMatProperty>
6995bd8deadSopenharmony_ci                              | "material" "." <faceType> "." 
7005bd8deadSopenharmony_ci                                <stateMatProperty>
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci    <stateMatProperty>      ::= "ambient"
7035bd8deadSopenharmony_ci                              | "diffuse"
7045bd8deadSopenharmony_ci                              | "specular"
7055bd8deadSopenharmony_ci                              | "emission"
7065bd8deadSopenharmony_ci                              | "shininess"
7075bd8deadSopenharmony_ci
7085bd8deadSopenharmony_ci    <stateLightItem>        ::= "light" <arrayMemAbs> "." <stateLightProperty>
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci    <stateLightProperty>    ::= "ambient"
7115bd8deadSopenharmony_ci                              | "diffuse"
7125bd8deadSopenharmony_ci                              | "specular"
7135bd8deadSopenharmony_ci                              | "position"
7145bd8deadSopenharmony_ci                              | "attenuation"
7155bd8deadSopenharmony_ci                              | "spot" "." <stateSpotProperty>
7165bd8deadSopenharmony_ci                              | "half"
7175bd8deadSopenharmony_ci
7185bd8deadSopenharmony_ci    <stateSpotProperty>     ::= "direction"
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci    <stateLightModelItem>   ::= "lightmodel" "." <stateLModProperty>
7215bd8deadSopenharmony_ci
7225bd8deadSopenharmony_ci    <stateLModProperty>     ::= "ambient"
7235bd8deadSopenharmony_ci                              | "scenecolor"
7245bd8deadSopenharmony_ci                              | <faceType> "." "scenecolor"
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci    <stateLightProdItem>    ::= "lightprod" <arrayMemAbs> "." 
7275bd8deadSopenharmony_ci                                <stateLProdProperty>
7285bd8deadSopenharmony_ci                              | "lightprod" <arrayMemAbs> "." <faceType> "." 
7295bd8deadSopenharmony_ci                                <stateLProdProperty>
7305bd8deadSopenharmony_ci
7315bd8deadSopenharmony_ci    <stateLProdProperty>    ::= "ambient"
7325bd8deadSopenharmony_ci                              | "diffuse"
7335bd8deadSopenharmony_ci                              | "specular"
7345bd8deadSopenharmony_ci
7355bd8deadSopenharmony_ci    <stateFogItem>          ::= "fog" "." <stateFogProperty>
7365bd8deadSopenharmony_ci
7375bd8deadSopenharmony_ci    <stateFogProperty>      ::= "color"
7385bd8deadSopenharmony_ci                              | "params"
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci    <stateMatrixRows>       ::= <stateMatrixItem>
7415bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier>
7425bd8deadSopenharmony_ci                              | <stateMatrixItem> "." "row" <arrayRange>
7435bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier> "." 
7445bd8deadSopenharmony_ci                                "row" <arrayRange>
7455bd8deadSopenharmony_ci
7465bd8deadSopenharmony_ci    <stateMatrixRow>        ::= <stateMatrixItem> "." "row" <arrayMemAbs>
7475bd8deadSopenharmony_ci                              | <stateMatrixItem> "." <stateMatModifier> "." 
7485bd8deadSopenharmony_ci                                "row" <arrayMemAbs>
7495bd8deadSopenharmony_ci
7505bd8deadSopenharmony_ci    <stateMatrixItem>       ::= "matrix" "." <stateMatrixName>
7515bd8deadSopenharmony_ci
7525bd8deadSopenharmony_ci    <stateMatModifier>      ::= "inverse"
7535bd8deadSopenharmony_ci                              | "transpose"
7545bd8deadSopenharmony_ci                              | "invtrans"
7555bd8deadSopenharmony_ci
7565bd8deadSopenharmony_ci    <stateMatrixName>       ::= "modelview" <optArrayMemAbs>
7575bd8deadSopenharmony_ci                              | "projection"
7585bd8deadSopenharmony_ci                              | "mvp"
7595bd8deadSopenharmony_ci                              | "texture" <optArrayMemAbs>
7605bd8deadSopenharmony_ci                              | "program" <arrayMemAbs>
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci    <stateTexGenItem>       ::= "texgen" <optArrayMemAbs> "." 
7635bd8deadSopenharmony_ci                                <stateTexGenType> "." <stateTexGenCoord>
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci    <stateTexGenType>       ::= "eye"
7665bd8deadSopenharmony_ci                              | "object"
7675bd8deadSopenharmony_ci
7685bd8deadSopenharmony_ci    <stateTexGenCoord>      ::= "s"
7695bd8deadSopenharmony_ci                              | "t"
7705bd8deadSopenharmony_ci                              | "r"
7715bd8deadSopenharmony_ci                              | "q"
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci    <stateClipPlaneItem>    ::= "clip" <arrayMemAbs> "." "plane"
7745bd8deadSopenharmony_ci
7755bd8deadSopenharmony_ci    <statePointItem>        ::= "point" "." <statePointProperty>
7765bd8deadSopenharmony_ci
7775bd8deadSopenharmony_ci    <statePointProperty>    ::= "size"
7785bd8deadSopenharmony_ci                              | "attenuation"
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    <stateTexEnvItem>       ::= "texenv" <optArrayMemAbs> "." 
7815bd8deadSopenharmony_ci                                <stateTexEnvProperty>
7825bd8deadSopenharmony_ci
7835bd8deadSopenharmony_ci    <stateTexEnvProperty>   ::= "color"
7845bd8deadSopenharmony_ci
7855bd8deadSopenharmony_ci    <stateDepthItem>        ::= "depth" "." <stateDepthProperty>
7865bd8deadSopenharmony_ci
7875bd8deadSopenharmony_ci    <stateDepthProperty>    ::= "range"
7885bd8deadSopenharmony_ci
7895bd8deadSopenharmony_ci    <programSingleItem>     ::= <progEnvParam>
7905bd8deadSopenharmony_ci                              | <progLocalParam>
7915bd8deadSopenharmony_ci
7925bd8deadSopenharmony_ci    <programMultipleItem>   ::= <progEnvParams>
7935bd8deadSopenharmony_ci                              | <progLocalParams>
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci    <progEnvParams>         ::= "program" "." "env" <arrayMemAbs>
7965bd8deadSopenharmony_ci                              | "program" "." "env" <arrayRange>
7975bd8deadSopenharmony_ci
7985bd8deadSopenharmony_ci    <progEnvParam>          ::= "program" "." "env" <arrayMemAbs>
7995bd8deadSopenharmony_ci
8005bd8deadSopenharmony_ci    <progLocalParams>       ::= "program" "." "local" <arrayMemAbs>
8015bd8deadSopenharmony_ci                              | "program" "." "local" <arrayRange>
8025bd8deadSopenharmony_ci
8035bd8deadSopenharmony_ci    <progLocalParam>        ::= "program" "." "local" <arrayMemAbs>
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci    <constantVector>        ::= "{" <constantVectorList> "}"
8065bd8deadSopenharmony_ci
8075bd8deadSopenharmony_ci    <constantVectorList>    ::= <signedConstantScalar>
8085bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
8095bd8deadSopenharmony_ci                                <signedConstantScalar>
8105bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
8115bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
8125bd8deadSopenharmony_ci                                <signedConstantScalar>
8135bd8deadSopenharmony_ci                              | <signedConstantScalar> "," 
8145bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
8155bd8deadSopenharmony_ci                                <signedConstantScalar> "," 
8165bd8deadSopenharmony_ci                                <signedConstantScalar>
8175bd8deadSopenharmony_ci
8185bd8deadSopenharmony_ci    <signedConstantScalar>  ::= <optSign> <constantScalar>
8195bd8deadSopenharmony_ci
8205bd8deadSopenharmony_ci    <constantScalar>        ::= <floatConstant>
8215bd8deadSopenharmony_ci                              | <intConstant>
8225bd8deadSopenharmony_ci
8235bd8deadSopenharmony_ci    <floatConstant>         ::= <float>
8245bd8deadSopenharmony_ci
8255bd8deadSopenharmony_ci    <intConstant>           ::= <int>
8265bd8deadSopenharmony_ci
8275bd8deadSopenharmony_ci    <tempUseV>              ::= <tempVarName> <swizzleSuffix>
8285bd8deadSopenharmony_ci
8295bd8deadSopenharmony_ci    <tempUseS>              ::= <tempVarName> <scalarSuffix>
8305bd8deadSopenharmony_ci
8315bd8deadSopenharmony_ci    <tempUseVNS>            ::= <tempVarName>
8325bd8deadSopenharmony_ci
8335bd8deadSopenharmony_ci    <tempUseW>              ::= <tempVarName> <optWriteMask>
8345bd8deadSopenharmony_ci
8355bd8deadSopenharmony_ci    <resultUseW>            ::= <resultBasic> <optWriteMask>
8365bd8deadSopenharmony_ci                              | <resultVarName> <optWriteMask>
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci    <resultUseD>            ::= <resultBasic>
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci    <bufferUseV>            ::= <bufferVarName> <optArrayMem> <swizzleSuffix>
8415bd8deadSopenharmony_ci
8425bd8deadSopenharmony_ci    <bufferUseS>            ::= <bufferVarName> <optArrayMem> <scalarSuffix>
8435bd8deadSopenharmony_ci
8445bd8deadSopenharmony_ci    <bufferUseVNS>          ::= <bufferVarName> <optArrayMem>
8455bd8deadSopenharmony_ci
8465bd8deadSopenharmony_ci    <bufferUseDB>           ::= <bufferBinding> <arrayMemAbs>
8475bd8deadSopenharmony_ci
8485bd8deadSopenharmony_ci    <bufferUseDM>           ::= <bufferBinding> <arrayMemAbs>
8495bd8deadSopenharmony_ci                              | <bufferBinding> <arrayRange>
8505bd8deadSopenharmony_ci                              | <bufferBinding>
8515bd8deadSopenharmony_ci
8525bd8deadSopenharmony_ci    <bufferBinding>         ::= "program" "." "buffer" <arrayMemAbs>
8535bd8deadSopenharmony_ci
8545bd8deadSopenharmony_ci    <optArraySize>          ::= "[" "]"
8555bd8deadSopenharmony_ci                              | "[" <int> "]"
8565bd8deadSopenharmony_ci
8575bd8deadSopenharmony_ci    <optArrayMem>           ::= /* empty */
8585bd8deadSopenharmony_ci                              | <arrayMem>
8595bd8deadSopenharmony_ci
8605bd8deadSopenharmony_ci    <arrayMem>              ::= <arrayMemAbs>
8615bd8deadSopenharmony_ci                              | <arrayMemRel>
8625bd8deadSopenharmony_ci
8635bd8deadSopenharmony_ci    <optArrayMemAbs>        ::= /* empty */
8645bd8deadSopenharmony_ci                              | <arrayMemAbs>
8655bd8deadSopenharmony_ci
8665bd8deadSopenharmony_ci    <arrayMemAbs>           ::= "[" <int> "]"
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    <arrayMemRel>           ::= "[" <arrayMemReg> <arrayMemOffset> "]"
8695bd8deadSopenharmony_ci
8705bd8deadSopenharmony_ci    <arrayMemReg>           ::= <addrUseS>
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ci    <arrayMemOffset>        ::= /* empty */
8735bd8deadSopenharmony_ci                              | "+" <int>
8745bd8deadSopenharmony_ci                              | "-" <int>
8755bd8deadSopenharmony_ci
8765bd8deadSopenharmony_ci    <arrayRange>            ::= "[" <int> ".." <int> "]"
8775bd8deadSopenharmony_ci
8785bd8deadSopenharmony_ci    <addrUseS>              ::= <addrVarName> <scalarSuffix>
8795bd8deadSopenharmony_ci
8805bd8deadSopenharmony_ci    <ccMask>                ::= "(" <ccTest> ")"
8815bd8deadSopenharmony_ci
8825bd8deadSopenharmony_ci    <ccTest>                ::= <ccMaskRule> <swizzleSuffix>
8835bd8deadSopenharmony_ci
8845bd8deadSopenharmony_ci    <ccMaskRule>            ::= "EQ"
8855bd8deadSopenharmony_ci                              | "GE"
8865bd8deadSopenharmony_ci                              | "GT"
8875bd8deadSopenharmony_ci                              | "LE"
8885bd8deadSopenharmony_ci                              | "LT"
8895bd8deadSopenharmony_ci                              | "NE"
8905bd8deadSopenharmony_ci                              | "TR"
8915bd8deadSopenharmony_ci                              | "FL"
8925bd8deadSopenharmony_ci                              | "EQ0"
8935bd8deadSopenharmony_ci                              | "GE0"
8945bd8deadSopenharmony_ci                              | "GT0"
8955bd8deadSopenharmony_ci                              | "LE0"
8965bd8deadSopenharmony_ci                              | "LT0"
8975bd8deadSopenharmony_ci                              | "NE0"
8985bd8deadSopenharmony_ci                              | "TR0"
8995bd8deadSopenharmony_ci                              | "FL0"
9005bd8deadSopenharmony_ci                              | "EQ1"
9015bd8deadSopenharmony_ci                              | "GE1"
9025bd8deadSopenharmony_ci                              | "GT1"
9035bd8deadSopenharmony_ci                              | "LE1"
9045bd8deadSopenharmony_ci                              | "LT1"
9055bd8deadSopenharmony_ci                              | "NE1"
9065bd8deadSopenharmony_ci                              | "TR1"
9075bd8deadSopenharmony_ci                              | "FL1"
9085bd8deadSopenharmony_ci                              | "NAN"
9095bd8deadSopenharmony_ci                              | "NAN0"
9105bd8deadSopenharmony_ci                              | "NAN1"
9115bd8deadSopenharmony_ci                              | "LEG"
9125bd8deadSopenharmony_ci                              | "LEG0"
9135bd8deadSopenharmony_ci                              | "LEG1"
9145bd8deadSopenharmony_ci                              | "CF"
9155bd8deadSopenharmony_ci                              | "CF0"
9165bd8deadSopenharmony_ci                              | "CF1"
9175bd8deadSopenharmony_ci                              | "NCF"
9185bd8deadSopenharmony_ci                              | "NCF0"
9195bd8deadSopenharmony_ci                              | "NCF1"
9205bd8deadSopenharmony_ci                              | "OF"
9215bd8deadSopenharmony_ci                              | "OF0"
9225bd8deadSopenharmony_ci                              | "OF1"
9235bd8deadSopenharmony_ci                              | "NOF"
9245bd8deadSopenharmony_ci                              | "NOF0"
9255bd8deadSopenharmony_ci                              | "NOF1"
9265bd8deadSopenharmony_ci                              | "AB"
9275bd8deadSopenharmony_ci                              | "AB0"
9285bd8deadSopenharmony_ci                              | "AB1"
9295bd8deadSopenharmony_ci                              | "BLE"
9305bd8deadSopenharmony_ci                              | "BLE0"
9315bd8deadSopenharmony_ci                              | "BLE1"
9325bd8deadSopenharmony_ci                              | "SF"
9335bd8deadSopenharmony_ci                              | "SF0"
9345bd8deadSopenharmony_ci                              | "SF1"
9355bd8deadSopenharmony_ci                              | "NSF"
9365bd8deadSopenharmony_ci                              | "NSF0"
9375bd8deadSopenharmony_ci                              | "NSF1"
9385bd8deadSopenharmony_ci
9395bd8deadSopenharmony_ci    <optWriteMask>          ::= /* empty */
9405bd8deadSopenharmony_ci                              | <xyzwMask>
9415bd8deadSopenharmony_ci                              | <rgbaMask>
9425bd8deadSopenharmony_ci
9435bd8deadSopenharmony_ci    <xyzwMask>              ::= "." "x"
9445bd8deadSopenharmony_ci                              | "." "y"
9455bd8deadSopenharmony_ci                              | "." "xy"
9465bd8deadSopenharmony_ci                              | "." "z"
9475bd8deadSopenharmony_ci                              | "." "xz"
9485bd8deadSopenharmony_ci                              | "." "yz"
9495bd8deadSopenharmony_ci                              | "." "xyz"
9505bd8deadSopenharmony_ci                              | "." "w"
9515bd8deadSopenharmony_ci                              | "." "xw"
9525bd8deadSopenharmony_ci                              | "." "yw"
9535bd8deadSopenharmony_ci                              | "." "xyw"
9545bd8deadSopenharmony_ci                              | "." "zw"
9555bd8deadSopenharmony_ci                              | "." "xzw"
9565bd8deadSopenharmony_ci                              | "." "yzw"
9575bd8deadSopenharmony_ci                              | "." "xyzw"
9585bd8deadSopenharmony_ci
9595bd8deadSopenharmony_ci    <rgbaMask>              ::= "." "r"
9605bd8deadSopenharmony_ci                              | "." "g"
9615bd8deadSopenharmony_ci                              | "." "rg"
9625bd8deadSopenharmony_ci                              | "." "b"
9635bd8deadSopenharmony_ci                              | "." "rb"
9645bd8deadSopenharmony_ci                              | "." "gb"
9655bd8deadSopenharmony_ci                              | "." "rgb"
9665bd8deadSopenharmony_ci                              | "." "a"
9675bd8deadSopenharmony_ci                              | "." "ra"
9685bd8deadSopenharmony_ci                              | "." "ga"
9695bd8deadSopenharmony_ci                              | "." "rga"
9705bd8deadSopenharmony_ci                              | "." "ba"
9715bd8deadSopenharmony_ci                              | "." "rba"
9725bd8deadSopenharmony_ci                              | "." "gba"
9735bd8deadSopenharmony_ci                              | "." "rgba"
9745bd8deadSopenharmony_ci
9755bd8deadSopenharmony_ci    <swizzleSuffix>         ::= /* empty */
9765bd8deadSopenharmony_ci                              | "." <component>
9775bd8deadSopenharmony_ci                              | "." <xyzwSwizzle>
9785bd8deadSopenharmony_ci                              | "." <rgbaSwizzle>
9795bd8deadSopenharmony_ci
9805bd8deadSopenharmony_ci    <extendedSwizzle>       ::= <extSwizComp> "," <extSwizComp> "," 
9815bd8deadSopenharmony_ci                                <extSwizComp> "," <extSwizComp>
9825bd8deadSopenharmony_ci
9835bd8deadSopenharmony_ci    <extSwizComp>           ::= <optSign> <xyzwExtSwizSel>
9845bd8deadSopenharmony_ci                              | <optSign> <rgbaExtSwizSel>
9855bd8deadSopenharmony_ci
9865bd8deadSopenharmony_ci    <xyzwExtSwizSel>        ::= "0"
9875bd8deadSopenharmony_ci                              | "1"
9885bd8deadSopenharmony_ci                              | <xyzwComponent>
9895bd8deadSopenharmony_ci
9905bd8deadSopenharmony_ci    <rgbaExtSwizSel>        ::= <rgbaComponent>
9915bd8deadSopenharmony_ci
9925bd8deadSopenharmony_ci    <scalarSuffix>          ::= "." <component>
9935bd8deadSopenharmony_ci
9945bd8deadSopenharmony_ci    <component>             ::= <xyzwComponent>
9955bd8deadSopenharmony_ci                              | <rgbaComponent>
9965bd8deadSopenharmony_ci
9975bd8deadSopenharmony_ci    <xyzwComponent>         ::= "x"
9985bd8deadSopenharmony_ci                              | "y"
9995bd8deadSopenharmony_ci                              | "z"
10005bd8deadSopenharmony_ci                              | "w"
10015bd8deadSopenharmony_ci
10025bd8deadSopenharmony_ci    <rgbaComponent>         ::= "r"
10035bd8deadSopenharmony_ci                              | "g"
10045bd8deadSopenharmony_ci                              | "b"
10055bd8deadSopenharmony_ci                              | "a"
10065bd8deadSopenharmony_ci
10075bd8deadSopenharmony_ci    <optSign>               ::= /* empty */
10085bd8deadSopenharmony_ci                              | "-"
10095bd8deadSopenharmony_ci                              | "+"
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ci    <faceType>              ::= "front"
10125bd8deadSopenharmony_ci                              | "back"
10135bd8deadSopenharmony_ci
10145bd8deadSopenharmony_ci    <colorType>             ::= "primary"
10155bd8deadSopenharmony_ci                              | "secondary"
10165bd8deadSopenharmony_ci
10175bd8deadSopenharmony_ci    <instLabel>             ::= <identifier>
10185bd8deadSopenharmony_ci
10195bd8deadSopenharmony_ci    <instTarget>            ::= <identifier>
10205bd8deadSopenharmony_ci
10215bd8deadSopenharmony_ci    <establishedName>       ::= <identifier>
10225bd8deadSopenharmony_ci
10235bd8deadSopenharmony_ci    <establishName>         ::= <identifier>
10245bd8deadSopenharmony_ci
10255bd8deadSopenharmony_ci
10265bd8deadSopenharmony_ci    The <int> rule matches an integer constant.  The integer consists of a
10275bd8deadSopenharmony_ci    sequence of one or more digits ("0" through "9"), or a sequence in
10285bd8deadSopenharmony_ci    hexadecimal form beginning with "0x" followed by a sequence of one or more
10295bd8deadSopenharmony_ci    hexadecimal digits ("0" through "9", "a" through "f", "A" through "F").
10305bd8deadSopenharmony_ci
10315bd8deadSopenharmony_ci    The <float> rule matches a floating-point constant consisting of an
10325bd8deadSopenharmony_ci    integer part, a decimal point, a fraction part, an "e" or "E", and an
10335bd8deadSopenharmony_ci    optionally signed integer exponent.  The integer and fraction parts both
10345bd8deadSopenharmony_ci    consist of a sequence of one or more digits ("0" through "9").  Either the
10355bd8deadSopenharmony_ci    integer part or the fraction parts (not both) may be missing; either the
10365bd8deadSopenharmony_ci    decimal point or the "e" (or "E") and the exponent (not both) may be
10375bd8deadSopenharmony_ci    missing.  Most grammar rules that allow floating-point values also allow
10385bd8deadSopenharmony_ci    integers matching the <int> rule.
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    The <identifier> rule matches a sequence of one or more letters ("A"
10415bd8deadSopenharmony_ci    through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
10425bd8deadSopenharmony_ci    or dollar signs ("$"); the first character must not be a number.  Upper
10435bd8deadSopenharmony_ci    and lower case letters are considered different (names are
10445bd8deadSopenharmony_ci    case-sensitive).  The following strings are reserved keywords and may not
10455bd8deadSopenharmony_ci    be used as identifiers:  "fragment" (for fragment programs only), "vertex"
10465bd8deadSopenharmony_ci    (for vertex and geometry programs), "primitive" (for fragment and geometry
10475bd8deadSopenharmony_ci    programs), "program", "result", "state", and "texture".
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    The <tempVarName>, <paramVarName>, <attribVarName>, <resultVarName>, and
10505bd8deadSopenharmony_ci    <bufferName> rules match identifiers that have been previously established
10515bd8deadSopenharmony_ci    as names of temporary, program parameter, attribute, result, and program
10525bd8deadSopenharmony_ci    parameter buffer variables, respectively.
10535bd8deadSopenharmony_ci
10545bd8deadSopenharmony_ci    The <xyzwSwizzle> and <rgbaSwizzle> rules match any 4-character strings
10555bd8deadSopenharmony_ci    consisting only of the characters "x", "y", "z", and "w" (<xyzwSwizzle>)
10565bd8deadSopenharmony_ci    or "r", "g", "b", "a" (<rgbaSwizzle>).
10575bd8deadSopenharmony_ci
10585bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if a program fails to load
10595bd8deadSopenharmony_ci    because it is not syntactically correct or for one of the semantic
10605bd8deadSopenharmony_ci    restrictions described in the following sections.
10615bd8deadSopenharmony_ci
10625bd8deadSopenharmony_ci    A successfully loaded program is parsed into a sequence of instructions.
10635bd8deadSopenharmony_ci    Each instruction is identified by its tokenized name.  The operation of
10645bd8deadSopenharmony_ci    these instructions when executed is defined in section 2.X.4.  A
10655bd8deadSopenharmony_ci    successfully loaded program string replaces the program string previously
10665bd8deadSopenharmony_ci    loaded into the specified program object.  If the OUT_OF_MEMORY error is
10675bd8deadSopenharmony_ci    generated by ProgramStringARB, no change is made to the previous contents
10685bd8deadSopenharmony_ci    of the current program object.
10695bd8deadSopenharmony_ci
10705bd8deadSopenharmony_ci
10715bd8deadSopenharmony_ci    Section 2.X.3, Program Variables
10725bd8deadSopenharmony_ci
10735bd8deadSopenharmony_ci    Programs may operate on a number of different variables during their
10745bd8deadSopenharmony_ci    execution.  The following sections define the different classes of
10755bd8deadSopenharmony_ci    variables that can be declared and used by a program.  
10765bd8deadSopenharmony_ci
10775bd8deadSopenharmony_ci    Some variable classes require variable bindings.  Variable classes with
10785bd8deadSopenharmony_ci    bindings refer to state that is either generated or consumed outside the
10795bd8deadSopenharmony_ci    program.  Examples of variable bindings include a vertex's normal, the
10805bd8deadSopenharmony_ci    position of a vertex computed by a vertex program, an interpolated texture
10815bd8deadSopenharmony_ci    coordinate, and the diffuse color of light 1.  Variables that are used
10825bd8deadSopenharmony_ci    only during program execution do not have bindings.
10835bd8deadSopenharmony_ci
10845bd8deadSopenharmony_ci    Variables may be declared explicitly according to the <namingStatement>
10855bd8deadSopenharmony_ci    grammar rule.  Explicit variable declarations allow a program to establish
10865bd8deadSopenharmony_ci    a variable name that can be used to refer to a specified resource in
10875bd8deadSopenharmony_ci    subsequent instructions.  Variables may be declared anywhere in the
10885bd8deadSopenharmony_ci    program string, but must be declared prior to use.  A program will fail to
10895bd8deadSopenharmony_ci    load if it declares the same variable name more than once, or if it refers
10905bd8deadSopenharmony_ci    to a variable name that has not been previously declared in the program
10915bd8deadSopenharmony_ci    string.
10925bd8deadSopenharmony_ci
10935bd8deadSopenharmony_ci    Variables may also be declared implicitly, simply by using a variable
10945bd8deadSopenharmony_ci    binding as an operand in a program instruction.  Such uses are considered
10955bd8deadSopenharmony_ci    to automatically create a nameless variable using the specified binding.
10965bd8deadSopenharmony_ci    Only variable from classes with bindings can be declared implicitly.
10975bd8deadSopenharmony_ci
10985bd8deadSopenharmony_ci
10995bd8deadSopenharmony_ci    Section 2.X.3.1, Program Variable Types
11005bd8deadSopenharmony_ci
11015bd8deadSopenharmony_ci    Explicit variable declarations may include one or more modifiers that
11025bd8deadSopenharmony_ci    specify additional information about the variable, such as the size and
11035bd8deadSopenharmony_ci    data type of the components of the variable.  Variable modifiers are
11045bd8deadSopenharmony_ci    specified according to the <varModifier> grammar rule.
11055bd8deadSopenharmony_ci
11065bd8deadSopenharmony_ci    By default, variables are considered typeless.  They can be used in
11075bd8deadSopenharmony_ci    instructions that read or write the variable as floating-point values,
11085bd8deadSopenharmony_ci    signed integers, or unsigned integers.  If a variable is written using one
11095bd8deadSopenharmony_ci    data type but then read using a different one, the results of the
11105bd8deadSopenharmony_ci    operation are undefined.  Variables with bindings are considered to be
11115bd8deadSopenharmony_ci    read or written when their values are produced or consumed; the data type
11125bd8deadSopenharmony_ci    used by the GL is specified in the description of each binding.
11135bd8deadSopenharmony_ci
11145bd8deadSopenharmony_ci    Explicitly declared variables may optionally have one data type modifier,
11155bd8deadSopenharmony_ci    which can be used to detect data type mismatch errors.  Type modifers of
11165bd8deadSopenharmony_ci    "INT", "UINT", and "FLOAT" indicate that the components of the variable
11175bd8deadSopenharmony_ci    are stored as signed integers, unsigned integers, or floating-point
11185bd8deadSopenharmony_ci    values, respectively.  A program will fail to load if it attempts to read
11195bd8deadSopenharmony_ci    or write a variable using a data type other than the one indicated by the
11205bd8deadSopenharmony_ci    data type modifier.  Variables without a data type modifier can be read or
11215bd8deadSopenharmony_ci    written using any data type.
11225bd8deadSopenharmony_ci
11235bd8deadSopenharmony_ci    Explicitly declared variables may optionally have one storage size
11245bd8deadSopenharmony_ci    modifier.  Variables decared as "SHORT" will be represented using at least
11255bd8deadSopenharmony_ci    16 bits per component.  "SHORT" floating-point values will have at least 5
11265bd8deadSopenharmony_ci    bits of exponent and 10 bits of mantissa.  Variables declared as "LONG"
11275bd8deadSopenharmony_ci    will be represented with at least 32 bits per component.  "LONG"
11285bd8deadSopenharmony_ci    floating-point values will have at least 8 bits of exponent and 23 bits of
11295bd8deadSopenharmony_ci    mantissa.  If no size modifier is provided, the GL will automatically
11305bd8deadSopenharmony_ci    select component sizes.  Implementations are not required to support more
11315bd8deadSopenharmony_ci    than one component size, so "SHORT", "LONG", and the default could all
11325bd8deadSopenharmony_ci    refer to the same component size.  The "LONG" modifier is supported only
11335bd8deadSopenharmony_ci    for declarations of temporary variables ("TEMP").  The "SHORT" modifier is
11345bd8deadSopenharmony_ci    supported only for declarations of temporary variables and result
11355bd8deadSopenharmony_ci    variables ("OUTPUT").
11365bd8deadSopenharmony_ci
11375bd8deadSopenharmony_ci    Each variable declaration can include at most one data type and one
11385bd8deadSopenharmony_ci    storage size modifier.  A program will fail to load if it specifies
11395bd8deadSopenharmony_ci    multiple data type or multiple storage size modifiers in a single variable
11405bd8deadSopenharmony_ci    declaration.
11415bd8deadSopenharmony_ci
11425bd8deadSopenharmony_ci    (NOTE:  Fragment programs also support the modifiers "FLAT", "CENTROID",
11435bd8deadSopenharmony_ci    and "NOPERSPECTIVE", which control how per-fragment attribute values are
11445bd8deadSopenharmony_ci    produced.  These modifiers are described in detail in the
11455bd8deadSopenharmony_ci    NV_fragment_program4 specification.)
11465bd8deadSopenharmony_ci
11475bd8deadSopenharmony_ci    Explicitly declared variables of all types may be declared as arrays.  An
11485bd8deadSopenharmony_ci    array variable has one or more members, numbered 0 through <n>-1, where
11495bd8deadSopenharmony_ci    <n> is the number of entries in the array.  The total number of entries in
11505bd8deadSopenharmony_ci    the array can be declared using the <optArraySize> grammar rule.  For
11515bd8deadSopenharmony_ci    variable classes without bindings, an array size must be specified in the
11525bd8deadSopenharmony_ci    program, and must be a positive integer.  For variable classes with
11535bd8deadSopenharmony_ci    bindings, a declared size is optional, and is taken from the number of
11545bd8deadSopenharmony_ci    bindings assigned in the declaration if omitted.  A program will fail to
11555bd8deadSopenharmony_ci    load if the declared size of an array variable does not match the number
11565bd8deadSopenharmony_ci    of assigned bindings.
11575bd8deadSopenharmony_ci
11585bd8deadSopenharmony_ci    When a variable is declared as an array, instructions that use the
11595bd8deadSopenharmony_ci    variable must specify an array member to access according to the
11605bd8deadSopenharmony_ci    <arrayMem> grammar rule.  A program will fail to load if it contains an
11615bd8deadSopenharmony_ci    instruction that accesses an array variable without specifying an array
11625bd8deadSopenharmony_ci    member or an instruction that specifies an array member for a non-array
11635bd8deadSopenharmony_ci    variable.
11645bd8deadSopenharmony_ci
11655bd8deadSopenharmony_ci
11665bd8deadSopenharmony_ci    Section 2.X.3.2, Program Attribute Variables
11675bd8deadSopenharmony_ci
11685bd8deadSopenharmony_ci    Program attribute variables represent per-vertex or per-fragment inputs to
11695bd8deadSopenharmony_ci    the program.  All attribute variables have associated bindings, and are
11705bd8deadSopenharmony_ci    read-only during program execution.  Attribute variables may be declared
11715bd8deadSopenharmony_ci    explicitly via the <ATTRIB_statement> grammar rule, or implicitly by using
11725bd8deadSopenharmony_ci    an attribute binding in an instruction.
11735bd8deadSopenharmony_ci
11745bd8deadSopenharmony_ci    The set of available attribute bindings depends on the program type, and
11755bd8deadSopenharmony_ci    is enumerated in the specifications for each program type.
11765bd8deadSopenharmony_ci
11775bd8deadSopenharmony_ci    The set of bindings allowed for attribute array variables is limited to
11785bd8deadSopenharmony_ci    attribute state grouped in arrays (e.g., texture coordinates, generic
11795bd8deadSopenharmony_ci    vertex attributes).  Additionally, all bindings assigned to the array must
11805bd8deadSopenharmony_ci    be of the same binding type and must increase consecutively.  Examples of
11815bd8deadSopenharmony_ci    valid and invalid binding lists include:
11825bd8deadSopenharmony_ci
11835bd8deadSopenharmony_ci      vertex.attrib[1], vertex.attrib[2]      # valid, 2-entry array
11845bd8deadSopenharmony_ci      vertex.texcoord[0..3]                   # valid, 4-entry array
11855bd8deadSopenharmony_ci      vertex.attrib[1], vertex.attrib[3]      # invalid, skipped attrib 2
11865bd8deadSopenharmony_ci      vertex.attrib[2], vertex.attrib[1]      # invalid, wrong order
11875bd8deadSopenharmony_ci      vertex.attrib[1], vertex.texcoord[2]    # invalid, different types
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci    Additionally, attribute bindings may be used in no more than one array
11905bd8deadSopenharmony_ci    variable accessed with relative addressing.
11915bd8deadSopenharmony_ci
11925bd8deadSopenharmony_ci    Implementations may have a limit on the total number of attribute binding
11935bd8deadSopenharmony_ci    components used by each program target (MAX_PROGRAM_ATTRIB_COMPONENTS_NV).
11945bd8deadSopenharmony_ci    Programs that use more attribute binding components than this limit will
11955bd8deadSopenharmony_ci    fail to load.  The method of counting used attribute binding components is
11965bd8deadSopenharmony_ci    implementation-dependent, but must satisfy the following properties:
11975bd8deadSopenharmony_ci
11985bd8deadSopenharmony_ci      * If an attribute binding is not referenced in a program, or is
11995bd8deadSopenharmony_ci        referenced only in declarations of attribute variables that are not
12005bd8deadSopenharmony_ci        used, none of its components are counted.
12015bd8deadSopenharmony_ci
12025bd8deadSopenharmony_ci      * An attribute binding component may be counted as used only if there
12035bd8deadSopenharmony_ci        exists an instruction operand where
12045bd8deadSopenharmony_ci
12055bd8deadSopenharmony_ci          - the component is enabled for read by the swizzle pattern (Section
12065bd8deadSopenharmony_ci            2.X.4.2), and
12075bd8deadSopenharmony_ci
12085bd8deadSopenharmony_ci          - the attribute binding is
12095bd8deadSopenharmony_ci
12105bd8deadSopenharmony_ci              - referenced directly by the operand,
12115bd8deadSopenharmony_ci
12125bd8deadSopenharmony_ci              - bound to a declared variable referenced by the operand, or
12135bd8deadSopenharmony_ci
12145bd8deadSopenharmony_ci              - bound to a declared array variable where another binding in
12155bd8deadSopenharmony_ci                the array satisfies one of the two previous conditions.
12165bd8deadSopenharmony_ci
12175bd8deadSopenharmony_ci        Implementations are not required to optimize out unused elements of an
12185bd8deadSopenharmony_ci        attribute array or components that are used in only some elements of
12195bd8deadSopenharmony_ci        an array.  The last of these rules is intended to cover the case where
12205bd8deadSopenharmony_ci        the same attribute binding is used in multiple variables.
12215bd8deadSopenharmony_ci
12225bd8deadSopenharmony_ci        For example, an operand whose swizzle pattern selects only the x
12235bd8deadSopenharmony_ci        component may result in the x component of an attribute binding being
12245bd8deadSopenharmony_ci        counted, but may never result in the counting of the y, z, or w
12255bd8deadSopenharmony_ci        components of any attribute binding.
12265bd8deadSopenharmony_ci
12275bd8deadSopenharmony_ci      * Implementations are not required to determine that components read by
12285bd8deadSopenharmony_ci        an instruction are actually unused due to:
12295bd8deadSopenharmony_ci
12305bd8deadSopenharmony_ci          - instruction write masks (for example, a component-wise ADD
12315bd8deadSopenharmony_ci            operation that only writes the "x" component doesn't have to read
12325bd8deadSopenharmony_ci            the "y", "z", and "w" components of its operands) or
12335bd8deadSopenharmony_ci
12345bd8deadSopenharmony_ci          - any other properties of the instruction (for example, the DP3
12355bd8deadSopenharmony_ci            instruction computes a 3-component dot product doesn't have to
12365bd8deadSopenharmony_ci            read the "w" component of its operands).
12375bd8deadSopenharmony_ci
12385bd8deadSopenharmony_ci
12395bd8deadSopenharmony_ci    Section 2.X.3.3, Program Parameters
12405bd8deadSopenharmony_ci
12415bd8deadSopenharmony_ci    Program parameter variables are used as constants during program
12425bd8deadSopenharmony_ci    execution.  All program parameter variables have associated bindings and
12435bd8deadSopenharmony_ci    are read-only during program execution.  Program parameters retain their
12445bd8deadSopenharmony_ci    values across program invocations, although their values may change
12455bd8deadSopenharmony_ci    between invocations due to GL state changes.  Program parameter variables
12465bd8deadSopenharmony_ci    may be declared explicitly via the <PARAM_statement> grammar rule, or
12475bd8deadSopenharmony_ci    implicitly by using a parameter binding in an instruction.  Except where
12485bd8deadSopenharmony_ci    otherwise specified, program parameter bindings always specify
12495bd8deadSopenharmony_ci    floating-point values.
12505bd8deadSopenharmony_ci
12515bd8deadSopenharmony_ci    When declaring program parameter array variables, all bindings are
12525bd8deadSopenharmony_ci    supported and can be assigned to array members in any order.  The only
12535bd8deadSopenharmony_ci    restriction is that no parameter binding may be used more than once in
12545bd8deadSopenharmony_ci    array variables accessed using relative addressing.  A program will fail
12555bd8deadSopenharmony_ci    to load if any program parameter binding is used more than once in a
12565bd8deadSopenharmony_ci    single array accessed using relative addressing or used at least once in
12575bd8deadSopenharmony_ci    two or more arrays accessed using relative addressing.
12585bd8deadSopenharmony_ci
12595bd8deadSopenharmony_ci
12605bd8deadSopenharmony_ci    Constant Bindings
12615bd8deadSopenharmony_ci
12625bd8deadSopenharmony_ci    If a program parameter binding matches the <constantScalar> or
12635bd8deadSopenharmony_ci    <signedConstantScalar> grammar rules, the corresponding program parameter
12645bd8deadSopenharmony_ci    variable is bound to the vector (X,X,X,X), where X is the value of the
12655bd8deadSopenharmony_ci    specified constant.
12665bd8deadSopenharmony_ci
12675bd8deadSopenharmony_ci    If a program parameter binding matches <constantVector>, the corresponding
12685bd8deadSopenharmony_ci    program parameter variable is bound to the vector (X,Y,Z,W), where X, Y,
12695bd8deadSopenharmony_ci    Z, and W are the values corresponding to the first, second, third, and
12705bd8deadSopenharmony_ci    fourth match of <signedConstantScalar>.  If fewer than four constants are
12715bd8deadSopenharmony_ci    specified, Y, Z, and W assume the values 0, 0, and 1, if their respective
12725bd8deadSopenharmony_ci    constants are not specified.
12735bd8deadSopenharmony_ci
12745bd8deadSopenharmony_ci    Constant bindings can be interpreted as having signed integer, unsigned
12755bd8deadSopenharmony_ci    integer, or floating-point values, depending on how they are used in the
12765bd8deadSopenharmony_ci    program text.  For constants in variable declarations, the components of
12775bd8deadSopenharmony_ci    the constant are interpreted according to the variable's component data
12785bd8deadSopenharmony_ci    type modifier.  If no data type modifier is specified in a declaration,
12795bd8deadSopenharmony_ci    constants are interpreted as floating-point values.  For constant bindings
12805bd8deadSopenharmony_ci    used directly in an instruction, the components of the constant are
12815bd8deadSopenharmony_ci    interpreted according to the required data type of the operand.  A program
12825bd8deadSopenharmony_ci    will fail to load if it specifies a floating-point constant value
12835bd8deadSopenharmony_ci    (matching the <floatConstant> grammar rule) that should be interpreted as
12845bd8deadSopenharmony_ci    a signed or unsigned integer, or a negative integer constant value that
12855bd8deadSopenharmony_ci    should be interpreted as an unsigned integer.
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci    If the value used to specify a floating-point constant can not be exactly
12885bd8deadSopenharmony_ci    represented, the nearest floating-point value will be used.  If the value
12895bd8deadSopenharmony_ci    used to specify an integer constant is too large to be represented, the
12905bd8deadSopenharmony_ci    program will fail to load.
12915bd8deadSopenharmony_ci
12925bd8deadSopenharmony_ci
12935bd8deadSopenharmony_ci    Program Environment/Local Parameter Bindings
12945bd8deadSopenharmony_ci
12955bd8deadSopenharmony_ci      Binding                    Components  Underlying State
12965bd8deadSopenharmony_ci      -------------------------  ----------  -------------------------------
12975bd8deadSopenharmony_ci      program.env[a]             (x,y,z,w)   program environment parameter a
12985bd8deadSopenharmony_ci      program.local[a]           (x,y,z,w)   program local parameter a
12995bd8deadSopenharmony_ci      program.env[a..b]          (x,y,z,w)   program environment parameters 
13005bd8deadSopenharmony_ci                                             a through b
13015bd8deadSopenharmony_ci      program.local[a..b]        (x,y,z,w)   program local parameters 
13025bd8deadSopenharmony_ci                                             a through b
13035bd8deadSopenharmony_ci
13045bd8deadSopenharmony_ci      Table X.1:  Program Environment/Local Parameter Bindings.  <a> and <b>
13055bd8deadSopenharmony_ci      indicate parameter numbers, where <a> must be less than or equal to <b>.
13065bd8deadSopenharmony_ci
13075bd8deadSopenharmony_ci    If a program parameter binding matches "program.env[a]" or
13085bd8deadSopenharmony_ci    "program.local[a]", the four components of the program parameter variable
13095bd8deadSopenharmony_ci    are filled with the four components of program environment parameter <a>
13105bd8deadSopenharmony_ci    or program local parameter <a> respectively.
13115bd8deadSopenharmony_ci
13125bd8deadSopenharmony_ci    Additionally, for program parameter array bindings, "program.env[a..b]"
13135bd8deadSopenharmony_ci    and "program.local[a..b]" are equivalent to specifying program environment
13145bd8deadSopenharmony_ci    or local parameters <a> through <b> in order, respectively.  A program
13155bd8deadSopenharmony_ci    using any of these bindings will fail to load if <a> is greater than <b>.
13165bd8deadSopenharmony_ci
13175bd8deadSopenharmony_ci    Program environment and local parameters are typeless, and may be
13185bd8deadSopenharmony_ci    specified as signed integer, unsigned integer, or floating-point
13195bd8deadSopenharmony_ci    variables.  If a program environment parameter is read using a data type
13205bd8deadSopenharmony_ci    other than the one used to specify it, an undefined value is returned.
13215bd8deadSopenharmony_ci
13225bd8deadSopenharmony_ci
13235bd8deadSopenharmony_ci    Material Property Bindings
13245bd8deadSopenharmony_ci
13255bd8deadSopenharmony_ci      Binding                        Components  Underlying State
13265bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
13275bd8deadSopenharmony_ci      state.material.ambient         (r,g,b,a)   front ambient material color
13285bd8deadSopenharmony_ci      state.material.diffuse         (r,g,b,a)   front diffuse material color
13295bd8deadSopenharmony_ci      state.material.specular        (r,g,b,a)   front specular material color
13305bd8deadSopenharmony_ci      state.material.emission        (r,g,b,a)   front emissive material color
13315bd8deadSopenharmony_ci      state.material.shininess       (s,0,0,1)   front material shininess
13325bd8deadSopenharmony_ci      state.material.front.ambient   (r,g,b,a)   front ambient material color
13335bd8deadSopenharmony_ci      state.material.front.diffuse   (r,g,b,a)   front diffuse material color
13345bd8deadSopenharmony_ci      state.material.front.specular  (r,g,b,a)   front specular material color
13355bd8deadSopenharmony_ci      state.material.front.emission  (r,g,b,a)   front emissive material color
13365bd8deadSopenharmony_ci      state.material.front.shininess (s,0,0,1)   front material shininess
13375bd8deadSopenharmony_ci      state.material.back.ambient    (r,g,b,a)   back ambient material color
13385bd8deadSopenharmony_ci      state.material.back.diffuse    (r,g,b,a)   back diffuse material color
13395bd8deadSopenharmony_ci      state.material.back.specular   (r,g,b,a)   back specular material color
13405bd8deadSopenharmony_ci      state.material.back.emission   (r,g,b,a)   back emissive material color
13415bd8deadSopenharmony_ci      state.material.back.shininess  (s,0,0,1)   back material shininess
13425bd8deadSopenharmony_ci
13435bd8deadSopenharmony_ci      Table X.3:  Material Property Bindings.  If a material face is not
13445bd8deadSopenharmony_ci      specified in the binding, the front property is used.
13455bd8deadSopenharmony_ci
13465bd8deadSopenharmony_ci    If a program parameter binding matches any of the material properties
13475bd8deadSopenharmony_ci    listed in Table X.3, the program parameter variable is filled according to
13485bd8deadSopenharmony_ci    the table.  For ambient, diffuse, specular, or emissive colors, the "x",
13495bd8deadSopenharmony_ci    "y", "z", and "w" components are filled with the "r", "g", "b", and "a"
13505bd8deadSopenharmony_ci    components, respectively, of the corresponding material color.  For
13515bd8deadSopenharmony_ci    material shininess, the "x" component is filled with the material's
13525bd8deadSopenharmony_ci    specular exponent, and the "y", "z", and "w" components are filled with
13535bd8deadSopenharmony_ci    the floating-point constants 0, 0, and 1, respectively.  Bindings
13545bd8deadSopenharmony_ci    containing ".back" refer to the back material; all other bindings refer to
13555bd8deadSopenharmony_ci    the front material.
13565bd8deadSopenharmony_ci
13575bd8deadSopenharmony_ci    Material properties can be changed inside a Begin/End pair, either
13585bd8deadSopenharmony_ci    directly by calling Material, or indirectly through color material.
13595bd8deadSopenharmony_ci    However, such property changes are not guaranteed to update program
13605bd8deadSopenharmony_ci    parameter bindings until the following End command.  Program parameter
13615bd8deadSopenharmony_ci    variables bound to material properties changed inside a Begin/End pair are
13625bd8deadSopenharmony_ci    undefined until the following End command.
13635bd8deadSopenharmony_ci
13645bd8deadSopenharmony_ci
13655bd8deadSopenharmony_ci    Light Property Bindings
13665bd8deadSopenharmony_ci
13675bd8deadSopenharmony_ci      Binding                        Components  Underlying State
13685bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
13695bd8deadSopenharmony_ci      state.light[n].ambient         (r,g,b,a)   light n ambient color
13705bd8deadSopenharmony_ci      state.light[n].diffuse         (r,g,b,a)   light n diffuse color
13715bd8deadSopenharmony_ci      state.light[n].specular        (r,g,b,a)   light n specular color
13725bd8deadSopenharmony_ci      state.light[n].position        (x,y,z,w)   light n position
13735bd8deadSopenharmony_ci      state.light[n].attenuation     (a,b,c,e)   light n attenuation constants
13745bd8deadSopenharmony_ci                                                 and spot light exponent
13755bd8deadSopenharmony_ci      state.light[n].spot.direction  (x,y,z,c)   light n spot direction and
13765bd8deadSopenharmony_ci                                                 cutoff angle cosine
13775bd8deadSopenharmony_ci      state.light[n].half            (x,y,z,1)   light n infinite half-angle
13785bd8deadSopenharmony_ci      state.lightmodel.ambient       (r,g,b,a)   light model ambient color
13795bd8deadSopenharmony_ci      state.lightmodel.scenecolor    (r,g,b,a)   light model front scene color
13805bd8deadSopenharmony_ci      state.lightmodel.              (r,g,b,a)   light model front scene color
13815bd8deadSopenharmony_ci               front.scenecolor
13825bd8deadSopenharmony_ci      state.lightmodel.              (r,g,b,a)   light model back scene color
13835bd8deadSopenharmony_ci               back.scenecolor
13845bd8deadSopenharmony_ci      state.lightprod[n].ambient     (r,g,b,a)   light n / front material
13855bd8deadSopenharmony_ci                                                 ambient color product
13865bd8deadSopenharmony_ci      state.lightprod[n].diffuse     (r,g,b,a)   light n / front material
13875bd8deadSopenharmony_ci                                                 diffuse color product
13885bd8deadSopenharmony_ci      state.lightprod[n].specular    (r,g,b,a)   light n / front material
13895bd8deadSopenharmony_ci                                                 specular color product
13905bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / front material
13915bd8deadSopenharmony_ci              front.ambient                      ambient color product
13925bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / front material
13935bd8deadSopenharmony_ci              front.diffuse                      diffuse color product
13945bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / front material
13955bd8deadSopenharmony_ci              front.specular                     specular color product
13965bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / back material
13975bd8deadSopenharmony_ci              back.ambient                       ambient color product
13985bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / back material
13995bd8deadSopenharmony_ci              back.diffuse                       diffuse color product
14005bd8deadSopenharmony_ci      state.lightprod[n].            (r,g,b,a)   light n / back material
14015bd8deadSopenharmony_ci              back.specular                      specular color product
14025bd8deadSopenharmony_ci
14035bd8deadSopenharmony_ci      Table X.4: Light Property Bindings.  <n> indicates a light number.
14045bd8deadSopenharmony_ci
14055bd8deadSopenharmony_ci    If a program parameter binding matches "state.light[n].ambient",
14065bd8deadSopenharmony_ci    "state.light[n].diffuse", or "state.light[n].specular", the "x", "y", "z",
14075bd8deadSopenharmony_ci    and "w" components of the program parameter variable are filled with the
14085bd8deadSopenharmony_ci    "r", "g", "b", and "a" components, respectively, of the corresponding
14095bd8deadSopenharmony_ci    light color.
14105bd8deadSopenharmony_ci
14115bd8deadSopenharmony_ci    If a program parameter binding matches "state.light[n].position", the "x",
14125bd8deadSopenharmony_ci    "y", "z", and "w" components of the program parameter variable are filled
14135bd8deadSopenharmony_ci    with the "x", "y", "z", and "w" components, respectively, of the light
14145bd8deadSopenharmony_ci    position.
14155bd8deadSopenharmony_ci    
14165bd8deadSopenharmony_ci    If a program parameter binding matches "state.light[n].attenuation", the
14175bd8deadSopenharmony_ci    "x", "y", and "z" components of the program parameter variable are filled
14185bd8deadSopenharmony_ci    with the constant, linear, and quadratic attenuation parameters of the
14195bd8deadSopenharmony_ci    specified light, respectively (section 2.13.1).  The "w" component of the
14205bd8deadSopenharmony_ci    program parameter variable is filled with the spot light exponent of the
14215bd8deadSopenharmony_ci    specified light.
14225bd8deadSopenharmony_ci
14235bd8deadSopenharmony_ci    If a program parameter binding matches "state.light[n].spot.direction",
14245bd8deadSopenharmony_ci    the "x", "y", and "z" components of the program parameter variable are
14255bd8deadSopenharmony_ci    filled with the "x", "y", and "z" components of the spot light direction
14265bd8deadSopenharmony_ci    of the specified light, respectively (section 2.13.1).  The "w" component
14275bd8deadSopenharmony_ci    of the program parameter variable is filled with the cosine of the spot
14285bd8deadSopenharmony_ci    light cutoff angle of the specified light.
14295bd8deadSopenharmony_ci
14305bd8deadSopenharmony_ci    If a program parameter binding matches "state.light[n].half", the "x",
14315bd8deadSopenharmony_ci    "y", and "z" components of the program parameter variable are filled with
14325bd8deadSopenharmony_ci    the x, y, and z components, respectively, of the normalized infinite
14335bd8deadSopenharmony_ci    half-angle vector
14345bd8deadSopenharmony_ci
14355bd8deadSopenharmony_ci      h_inf = || P + (0, 0, 1) ||.
14365bd8deadSopenharmony_ci
14375bd8deadSopenharmony_ci    The "w" component is filled with 1.0.  In the computation of h_inf, P
14385bd8deadSopenharmony_ci    consists of the x, y, and z coordinates of the normalized vector from the
14395bd8deadSopenharmony_ci    eye position P_e to the eye-space light position P_pli (section 2.13.1).
14405bd8deadSopenharmony_ci    h_inf is defined to correspond to the normalized half-angle vector when
14415bd8deadSopenharmony_ci    using an infinite light (w coordinate of the position is zero) and an
14425bd8deadSopenharmony_ci    infinite viewer (v_bs is FALSE).  For local lights or a local viewer,
14435bd8deadSopenharmony_ci    h_inf is well-defined but does not match the normalized half-angle vector,
14445bd8deadSopenharmony_ci    which will vary depending on the vertex position.
14455bd8deadSopenharmony_ci
14465bd8deadSopenharmony_ci    If a program parameter binding matches "state.lightmodel.ambient", the
14475bd8deadSopenharmony_ci    "x", "y", "z", and "w" components of the program parameter variable are
14485bd8deadSopenharmony_ci    filled with the "r", "g", "b", and "a" components of the light model
14495bd8deadSopenharmony_ci    ambient color, respectively.
14505bd8deadSopenharmony_ci
14515bd8deadSopenharmony_ci    If a program parameter binding matches "state.lightmodel.scenecolor" or
14525bd8deadSopenharmony_ci    "state.lightmodel.front.scenecolor", the "x", "y", and "z" components of
14535bd8deadSopenharmony_ci    the program parameter variable are filled with the "r", "g", and "b"
14545bd8deadSopenharmony_ci    components respectively of the "front scene color"
14555bd8deadSopenharmony_ci
14565bd8deadSopenharmony_ci      c_scene = a_cs * a_cm + e_cm,
14575bd8deadSopenharmony_ci
14585bd8deadSopenharmony_ci    where a_cs is the light model ambient color, a_cm is the front ambient
14595bd8deadSopenharmony_ci    material color, and e_cm is the front emissive material color.  The "w"
14605bd8deadSopenharmony_ci    component of the program parameter variable is filled with the alpha
14615bd8deadSopenharmony_ci    component of the front diffuse material color.  If a program parameter
14625bd8deadSopenharmony_ci    binding matches "state.lightmodel.back.scenecolor", a similar back scene
14635bd8deadSopenharmony_ci    color, computed using back-facing material properties, is used.  The front
14645bd8deadSopenharmony_ci    and back scene colors match the values that would be assigned to vertices
14655bd8deadSopenharmony_ci    using conventional lighting if all lights were disabled.
14665bd8deadSopenharmony_ci
14675bd8deadSopenharmony_ci    If a program parameter binding matches anything beginning with
14685bd8deadSopenharmony_ci    "state.lightprod[n]", the "x", "y", and "z" components of the program
14695bd8deadSopenharmony_ci    parameter variable are filled with the "r", "g", and "b" components,
14705bd8deadSopenharmony_ci    respectively, of the corresponding light product.  The three light product
14715bd8deadSopenharmony_ci    components are the products of the corresponding color components of the
14725bd8deadSopenharmony_ci    specified material property and the light color of the specified light
14735bd8deadSopenharmony_ci    (see Table X.4).  The "w" component of the program parameter variable is
14745bd8deadSopenharmony_ci    filled with the alpha component of the specified material property.
14755bd8deadSopenharmony_ci
14765bd8deadSopenharmony_ci    Light products depend on material properties, which can be changed inside
14775bd8deadSopenharmony_ci    a Begin/End pair.  Such property changes are not guaranteed to take effect
14785bd8deadSopenharmony_ci    until the following End command.  Program parameter variables bound to
14795bd8deadSopenharmony_ci    light products whose corresponding material property changes inside a
14805bd8deadSopenharmony_ci    Begin/End pair are undefined until the following End command.
14815bd8deadSopenharmony_ci
14825bd8deadSopenharmony_ci
14835bd8deadSopenharmony_ci    Texture Coordinate Generation Property Bindings
14845bd8deadSopenharmony_ci
14855bd8deadSopenharmony_ci      Binding                    Components  Underlying State
14865bd8deadSopenharmony_ci      -------------------------  ----------  ----------------------------
14875bd8deadSopenharmony_ci      state.texgen[n].eye.s      (a,b,c,d)   TexGen eye linear plane
14885bd8deadSopenharmony_ci                                             coefficients, s coord, unit n
14895bd8deadSopenharmony_ci      state.texgen[n].eye.t      (a,b,c,d)   TexGen eye linear plane
14905bd8deadSopenharmony_ci                                             coefficients, t coord, unit n
14915bd8deadSopenharmony_ci      state.texgen[n].eye.r      (a,b,c,d)   TexGen eye linear plane
14925bd8deadSopenharmony_ci                                             coefficients, r coord, unit n
14935bd8deadSopenharmony_ci      state.texgen[n].eye.q      (a,b,c,d)   TexGen eye linear plane
14945bd8deadSopenharmony_ci                                             coefficients, q coord, unit n
14955bd8deadSopenharmony_ci      state.texgen[n].object.s   (a,b,c,d)   TexGen object linear plane
14965bd8deadSopenharmony_ci                                             coefficients, s coord, unit n
14975bd8deadSopenharmony_ci      state.texgen[n].object.t   (a,b,c,d)   TexGen object linear plane
14985bd8deadSopenharmony_ci                                             coefficients, t coord, unit n
14995bd8deadSopenharmony_ci      state.texgen[n].object.r   (a,b,c,d)   TexGen object linear plane
15005bd8deadSopenharmony_ci                                             coefficients, r coord, unit n
15015bd8deadSopenharmony_ci      state.texgen[n].object.q   (a,b,c,d)   TexGen object linear plane
15025bd8deadSopenharmony_ci                                             coefficients, q coord, unit n
15035bd8deadSopenharmony_ci
15045bd8deadSopenharmony_ci      Table X.5:  Texture Coordinate Generation Property Bindings.  "[n]" is
15055bd8deadSopenharmony_ci      optional -- texture unit <n> is used if specified; texture unit 0 is
15065bd8deadSopenharmony_ci      used otherwise.
15075bd8deadSopenharmony_ci
15085bd8deadSopenharmony_ci    If a program parameter binding matches a set of TexGen plane coefficients,
15095bd8deadSopenharmony_ci    the "x", "y", "z", and "w" components of the program parameter variable
15105bd8deadSopenharmony_ci    are filled with the coefficients p1, p2, p3, and p4, respectively, for
15115bd8deadSopenharmony_ci    object linear coefficients, and the coefficents p1', p2', p3', and p4',
15125bd8deadSopenharmony_ci    respectively, for eye linear coefficients (section 2.10.4).
15135bd8deadSopenharmony_ci
15145bd8deadSopenharmony_ci
15155bd8deadSopenharmony_ci    Fog Property Bindings
15165bd8deadSopenharmony_ci
15175bd8deadSopenharmony_ci      Binding                        Components  Underlying State
15185bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
15195bd8deadSopenharmony_ci      state.fog.color                (r,g,b,a)   RGB fog color (section 3.10)
15205bd8deadSopenharmony_ci      state.fog.params               (d,s,e,r)   fog density, linear start
15215bd8deadSopenharmony_ci                                                 and end, and 1/(end-start)
15225bd8deadSopenharmony_ci                                                 (section 3.10) 
15235bd8deadSopenharmony_ci
15245bd8deadSopenharmony_ci      Table X.6:  Fog Property Bindings
15255bd8deadSopenharmony_ci
15265bd8deadSopenharmony_ci    If a program parameter binding matches "state.fog.color", the "x", "y",
15275bd8deadSopenharmony_ci    "z", and "w" components of the program parameter variable are filled with
15285bd8deadSopenharmony_ci    the "r", "g", "b", and "a" components, respectively, of the fog color
15295bd8deadSopenharmony_ci    (section 3.10).
15305bd8deadSopenharmony_ci
15315bd8deadSopenharmony_ci    If a program parameter binding matches "state.fog.params", the "x", "y",
15325bd8deadSopenharmony_ci    and "z" components of the program parameter variable are filled with the
15335bd8deadSopenharmony_ci    fog density, linear fog start, and linear fog end parameters (section
15345bd8deadSopenharmony_ci    3.10), respectively.  The "w" component is filled with 1/(end-start),
15355bd8deadSopenharmony_ci    where end and start are the linear fog end and start parameters,
15365bd8deadSopenharmony_ci    respectively.
15375bd8deadSopenharmony_ci
15385bd8deadSopenharmony_ci
15395bd8deadSopenharmony_ci    Clip Plane Property Bindings
15405bd8deadSopenharmony_ci
15415bd8deadSopenharmony_ci      Binding                        Components  Underlying State
15425bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
15435bd8deadSopenharmony_ci      state.clip[n].plane            (a,b,c,d)   clip plane n coefficients
15445bd8deadSopenharmony_ci
15455bd8deadSopenharmony_ci      Table X.7:  Clip Plane Property Bindings.  <n> specifies the clip plane
15465bd8deadSopenharmony_ci      number, and is required.
15475bd8deadSopenharmony_ci
15485bd8deadSopenharmony_ci    If a program parameter binding matches "state.clip[n].plane", the "x",
15495bd8deadSopenharmony_ci    "y", "z", and "w" components of the program parameter variable are filled
15505bd8deadSopenharmony_ci    with the coefficients p1', p2', p3', and p4', respectively, of clip plane
15515bd8deadSopenharmony_ci    <n> (section 2.11).
15525bd8deadSopenharmony_ci
15535bd8deadSopenharmony_ci
15545bd8deadSopenharmony_ci    Point Property Bindings
15555bd8deadSopenharmony_ci
15565bd8deadSopenharmony_ci      Binding                        Components  Underlying State
15575bd8deadSopenharmony_ci      -----------------------------  ----------  ----------------------------
15585bd8deadSopenharmony_ci      state.point.size               (s,n,x,f)   point size, min and max size
15595bd8deadSopenharmony_ci                                                 clamps, and fade threshold
15605bd8deadSopenharmony_ci                                                 (section 3.3) 
15615bd8deadSopenharmony_ci      state.point.attenuation        (a,b,c,1)   point size attenuation consts
15625bd8deadSopenharmony_ci
15635bd8deadSopenharmony_ci      Table X.8:  Point Property Bindings
15645bd8deadSopenharmony_ci
15655bd8deadSopenharmony_ci    If a program parameter binding matches "state.point.size", the "x", "y",
15665bd8deadSopenharmony_ci    "z", and "w" components of the program parameter variable are filled with
15675bd8deadSopenharmony_ci    the point size, minimum point size, maximum point size, and fade
15685bd8deadSopenharmony_ci    threshold, respectively (section 3.3).
15695bd8deadSopenharmony_ci
15705bd8deadSopenharmony_ci    If a program parameter binding matches "state.point.attenuation", the "x",
15715bd8deadSopenharmony_ci    "y", and "z" components of the program parameter variable are filled with
15725bd8deadSopenharmony_ci    the constant, linear, and quadratic point size attenuation parameters (a,
15735bd8deadSopenharmony_ci    b, and c), respectively (section 3.3).  The "w" component is filled with
15745bd8deadSopenharmony_ci    1.0.
15755bd8deadSopenharmony_ci
15765bd8deadSopenharmony_ci
15775bd8deadSopenharmony_ci    Texture Environment Property Bindings
15785bd8deadSopenharmony_ci
15795bd8deadSopenharmony_ci      Binding                    Components  Underlying State
15805bd8deadSopenharmony_ci      -------------------------  ----------  ----------------------------
15815bd8deadSopenharmony_ci      state.texenv[n].color      (r,g,b,a)   texture environment n color
15825bd8deadSopenharmony_ci
15835bd8deadSopenharmony_ci      Table X.9:  Texture Environment Property Bindings.  "[n]" is optional --
15845bd8deadSopenharmony_ci      texture unit <n> is used if specified; texture unit 0 is used otherwise.
15855bd8deadSopenharmony_ci
15865bd8deadSopenharmony_ci    If a program parameter binding matches "state.texenv[n].color", the "x",
15875bd8deadSopenharmony_ci    "y", "z", and "w" components of the program parameter variable are filled
15885bd8deadSopenharmony_ci    with the "r", "g", "b", and "a" components, respectively, of the
15895bd8deadSopenharmony_ci    corresponding texture environment color.  Note that only "legacy" texture
15905bd8deadSopenharmony_ci    units, as queried by MAX_TEXTURE_UNITS, include texture environment state.
15915bd8deadSopenharmony_ci    Texture image units and texture coordinate sets do not have associated
15925bd8deadSopenharmony_ci    texture environment state.
15935bd8deadSopenharmony_ci
15945bd8deadSopenharmony_ci
15955bd8deadSopenharmony_ci    Depth Property Bindings
15965bd8deadSopenharmony_ci
15975bd8deadSopenharmony_ci      Binding                      Components  Underlying State
15985bd8deadSopenharmony_ci      ---------------------------  ----------  ----------------------------
15995bd8deadSopenharmony_ci      state.depth.range            (n,f,d,1)   Depth range near, far, and
16005bd8deadSopenharmony_ci                                               (far-near) (section 2.10.1)
16015bd8deadSopenharmony_ci
16025bd8deadSopenharmony_ci      Table X.10:  Depth Property Bindings
16035bd8deadSopenharmony_ci
16045bd8deadSopenharmony_ci    If a program parameter binding matches "state.depth.range", the "x" and
16055bd8deadSopenharmony_ci    "y" components of the program parameter variable are filled with the
16065bd8deadSopenharmony_ci    mappings of near and far clipping planes to window coordinates,
16075bd8deadSopenharmony_ci    respectively.  The "z" component is filled with the difference of the
16085bd8deadSopenharmony_ci    mappings of near and far clipping planes, far minus near.  The "w"
16095bd8deadSopenharmony_ci    component is filled with 1.0.
16105bd8deadSopenharmony_ci
16115bd8deadSopenharmony_ci
16125bd8deadSopenharmony_ci    Matrix Property Bindings
16135bd8deadSopenharmony_ci
16145bd8deadSopenharmony_ci      Binding                               Underlying State
16155bd8deadSopenharmony_ci      ------------------------------------  ---------------------------
16165bd8deadSopenharmony_ci      * state.matrix.modelview[n]           modelview matrix n
16175bd8deadSopenharmony_ci        state.matrix.projection             projection matrix
16185bd8deadSopenharmony_ci        state.matrix.mvp                    modelview-projection matrix
16195bd8deadSopenharmony_ci      * state.matrix.texture[n]             texture matrix n
16205bd8deadSopenharmony_ci        state.matrix.program[n]             program matrix n
16215bd8deadSopenharmony_ci
16225bd8deadSopenharmony_ci      Table X.11:  Base Matrix Property Bindings.  The "[n]" syntax indicates
16235bd8deadSopenharmony_ci      a specific matrix number.  For modelview and texture matrices, a matrix
16245bd8deadSopenharmony_ci      number is optional, and matrix zero will be used if the matrix number is
16255bd8deadSopenharmony_ci      omitted.  These base bindings may further be modified by a
16265bd8deadSopenharmony_ci      inverse/transpose selector and a row selector.
16275bd8deadSopenharmony_ci
16285bd8deadSopenharmony_ci    If the beginning of a program parameter binding matches any of the matrix
16295bd8deadSopenharmony_ci    binding names listed in Table X.11, the binding corresponds to a 4x4
16305bd8deadSopenharmony_ci    matrix.  If the parameter binding is followed by ".inverse", ".transpose",
16315bd8deadSopenharmony_ci    or ".invtrans" (<stateMatModifier> grammar rule), the inverse, transpose,
16325bd8deadSopenharmony_ci    or transpose of the inverse, respectively, of the matrix specified in
16335bd8deadSopenharmony_ci    Table X.11 is selected.  Otherwise, the matrix specified in Table X.11 is
16345bd8deadSopenharmony_ci    selected.  If the specified matrix is poorly-conditioned (singular or
16355bd8deadSopenharmony_ci    nearly so), its inverse matrix is undefined.  The binding name
16365bd8deadSopenharmony_ci    "state.matrix.mvp" refers to the product of modelview matrix zero and the
16375bd8deadSopenharmony_ci    projection matrix, defined as
16385bd8deadSopenharmony_ci
16395bd8deadSopenharmony_ci       MVP = P * M0,
16405bd8deadSopenharmony_ci
16415bd8deadSopenharmony_ci    where P is the projection matrix and M0 is modelview matrix zero.
16425bd8deadSopenharmony_ci
16435bd8deadSopenharmony_ci    If the selected matrix is followed by ".row[<a>]" (matching the
16445bd8deadSopenharmony_ci    <stateMatrixRow> grammar rule), the "x", "y", "z", and "w" components of
16455bd8deadSopenharmony_ci    the program parameter variable are filled with the four entries of row <a>
16465bd8deadSopenharmony_ci    of the selected matrix.  In the example,
16475bd8deadSopenharmony_ci
16485bd8deadSopenharmony_ci      PARAM m0 = state.matrix.modelview[1].row[0];
16495bd8deadSopenharmony_ci      PARAM m1 = state.matrix.projection.transpose.row[3];
16505bd8deadSopenharmony_ci
16515bd8deadSopenharmony_ci    the variable "m0" is set to the first row (row 0) of modelview matrix 1
16525bd8deadSopenharmony_ci    and "m1" is set to the last row (row 3) of the transpose of the projection
16535bd8deadSopenharmony_ci    matrix.
16545bd8deadSopenharmony_ci
16555bd8deadSopenharmony_ci    For program parameter array bindings, multiple rows of the selected matrix
16565bd8deadSopenharmony_ci    can be bound via the <stateMatrixRows> grammar rule.  If the selected
16575bd8deadSopenharmony_ci    matrix binding is followed by ".row[<a>..<b>]", the result is equivalent
16585bd8deadSopenharmony_ci    to specifying matrix rows <a> through <b>, in order.  A program will fail
16595bd8deadSopenharmony_ci    to load if <a> is greater than <b>.  If no row selection is specified
16605bd8deadSopenharmony_ci    (<optMatrixRows> matches ""), matrix rows 0 through 3 are bound in order.
16615bd8deadSopenharmony_ci    In the example,
16625bd8deadSopenharmony_ci
16635bd8deadSopenharmony_ci      PARAM m2[] = { state.matrix.program[0].row[1..2] };
16645bd8deadSopenharmony_ci      PARAM m3[] = { state.matrix.program[0].transpose };
16655bd8deadSopenharmony_ci
16665bd8deadSopenharmony_ci    the array "m2" has two entries, containing rows 1 and 2 of program matrix
16675bd8deadSopenharmony_ci    zero, and "m3" has four entries, containing all four rows of the transpose
16685bd8deadSopenharmony_ci    of program matrix zero.
16695bd8deadSopenharmony_ci
16705bd8deadSopenharmony_ci
16715bd8deadSopenharmony_ci    Section 2.X.3.4, Program Temporaries
16725bd8deadSopenharmony_ci
16735bd8deadSopenharmony_ci    Program temporary variables are used to hold temporary results during
16745bd8deadSopenharmony_ci    program execution.  Temporaries do not persist between program
16755bd8deadSopenharmony_ci    invocations, and are undefined at the beginning of each program
16765bd8deadSopenharmony_ci    invocation.
16775bd8deadSopenharmony_ci
16785bd8deadSopenharmony_ci    Temporary variables are declared explicitly using the <TEMP_statement>
16795bd8deadSopenharmony_ci    grammar rule.  Each such statement can declare one or more temporaries.
16805bd8deadSopenharmony_ci    Temporaries can not be declared implicitly.  Temporaries can be declared
16815bd8deadSopenharmony_ci    using any component size ("SHORT" or "LONG") and type ("FLOAT" or "INT")
16825bd8deadSopenharmony_ci    modifier.
16835bd8deadSopenharmony_ci
16845bd8deadSopenharmony_ci    Temporary variables may be declared as arrays.  Temporary variables
16855bd8deadSopenharmony_ci    declared as arrays may be stored in slower memory than those not declared
16865bd8deadSopenharmony_ci    as arrays, and it is recommended to use non-array variables unless array
16875bd8deadSopenharmony_ci    functionality is required.
16885bd8deadSopenharmony_ci
16895bd8deadSopenharmony_ci
16905bd8deadSopenharmony_ci    Section 2.X.3.5, Program Results
16915bd8deadSopenharmony_ci
16925bd8deadSopenharmony_ci    Program result variables represent the per-vertex or per-fragment results
16935bd8deadSopenharmony_ci    of the program.  All result variables have associated bindings, are
16945bd8deadSopenharmony_ci    write-only during program execution, and are undefined at the beginning of
16955bd8deadSopenharmony_ci    each program invocation.  Any vertex or fragment attributes corresponding
16965bd8deadSopenharmony_ci    to unwritten result variables will be undefined in subsequent stages of
16975bd8deadSopenharmony_ci    the pipeline.  Result variables may be declared explicitly via the
16985bd8deadSopenharmony_ci    <OUTPUT_statement> grammar rule, or implicitly by using a result binding
16995bd8deadSopenharmony_ci    in an instruction.
17005bd8deadSopenharmony_ci
17015bd8deadSopenharmony_ci    The set of available result bindings depends on the program type, and is
17025bd8deadSopenharmony_ci    enumerated in the specifications for each program type.
17035bd8deadSopenharmony_ci
17045bd8deadSopenharmony_ci    Result variables may generally be declared as arrays, but the set of
17055bd8deadSopenharmony_ci    bindings allowed for arrays is limited to state grouped in arrays (e.g.,
17065bd8deadSopenharmony_ci    texture coordinates, clip distances, colors).  Additionally, all bindings
17075bd8deadSopenharmony_ci    assigned to the array must be of the same binding type and must increase
17085bd8deadSopenharmony_ci    consecutively.  Examples of valid and invalid binding lists for vertex
17095bd8deadSopenharmony_ci    programs include:
17105bd8deadSopenharmony_ci
17115bd8deadSopenharmony_ci      result.clip[1], result.clip[2]          # valid, 2-entry array
17125bd8deadSopenharmony_ci      result.texcoord[0..3]                   # valid, 4-entry array
17135bd8deadSopenharmony_ci      result.texcoord[1], result.texcoord[3]  # invalid, skipped texcoord 2
17145bd8deadSopenharmony_ci      result.texcoord[2], result.texcoord[1]  # invalid, wrong order
17155bd8deadSopenharmony_ci      result.texcoord[1], result.clip[2]      # invalid, different types
17165bd8deadSopenharmony_ci
17175bd8deadSopenharmony_ci    Additionally, result bindings may be used in no more than one array
17185bd8deadSopenharmony_ci    addressed with relative addressing.
17195bd8deadSopenharmony_ci
17205bd8deadSopenharmony_ci    Implementations may have a limit on the total number of result binding
17215bd8deadSopenharmony_ci    components used by each program target (MAX_PROGRAM_RESULT_COMPONENTS_NV).
17225bd8deadSopenharmony_ci    Programs that require more result binding components than this limit will
17235bd8deadSopenharmony_ci    fail to load.  The method of counting used result binding components is
17245bd8deadSopenharmony_ci    implementation-dependent, but must satisfy the following properties:
17255bd8deadSopenharmony_ci
17265bd8deadSopenharmony_ci      * If a result binding is not referenced in a program, or is referenced
17275bd8deadSopenharmony_ci        only in declarations of result variables that are not used, none of
17285bd8deadSopenharmony_ci        its components are counted.
17295bd8deadSopenharmony_ci
17305bd8deadSopenharmony_ci      * A result binding component may be counted as used only if there exists
17315bd8deadSopenharmony_ci        an instruction operand where
17325bd8deadSopenharmony_ci
17335bd8deadSopenharmony_ci          - the component is enabled in the write mask (Section 2.X.4.3), and
17345bd8deadSopenharmony_ci
17355bd8deadSopenharmony_ci          - the result binding is either
17365bd8deadSopenharmony_ci
17375bd8deadSopenharmony_ci              - referenced directly by the operand,
17385bd8deadSopenharmony_ci
17395bd8deadSopenharmony_ci              - bound to a declared variable referenced by the operand, or
17405bd8deadSopenharmony_ci
17415bd8deadSopenharmony_ci              - bound to a declared array variable where another binding in
17425bd8deadSopenharmony_ci                the array satisfies one of the two previous conditions.
17435bd8deadSopenharmony_ci
17445bd8deadSopenharmony_ci        Implementations are not required to optimize out unused elements of an
17455bd8deadSopenharmony_ci        result array or components that are used in only some elements of an
17465bd8deadSopenharmony_ci        array.  The last of these rules is intended to cover the case where
17475bd8deadSopenharmony_ci        the same result binding is used in multiple variables.
17485bd8deadSopenharmony_ci
17495bd8deadSopenharmony_ci        For example, an instruction whose write mask selects only the x
17505bd8deadSopenharmony_ci        component may result in the x component of a result binding being
17515bd8deadSopenharmony_ci        counted, but may never result in the counting of the y, z, or w
17525bd8deadSopenharmony_ci        components of any result binding.
17535bd8deadSopenharmony_ci
17545bd8deadSopenharmony_ci
17555bd8deadSopenharmony_ci    Section 2.X.3.6, Program Parameter Buffers
17565bd8deadSopenharmony_ci
17575bd8deadSopenharmony_ci    Program parameter buffers are arrays consisting of single-component
17585bd8deadSopenharmony_ci    typeless values or four-component typeless vectors stored in a buffer
17595bd8deadSopenharmony_ci    object.  The GL provides an implementation-dependent number of buffer
17605bd8deadSopenharmony_ci    object binding points for each program target, to which buffer objects can
17615bd8deadSopenharmony_ci    be attached.  Program parameter buffer variables can be changed either by
17625bd8deadSopenharmony_ci    updating the contents of bound buffer objects, or simply by changing the
17635bd8deadSopenharmony_ci    buffer object attached to a binding point.
17645bd8deadSopenharmony_ci
17655bd8deadSopenharmony_ci    Program parameter buffer variables are used as constants during program
17665bd8deadSopenharmony_ci    execution.  All program parameter buffer variables have an associated
17675bd8deadSopenharmony_ci    binding and are read-only during program execution.  Program parameter
17685bd8deadSopenharmony_ci    buffers retain their values across program invocations, although their
17695bd8deadSopenharmony_ci    values may change as buffer object bindings or contents change.  Program
17705bd8deadSopenharmony_ci    parameter buffer variables must be declared explicitly via the
17715bd8deadSopenharmony_ci    <BUFFER_statement> grammar rule.  Program parameter buffer bindings can
17725bd8deadSopenharmony_ci    not be used directly in executable instructions.
17735bd8deadSopenharmony_ci
17745bd8deadSopenharmony_ci    Program parameter buffer variables are treated as an array of
17755bd8deadSopenharmony_ci    single-component values if the <bufferDeclType> grammar rule matches
17765bd8deadSopenharmony_ci    "BUFFER" or as an array of four-component vectors if it matches "BUFFER4".
17775bd8deadSopenharmony_ci    A program will fail to load if a variable declared as "BUFFER" and another
17785bd8deadSopenharmony_ci    variable declared as "BUFFER4" use the same buffer binding point.
17795bd8deadSopenharmony_ci
17805bd8deadSopenharmony_ci    Program parameter buffer variables may be declared as arrays, but all
17815bd8deadSopenharmony_ci    bindings assigned to the array must use the same binding point and must
17825bd8deadSopenharmony_ci    increase consecutively.
17835bd8deadSopenharmony_ci
17845bd8deadSopenharmony_ci      Binding                        Components  Underlying State
17855bd8deadSopenharmony_ci      -----------------------------  ----------  -----------------------------
17865bd8deadSopenharmony_ci      program.buffer[a][b]           (x,x,x,x)   program parameter buffer a,
17875bd8deadSopenharmony_ci                                                   element b
17885bd8deadSopenharmony_ci      program.buffer[a][b..c]        (x,x,x,x)   program parameter buffer a,
17895bd8deadSopenharmony_ci                                                   elements b through c
17905bd8deadSopenharmony_ci      program.buffer[a]              (x,x,x,x)   program parameter buffer a,
17915bd8deadSopenharmony_ci                                                   all elements
17925bd8deadSopenharmony_ci
17935bd8deadSopenharmony_ci      Table X.12: Program Parameter Buffer Bindings.  <a> indicates a buffer
17945bd8deadSopenharmony_ci      number, <b> and <c> indicate individual elements.
17955bd8deadSopenharmony_ci
17965bd8deadSopenharmony_ci    If a program parameter buffer binding matches "program.buffer[a][b]", the
17975bd8deadSopenharmony_ci    program parameter variable are filled with element <b> of the buffer
17985bd8deadSopenharmony_ci    object bound to binding point <a>.  Each element of the bound buffer
17995bd8deadSopenharmony_ci    object is treated a one or four words of data that can hold integer or
18005bd8deadSopenharmony_ci    floating-point values.  When a single-component binding is evaluated, the
18015bd8deadSopenharmony_ci    selected word is broadcast to all four components of the variable.  When a
18025bd8deadSopenharmony_ci    four-component binding is evaluated, the four components of the buffer
18035bd8deadSopenharmony_ci    element are loaded into the variable.  If no buffer object is bound to
18045bd8deadSopenharmony_ci    binding point <a>, or the bound buffer object is not large enough to hold
18055bd8deadSopenharmony_ci    an element <b>, the values used are undefined.  The binding point <a> must
18065bd8deadSopenharmony_ci    be a nonnegative integer constant.
18075bd8deadSopenharmony_ci
18085bd8deadSopenharmony_ci    For program parameter buffer array declarations, "program.buffer[a][b..c]"
18095bd8deadSopenharmony_ci    is equivalent to specifying elements <b> through <c> of the buffer object
18105bd8deadSopenharmony_ci    bound to binding point <a> in order.
18115bd8deadSopenharmony_ci
18125bd8deadSopenharmony_ci    For program parameter buffer array declarations, "program.buffer[a]" is
18135bd8deadSopenharmony_ci    equivalent to specifying the entire buffer -- elements 0 through <n>-1,
18145bd8deadSopenharmony_ci    where <n> is either the size of the array (if declared) or the
18155bd8deadSopenharmony_ci    implementation-dependent maximum parameter buffer object size limit (if no
18165bd8deadSopenharmony_ci    size is declared).
18175bd8deadSopenharmony_ci
18185bd8deadSopenharmony_ci
18195bd8deadSopenharmony_ci    Section 2.X.3.7, Program Condition Code Registers
18205bd8deadSopenharmony_ci
18215bd8deadSopenharmony_ci    The program condition code registers are four-component vectors.  Each
18225bd8deadSopenharmony_ci    component of this register is a collection of single-bit flags, including
18235bd8deadSopenharmony_ci    a sign flag (SF), a zero flag (ZF), an overflow flag (OF), and a carry
18245bd8deadSopenharmony_ci    flag (CF).  There are two condition code registers (CC0 and CC1), whose
18255bd8deadSopenharmony_ci    values are undefined at the beginning of program execution.
18265bd8deadSopenharmony_ci
18275bd8deadSopenharmony_ci    Most program instructions can optionally update one of the condition code
18285bd8deadSopenharmony_ci    registers, by designating the condition code to update in the instruction.
18295bd8deadSopenharmony_ci    When a condition code component is updated, the four flags of each
18305bd8deadSopenharmony_ci    component of the condition code are set according to the corresponding
18315bd8deadSopenharmony_ci    component of the instruction result.  Full details on the condition code
18325bd8deadSopenharmony_ci    updates and tests can be found in Section 2.X.4.3.
18335bd8deadSopenharmony_ci
18345bd8deadSopenharmony_ci    The value of these four flags can be combined in various condition code
18355bd8deadSopenharmony_ci    tests, which can be used to mask writes to destination variables and to
18365bd8deadSopenharmony_ci    perform conditional branches or other condition operations.
18375bd8deadSopenharmony_ci
18385bd8deadSopenharmony_ci
18395bd8deadSopenharmony_ci    Section 2.X.3.8, Program Aliases
18405bd8deadSopenharmony_ci
18415bd8deadSopenharmony_ci    Programs can create aliases by matching the <ALIAS_statement> grammar
18425bd8deadSopenharmony_ci    rule.  Aliases allow programs to use multiple variable names to refer to a
18435bd8deadSopenharmony_ci    single underlying variable.  For example, the statement
18445bd8deadSopenharmony_ci
18455bd8deadSopenharmony_ci      ALIAS var1 = var0
18465bd8deadSopenharmony_ci
18475bd8deadSopenharmony_ci    establishes a variable name of "var1".  Subsequent references to "var1" in
18485bd8deadSopenharmony_ci    the program text are treated as references to "var0".  The left hand side
18495bd8deadSopenharmony_ci    of an ALIAS statement must be a new variable name, and the right hand side
18505bd8deadSopenharmony_ci    must be an established variable name.
18515bd8deadSopenharmony_ci
18525bd8deadSopenharmony_ci    Aliases are not considered variable declarations, so do not count against
18535bd8deadSopenharmony_ci    the limits on the number of variable declarations allowed in the program
18545bd8deadSopenharmony_ci    text.
18555bd8deadSopenharmony_ci
18565bd8deadSopenharmony_ci
18575bd8deadSopenharmony_ci    Section 2.X.3.9, Program Resource Limits
18585bd8deadSopenharmony_ci
18595bd8deadSopenharmony_ci    (see ARB_vertex_program specification, incorporates all the different
18605bd8deadSopenharmony_ci    limits on instruction counts, temporaries, attribute bindings, program
18615bd8deadSopenharmony_ci    parameters, and so on)
18625bd8deadSopenharmony_ci
18635bd8deadSopenharmony_ci
18645bd8deadSopenharmony_ci    Section 2.X.4, Program Execution Environment
18655bd8deadSopenharmony_ci
18665bd8deadSopenharmony_ci    The set of instructions supported for GPU programs is given in Table X.13
18675bd8deadSopenharmony_ci    below and is described in detail in Section 2.X.8.  An instruction can use
18685bd8deadSopenharmony_ci    up to three operands when it executes, and most instructions can write a
18695bd8deadSopenharmony_ci    single result vector.  Instructions may also specify one or more
18705bd8deadSopenharmony_ci    modifiers, according to the <opModifiers> grammar rule.  Instruction
18715bd8deadSopenharmony_ci    modifiers affect how the specified operation is performed.
18725bd8deadSopenharmony_ci
18735bd8deadSopenharmony_ci    GPU programs may operate on signed integer, unsigned integer, or
18745bd8deadSopenharmony_ci    floating-point values; some instructions are capable of operating on any
18755bd8deadSopenharmony_ci    of the three types.  However, the data type of the operands and the result
18765bd8deadSopenharmony_ci    are always determined based solely on the instruction and its modifiers.
18775bd8deadSopenharmony_ci    If any of the variables used in the instruction are typeless, they will be
18785bd8deadSopenharmony_ci    interpreted according to the data type derived from the instruction.  If
18795bd8deadSopenharmony_ci    any variables with a conflicting data type are used in the instruction,
18805bd8deadSopenharmony_ci    the program will fail to load unless the "NTC" (no type checking)
18815bd8deadSopenharmony_ci    instruction modifier is specified.
18825bd8deadSopenharmony_ci
18835bd8deadSopenharmony_ci                  Modifiers 
18845bd8deadSopenharmony_ci      Instruction F I C S H D  Out Inputs    Description
18855bd8deadSopenharmony_ci      ----------- - - - - - -  --- --------  --------------------------------
18865bd8deadSopenharmony_ci      ABS         X X X X X F  v   v         absolute value
18875bd8deadSopenharmony_ci      ADD         X X X X X F  v   v,v       add
18885bd8deadSopenharmony_ci      AND         - X X - - S  v   v,v       bitwise and
18895bd8deadSopenharmony_ci      BRK         - - - - - -  -   c         break out of loop instruction
18905bd8deadSopenharmony_ci      CAL         - - - - - -  -   c         subroutine call
18915bd8deadSopenharmony_ci      CEIL        X X X X X F  v   vf        ceiling
18925bd8deadSopenharmony_ci      CMP         X X X X X F  v   v,v,v     compare
18935bd8deadSopenharmony_ci      CONT        - - - - - -  -   c         continue with next loop interation
18945bd8deadSopenharmony_ci      COS         X - X X X F  s   s         cosine with reduction to [-PI,PI]
18955bd8deadSopenharmony_ci      DIV         X X X X X F  v   v,s       divide vector components by scalar
18965bd8deadSopenharmony_ci      DP2         X - X X X F  s   v,v       2-component dot product
18975bd8deadSopenharmony_ci      DP2A        X - X X X F  s   v,v,v     2-comp. dot product w/scalar add
18985bd8deadSopenharmony_ci      DP3         X - X X X F  s   v,v       3-component dot product
18995bd8deadSopenharmony_ci      DP4         X - X X X F  s   v,v       4-component dot product
19005bd8deadSopenharmony_ci      DPH         X - X X X F  s   v,v       homogeneous dot product
19015bd8deadSopenharmony_ci      DST         X - X X X F  v   v,v       distance vector
19025bd8deadSopenharmony_ci      ELSE        - - - - - -  -   -         start if test else block
19035bd8deadSopenharmony_ci      ENDIF       - - - - - -  -   -         end if test block
19045bd8deadSopenharmony_ci      ENDREP      - - - - - -  -   -         end of repeat block
19055bd8deadSopenharmony_ci      EX2         X - X X X F  s   s         exponential base 2
19065bd8deadSopenharmony_ci      FLR         X X X X X F  v   vf        floor
19075bd8deadSopenharmony_ci      FRC         X - X X X F  v   v         fraction
19085bd8deadSopenharmony_ci      I2F         - X X - - S  vf  v         integer to float
19095bd8deadSopenharmony_ci      IF          - - - - - -  -   c         start of if test block
19105bd8deadSopenharmony_ci      KIL         X X - - X F  -   vc        kill fragment
19115bd8deadSopenharmony_ci      LG2         X - X X X F  s   s         logarithm base 2
19125bd8deadSopenharmony_ci      LIT         X - X X X F  v   v         compute lighting coefficients
19135bd8deadSopenharmony_ci      LRP         X - X X X F  v   v,v,v     linear interpolation
19145bd8deadSopenharmony_ci      MAD         X X X X X F  v   v,v,v     multiply and add
19155bd8deadSopenharmony_ci      MAX         X X X X X F  v   v,v       maximum
19165bd8deadSopenharmony_ci      MIN         X X X X X F  v   v,v       minimum
19175bd8deadSopenharmony_ci      MOD         - X X - - S  v   v,s       modulus vector components by scalar
19185bd8deadSopenharmony_ci      MOV         X X X X X F  v   v         move
19195bd8deadSopenharmony_ci      MUL         X X X X X F  v   v,v       multiply
19205bd8deadSopenharmony_ci      NOT         - X X - - S  v   v         bitwise not
19215bd8deadSopenharmony_ci      NRM         X - X X X F  v   v         normalize 3-component vector
19225bd8deadSopenharmony_ci      OR          - X X - - S  v   v,v       bitwise or
19235bd8deadSopenharmony_ci      PK2H        X X - - - F  s   vf        pack two 16-bit floats
19245bd8deadSopenharmony_ci      PK2US       X X - - - F  s   vf        pack two floats as unsigned 16-bit
19255bd8deadSopenharmony_ci      PK4B        X X - - - F  s   vf        pack four floats as signed 8-bit
19265bd8deadSopenharmony_ci      PK4UB       X X - - - F  s   vf        pack four floats as unsigned 8-bit
19275bd8deadSopenharmony_ci      POW         X - X X X F  s   s,s       exponentiate
19285bd8deadSopenharmony_ci      RCC         X - X X X F  s   s         reciprocal (clamped)
19295bd8deadSopenharmony_ci      RCP         X - X X X F  s   s         reciprocal
19305bd8deadSopenharmony_ci      REP         X X - - X F  -   v         start of repeat block
19315bd8deadSopenharmony_ci      RET         - - - - - -  -   c         subroutine return
19325bd8deadSopenharmony_ci      RFL         X - X X X F  v   v,v       reflection vector
19335bd8deadSopenharmony_ci      ROUND       X X X X X F  v   vf        round to nearest integer
19345bd8deadSopenharmony_ci      RSQ         X - X X X F  s   s         reciprocal square root
19355bd8deadSopenharmony_ci      SAD         - X X - - S  vu  v,v,vu    sum of absolute differences
19365bd8deadSopenharmony_ci      SCS         X - X X X F  v   s         sine/cosine without reduction
19375bd8deadSopenharmony_ci      SEQ         X X X X X F  v   v,v       set on equal
19385bd8deadSopenharmony_ci      SFL         X X X X X F  v   v,v       set on false
19395bd8deadSopenharmony_ci      SGE         X X X X X F  v   v,v       set on greater than or equal
19405bd8deadSopenharmony_ci      SGT         X X X X X F  v   v,v       set on greater than
19415bd8deadSopenharmony_ci      SHL         - X X - - S  v   v,s       shift left
19425bd8deadSopenharmony_ci      SHR         - X X - - S  v   v,s       shift right 
19435bd8deadSopenharmony_ci      SIN         X - X X X F  s   s         sine with reduction to [-PI,PI]
19445bd8deadSopenharmony_ci      SLE         X X X X X F  v   v,v       set on less than or equal
19455bd8deadSopenharmony_ci      SLT         X X X X X F  v   v,v       set on less than
19465bd8deadSopenharmony_ci      SNE         X X X X X F  v   v,v       set on not equal
19475bd8deadSopenharmony_ci      SSG         X - X X X F  v   v         set sign
19485bd8deadSopenharmony_ci      STR         X X X X X F  v   v,v       set on true
19495bd8deadSopenharmony_ci      SUB         X X X X X F  v   v,v       subtract
19505bd8deadSopenharmony_ci      SWZ         X - X X X F  v   v         extended swizzle
19515bd8deadSopenharmony_ci      TEX         X X X X - F  v   vf        texture sample
19525bd8deadSopenharmony_ci      TRUNC       X X X X X F  v   vf        truncate (round toward zero)
19535bd8deadSopenharmony_ci      TXB         X X X X - F  v   vf        texture sample with bias
19545bd8deadSopenharmony_ci      TXD         X X X X - F  v   vf,vf,vf  texture sample w/partials      
19555bd8deadSopenharmony_ci      TXF         X X X X - F  v   vs        texel fetch
19565bd8deadSopenharmony_ci      TXL         X X X X - F  v   vf        texture sample w/LOD
19575bd8deadSopenharmony_ci      TXP         X X X X - F  v   vf        texture sample w/projection
19585bd8deadSopenharmony_ci      TXQ         - - - - - S  vs  vs        texture info query
19595bd8deadSopenharmony_ci      UP2H        X X X X - F  vf  s         unpack two 16-bit floats
19605bd8deadSopenharmony_ci      UP2US       X X X X - F  vf  s         unpack two unsigned 16-bit ints
19615bd8deadSopenharmony_ci      UP4B        X X X X - F  vf  s         unpack four signed 8-bit ints
19625bd8deadSopenharmony_ci      UP4UB       X X X X - F  vf  s         unpack four unsigned 8-bit ints
19635bd8deadSopenharmony_ci      X2D         X - X X X F  v   v,v,v     2D coordinate transformation
19645bd8deadSopenharmony_ci      XOR         - X X - - S  v   v,v       exclusive or
19655bd8deadSopenharmony_ci      XPD         X - X X X F  v   v,v       cross product
19665bd8deadSopenharmony_ci
19675bd8deadSopenharmony_ci      Table X.13:  Summary of NV_gpu_program4 instructions.  The "Modifiers"
19685bd8deadSopenharmony_ci      columns specify the set of modifiers allowed for the instruction:
19695bd8deadSopenharmony_ci
19705bd8deadSopenharmony_ci        F = floating-point data type modifiers
19715bd8deadSopenharmony_ci        I = signed and unsigned integer data type modifiers
19725bd8deadSopenharmony_ci        C = condition code update modifiers
19735bd8deadSopenharmony_ci        S = clamping (saturation) modifiers
19745bd8deadSopenharmony_ci        H = half-precision float data type suffix
19755bd8deadSopenharmony_ci        D = default data type modifier (F, U, or S)
19765bd8deadSopenharmony_ci
19775bd8deadSopenharmony_ci      The input and output columns describe the formats of the operands and
19785bd8deadSopenharmony_ci      results of the instruction.
19795bd8deadSopenharmony_ci
19805bd8deadSopenharmony_ci        v:  4-component vector (data type is inherited from operation)
19815bd8deadSopenharmony_ci        vf: 4-component vector (data type is always floating-point)
19825bd8deadSopenharmony_ci        vs: 4-component vector (data type is always signed integer)
19835bd8deadSopenharmony_ci        vu: 4-component vector (data type is always unsigned integer)
19845bd8deadSopenharmony_ci        s:  scalar (replicated if written to a vector destination;
19855bd8deadSopenharmony_ci                    data type is inherited from operation)
19865bd8deadSopenharmony_ci        c:  condition code test result (e.g., "EQ", "GT1.x")
19875bd8deadSopenharmony_ci        vc: 4-component vector or condition code test
19885bd8deadSopenharmony_ci
19895bd8deadSopenharmony_ci
19905bd8deadSopenharmony_ci    Section 2.X.4.1, Program Instruction Modifiers
19915bd8deadSopenharmony_ci
19925bd8deadSopenharmony_ci    There are several types of instruction modifiers available.  A data type
19935bd8deadSopenharmony_ci    modifier specifies that an instruction should operate on signed integer,
19945bd8deadSopenharmony_ci    unsigned integer, or floating-point data, when multiple data types are
19955bd8deadSopenharmony_ci    supported.  A clamping modifier applies to instructions with
19965bd8deadSopenharmony_ci    floating-point results, and specifies the range to which the results
19975bd8deadSopenharmony_ci    should be clamped.  A condition code update modifier specifies that the
19985bd8deadSopenharmony_ci    instruction should update one of the condition code variables.  Several
19995bd8deadSopenharmony_ci    other special modifiers are also provided.
20005bd8deadSopenharmony_ci
20015bd8deadSopenharmony_ci    Instruction modifiers may be specified as stand-alone modifiers or as
20025bd8deadSopenharmony_ci    suffixes concatenated with the opcode name.  A program will fail to load
20035bd8deadSopenharmony_ci    if it contains an instruction that
20045bd8deadSopenharmony_ci
20055bd8deadSopenharmony_ci      * specifies more than one modifier of any given type,
20065bd8deadSopenharmony_ci
20075bd8deadSopenharmony_ci      * specifies a clamping modifier on an instruction, unless it produces
20085bd8deadSopenharmony_ci        floating-point results, or
20095bd8deadSopenharmony_ci
20105bd8deadSopenharmony_ci      * specifies a modifier that is not supported by the instruction (see
20115bd8deadSopenharmony_ci        Table X.13 and the instruction description).
20125bd8deadSopenharmony_ci
20135bd8deadSopenharmony_ci    Stand-alone instruction modifiers are specified according to the
20145bd8deadSopenharmony_ci    <opModifiers> grammar rule using a ".<modifier>" syntax.  Multiple
20155bd8deadSopenharmony_ci    modifers, separated by periods, may be specified.  The set of supported
20165bd8deadSopenharmony_ci    modifiers is described in Table X.14.
20175bd8deadSopenharmony_ci
20185bd8deadSopenharmony_ci      Modifier  Description
20195bd8deadSopenharmony_ci      --------  -----------------------------------------------
20205bd8deadSopenharmony_ci      F         Floating-point operation
20215bd8deadSopenharmony_ci      U         Fixed-point operation, unsigned operands
20225bd8deadSopenharmony_ci      S         Fixed-point operation, signed operands
20235bd8deadSopenharmony_ci      CC        Update condition code register zero
20245bd8deadSopenharmony_ci      CC0       Update condition code register zero
20255bd8deadSopenharmony_ci      CC1       Update condition code register one
20265bd8deadSopenharmony_ci      SAT       Floating-point results clamped to [0,1]
20275bd8deadSopenharmony_ci      SSAT      Floating-point results clamped to [-1,1]
20285bd8deadSopenharmony_ci      NTC       Disable type-checking on operands/results
20295bd8deadSopenharmony_ci      S24       Signed multiply (24-bit operands)
20305bd8deadSopenharmony_ci      U24       Unsigned multiply (24-bit operands)
20315bd8deadSopenharmony_ci      HI        Multiplies two 32-bit integer operands, returns
20325bd8deadSopenharmony_ci                  the 32 MSBs of the product
20335bd8deadSopenharmony_ci
20345bd8deadSopenharmony_ci      Table X.14, Instruction Modifers.
20355bd8deadSopenharmony_ci
20365bd8deadSopenharmony_ci    "F", "U", and "S" modifiers are data type modifiers and specify that the
20375bd8deadSopenharmony_ci    instruction should operate on floating-point, unsigned integer, or
20385bd8deadSopenharmony_ci    signed integer values, respectively.  For example, "ADD.F", "ADD.U", and
20395bd8deadSopenharmony_ci    "ADD.S" specify component-wise addition of floating-point, unsigned
20405bd8deadSopenharmony_ci    integer, or signed integer vectors, respectively.  These modifiers specify
20415bd8deadSopenharmony_ci    a data type, but do not specify a precision at which the operation is
20425bd8deadSopenharmony_ci    performed.  Floating-point operations will be carried out with an internal
20435bd8deadSopenharmony_ci    precision no less than that used to represent the largest operand.
20445bd8deadSopenharmony_ci    Fixed-point operations will be carried out using at least as many bits as
20455bd8deadSopenharmony_ci    used to represent the largest operand.  Operands represented with fewer
20465bd8deadSopenharmony_ci    bits than used to perform the instruction will be promoted to a larger
20475bd8deadSopenharmony_ci    data type.  Signed integer operands will be sign-extended, where the most
20485bd8deadSopenharmony_ci    significant bits are filled with ones if the operand is negative and zero
20495bd8deadSopenharmony_ci    otherwise.  Unsigned integer operands will be zero-extended, where the
20505bd8deadSopenharmony_ci    most significant bits are always filled with zeroes.  For some
20515bd8deadSopenharmony_ci    instructions, the data type of some operands or the result are fixed; in
20525bd8deadSopenharmony_ci    these cases, the data type modifier specifies the data type of the
20535bd8deadSopenharmony_ci    remaining values.
20545bd8deadSopenharmony_ci
20555bd8deadSopenharmony_ci    "CC", "CC0", and "CC1" are condition code update modifiers that specify
20565bd8deadSopenharmony_ci    that one of the condition code registers should be updated based on the
20575bd8deadSopenharmony_ci    result of the instruction, as described in section 2.X.4.3.  "CC" and
20585bd8deadSopenharmony_ci    "CC0" specify that the condition code register CC0 be updated; "CC1"
20595bd8deadSopenharmony_ci    specifies an update to CC1.  If no condition code update modifier is
20605bd8deadSopenharmony_ci    provided, the condition code registers will not be affected.
20615bd8deadSopenharmony_ci
20625bd8deadSopenharmony_ci    "SAT" and "SSAT" are clamping modifiers that specify that the
20635bd8deadSopenharmony_ci    floating-point components of the instruction result should be clamped to
20645bd8deadSopenharmony_ci    [0,1] or [-1,1], respectively, before updating the condition code and the
20655bd8deadSopenharmony_ci    destination variable.  If no clamping suffix is specified, unclamped
20665bd8deadSopenharmony_ci    results will be used for condition code updates (if any) and destination
20675bd8deadSopenharmony_ci    variable writes.  Clamping modifiers are not supported on instructions
20685bd8deadSopenharmony_ci    that do not produce floating-point results.
20695bd8deadSopenharmony_ci
20705bd8deadSopenharmony_ci    "NTC" (no type checking) disables data type checking on the instruction,
20715bd8deadSopenharmony_ci    and allows instructions to use operands or result variables whose data
20725bd8deadSopenharmony_ci    types are inconsistent with the expected data types of the instruction.
20735bd8deadSopenharmony_ci
20745bd8deadSopenharmony_ci    "S24", "U24", and "HI" are special modifiers that are allowed only for the
20755bd8deadSopenharmony_ci    MUL instruction, and are described in detail where MUL is documented.  No
20765bd8deadSopenharmony_ci    more than one such modifier may be provided for any instruction.
20775bd8deadSopenharmony_ci
20785bd8deadSopenharmony_ci    If an instruction supports data type modifiers, but none is provided, a
20795bd8deadSopenharmony_ci    default data type will be chosen based on the instruction, as specified in
20805bd8deadSopenharmony_ci    Table X.13 and the instruction set description (Section 2.X.8).  If
20815bd8deadSopenharmony_ci    condition code update or clamping modifiers are not specified, the
20825bd8deadSopenharmony_ci    corresponding operation will not be performed.
20835bd8deadSopenharmony_ci
20845bd8deadSopenharmony_ci    Additionally, each instruction name may have one or more suffixes,
20855bd8deadSopenharmony_ci    concatenated onto the base instruction name, that operate as instruction
20865bd8deadSopenharmony_ci    modifiers.  For conciseness, these suffixes are not spelled out in the
20875bd8deadSopenharmony_ci    grammar -- the base opcode name is used as a placeholder for the opcode
20885bd8deadSopenharmony_ci    and all of its possible suffixes.  Instruction suffixes are provided
20895bd8deadSopenharmony_ci    mainly for compatibility with prior GPU program instruction sets (e.g.,
20905bd8deadSopenharmony_ci    NV_vertex_program3, NV_fragment_program2, and predecessors).  The set of
20915bd8deadSopenharmony_ci    allowable suffixes, and their equivalent stand-alone modifiers, are listed
20925bd8deadSopenharmony_ci    in Table X.15.
20935bd8deadSopenharmony_ci
20945bd8deadSopenharmony_ci      Suffix  Modifier     Description
20955bd8deadSopenharmony_ci      ------  ----------   ---------------------------------------------------
20965bd8deadSopenharmony_ci      R       F            Floating-point operation, 32-bit precision
20975bd8deadSopenharmony_ci      H       F(*)         Floating-point operation, at least 16-bit precision
20985bd8deadSopenharmony_ci      C       CC0          Update condition code register zero
20995bd8deadSopenharmony_ci      C0      CC0          Update condition code register zero
21005bd8deadSopenharmony_ci      C1      CC1          Update condition code register one
21015bd8deadSopenharmony_ci      _SAT    SAT          Floating-point results clamped to [0,1]
21025bd8deadSopenharmony_ci      _SSAT   SSAT         Floating-point results clamped to [-1,1]
21035bd8deadSopenharmony_ci
21045bd8deadSopenharmony_ci      Table X.15,  Instruction Suffixes.
21055bd8deadSopenharmony_ci
21065bd8deadSopenharmony_ci    The "R" and "H" suffixes specify floating-point operations and are
21075bd8deadSopenharmony_ci    equivalent to the "F" data type modifier.  They additionally specify a
21085bd8deadSopenharmony_ci    minimum precision for the operations.  Instructions with an "R" precision
21095bd8deadSopenharmony_ci    modifier will be carried out at no less than IEEE single-precision
21105bd8deadSopenharmony_ci    floating-point (8 bits of exponent, 23 bits of mantissa).  Instructions
21115bd8deadSopenharmony_ci    with an "H" precision modifier will be carried out at no less than 16-bit
21125bd8deadSopenharmony_ci    floating-point precision (5 bits of exponent, 10 bits of mantissa).
21135bd8deadSopenharmony_ci
21145bd8deadSopenharmony_ci    An instruction may have multiple suffixes, but they must appear in order,
21155bd8deadSopenharmony_ci    with data type suffixes first, followed by condition code update suffixes,
21165bd8deadSopenharmony_ci    followed by clamping suffixes.  For example, "ADDR" carries out an add at
21175bd8deadSopenharmony_ci    32-bit precision.  "ADDH_SAT" carries out an add at 16-bit precision (or
21185bd8deadSopenharmony_ci    better) and clamps the results to [0,1].  "ADDRC1_SSAT" carries out an add
21195bd8deadSopenharmony_ci    at 32-bit floating-point precision, clamps the results to [-1,1], and
21205bd8deadSopenharmony_ci    updates condition code one based on the clamped result.
21215bd8deadSopenharmony_ci
21225bd8deadSopenharmony_ci
21235bd8deadSopenharmony_ci    Section 2.X.4.2, Program Operands
21245bd8deadSopenharmony_ci
21255bd8deadSopenharmony_ci    Most program instructions operate on one or more scalar or vector
21265bd8deadSopenharmony_ci    operands.  Each operand specifies an operand variable, which is either the
21275bd8deadSopenharmony_ci    name of a previously declared variable or an implicit variable declaration
21285bd8deadSopenharmony_ci    created by using a variable binding in the instruction.  Attribute,
21295bd8deadSopenharmony_ci    parameter, or parameter buffer variables can be declared implicitly by
21305bd8deadSopenharmony_ci    using a valid binding name in an operand.  Instruction operands are
21315bd8deadSopenharmony_ci    specified by the <instOperandV>, <instOperandS>, or <instOperandVNS>
21325bd8deadSopenharmony_ci    grammar rules.
21335bd8deadSopenharmony_ci
21345bd8deadSopenharmony_ci    If the operand variable is not an array, its contents are loaded directly.
21355bd8deadSopenharmony_ci    If the operand variable is an array, a single element of the array is
21365bd8deadSopenharmony_ci    loaded according to the <arrayMem> grammar rule.  The elements of an array
21375bd8deadSopenharmony_ci    are numbered from 0 to <n>-1, where <n> is the number of entries in the
21385bd8deadSopenharmony_ci    array.  Array members can be accessed using either absolute or relative
21395bd8deadSopenharmony_ci    addressing.
21405bd8deadSopenharmony_ci
21415bd8deadSopenharmony_ci    Absolute array addressing is used when the <arrayMemAbs> grammar rule is
21425bd8deadSopenharmony_ci    matched; the array member to load is specified by the matching integer.
21435bd8deadSopenharmony_ci    Out-of-bounds array absolute accesses are not allowed.  If the specified
21445bd8deadSopenharmony_ci    member number is greater than or equal to the size of the array, the
21455bd8deadSopenharmony_ci    program will fail to load.
21465bd8deadSopenharmony_ci
21475bd8deadSopenharmony_ci    Relative array addressing is used when the <arrayMemRel> grammar rule is
21485bd8deadSopenharmony_ci    matched.  This grammar rule allows the program to specify a scalar integer
21495bd8deadSopenharmony_ci    operand and an optional constant offset, according to the <arrayMemReg>
21505bd8deadSopenharmony_ci    and <arrayMemOffset> grammar rules.  When performing relative addressing,
21515bd8deadSopenharmony_ci    the GL evaluates the specified integer scalar operand (according to the
21525bd8deadSopenharmony_ci    rules specified in this section) and adds the constant offset.  The array
21535bd8deadSopenharmony_ci    member loaded is given by this sum.  The constant offset is considered
21545bd8deadSopenharmony_ci    zero if an offset is omitted.  If the sum is negative or exceeds the size
21555bd8deadSopenharmony_ci    of the array, the results of the access are undefined, but may not lead to
21565bd8deadSopenharmony_ci    program or GL termination.  The set of constant offsets supported for
21575bd8deadSopenharmony_ci    relative addressing is limited to values in the range [0,<n>-1], where <n>
21585bd8deadSopenharmony_ci    is the size of the array.  A program will fail to load if it specifies an
21595bd8deadSopenharmony_ci    offset outside that range.  If offsets outside that range are required,
21605bd8deadSopenharmony_ci    they can be applied by using an integer ADD instruction writing to a
21615bd8deadSopenharmony_ci    temporary variable.
21625bd8deadSopenharmony_ci
21635bd8deadSopenharmony_ci    After the operand is loaded, its components can be rearranged according to
21645bd8deadSopenharmony_ci    the <swizzleSuffix> grammar rule, or it can be converted to a scalar
21655bd8deadSopenharmony_ci    operand according to the <scalarSuffix> grammar rule.
21665bd8deadSopenharmony_ci
21675bd8deadSopenharmony_ci    The <swizzleSuffix> grammar rule rearranges the components of a loaded
21685bd8deadSopenharmony_ci    vector to produce another vector.  If the <swizzleSuffix> rule matches the
21695bd8deadSopenharmony_ci    <xyzwSwizzle> or <rgbaSwizzle> grammar rule, a pattern of the form ".????"
21705bd8deadSopenharmony_ci    is used, where each question mark is replaced with one of "x", "y", "z",
21715bd8deadSopenharmony_ci    "w", "r", "g", "b", or a".  For such patterns, the x, y, z, and w
21725bd8deadSopenharmony_ci    components of the operand are taken from the vector components named by
21735bd8deadSopenharmony_ci    the first, second, third, and fourth character of the pattern,
21745bd8deadSopenharmony_ci    respectively.  Swizzle components of "r", "g", "b", and "a" are equivalent
21755bd8deadSopenharmony_ci    to "x", "y", "z", and "w", respectively.  For example, if the swizzle
21765bd8deadSopenharmony_ci    suffix is ".yzzx" or ".gbbr" and the specified source contains {2,8,9,0},
21775bd8deadSopenharmony_ci    the result is the vector {8,9,9,2}.  If the <swizzleSuffix> matches the
21785bd8deadSopenharmony_ci    <component> grammar rule, a pattern of the form ".?" is used.  For this
21795bd8deadSopenharmony_ci    pattern, all four components of the operand are taken from the single
21805bd8deadSopenharmony_ci    component identified by the pattern.  If the swizzle suffix is omitted,
21815bd8deadSopenharmony_ci    components are not rearranged and swizzling has no effect, as though
21825bd8deadSopenharmony_ci    ".xyzw" were specified.
21835bd8deadSopenharmony_ci
21845bd8deadSopenharmony_ci    The swizzle suffix rules do not allow mixing "x", "y", "z", or "w"
21855bd8deadSopenharmony_ci    selectors with "r", "g", "b", or "a" selectors.  A program will fail to
21865bd8deadSopenharmony_ci    load if it contains a swizzle suffix with selectors from both of these
21875bd8deadSopenharmony_ci    sets.
21885bd8deadSopenharmony_ci
21895bd8deadSopenharmony_ci    The <scalarSuffix> grammar rule converts a vector to a scalar by selecting
21905bd8deadSopenharmony_ci    a single component.  The <scalarSuffix> rule is similar to the swizzle
21915bd8deadSopenharmony_ci    selector, except that only a single component is selected.  If the scalar
21925bd8deadSopenharmony_ci    suffix is ".y" and the specified source contains {2,8,9,0}, the value is
21935bd8deadSopenharmony_ci    the scalar value 8.
21945bd8deadSopenharmony_ci
21955bd8deadSopenharmony_ci    Next, a component-wise negate operation is performed on the operand if the
21965bd8deadSopenharmony_ci    <operandNeg> grammar rule matches "-".  Negation is not performed if the
21975bd8deadSopenharmony_ci    operand has no sign prefix, or is prefixed with "+".  For unsigned integer
21985bd8deadSopenharmony_ci    operands, the negate operand performs a two's complement operation.
21995bd8deadSopenharmony_ci
22005bd8deadSopenharmony_ci    Next, a component-wise absolute value operation is performed on the
22015bd8deadSopenharmony_ci    operand if the <instOperandAbsV> or <instOperandAbsS> grammar rule is
22025bd8deadSopenharmony_ci    matched, by surrounding the operand with two "|" characters.  The result
22035bd8deadSopenharmony_ci    is optionally negated if the <operandAbsNeg> grammar rule matches "-".
22045bd8deadSopenharmony_ci    For unsigned integer operands, the absolute value operation has no effect.
22055bd8deadSopenharmony_ci
22065bd8deadSopenharmony_ci
22075bd8deadSopenharmony_ci    Section 2.X.4.3, Program Destination Variable Update
22085bd8deadSopenharmony_ci
22095bd8deadSopenharmony_ci    Most program instructions perform computations that produce a result,
22105bd8deadSopenharmony_ci    which will be written to a variable.  Each instruction that computes a
22115bd8deadSopenharmony_ci    result specifies a destination variable, which is either the name of a
22125bd8deadSopenharmony_ci    previously declared variable or an implicit variable declaration created
22135bd8deadSopenharmony_ci    by using a variable binding in the instruction.  Result variables can be
22145bd8deadSopenharmony_ci    declared implicitly by using a valid program result binding name in the
22155bd8deadSopenharmony_ci    result portion of the instruction.  Instruction results are specified
22165bd8deadSopenharmony_ci    according to the <instResult> grammar rule.
22175bd8deadSopenharmony_ci
22185bd8deadSopenharmony_ci    The destination variable may be a single member of an array.  In this
22195bd8deadSopenharmony_ci    case, a single array member is specified using the <arrayMem> grammar
22205bd8deadSopenharmony_ci    rule, and the array member to update is computed in the exact same manner
22215bd8deadSopenharmony_ci    as done for operand loads.  If the array member is computed at run time,
22225bd8deadSopenharmony_ci    and is negative or greater than or equal to the size of the array, the
22235bd8deadSopenharmony_ci    results of the destination variable update are undefined and could result
22245bd8deadSopenharmony_ci    in overwriting other program variables.
22255bd8deadSopenharmony_ci
22265bd8deadSopenharmony_ci    The results of the operation may be obtained at a different precision than
22275bd8deadSopenharmony_ci    that used to store the destination variable.  If so, the results are
22285bd8deadSopenharmony_ci    converted to match the size of the destination variable.  For
22295bd8deadSopenharmony_ci    floating-point values, the results are rounded to the nearest
22305bd8deadSopenharmony_ci    floating-point value that can be represented in the destination variable.
22315bd8deadSopenharmony_ci    If a result component is larger in magnitude than the largest
22325bd8deadSopenharmony_ci    representable floating-point value in the data type of the destination
22335bd8deadSopenharmony_ci    variable, an infinity encoding (+/-INF) is used.  Signed or unsigned
22345bd8deadSopenharmony_ci    integer values are sign-extended or zero-extended, respectively, if the
22355bd8deadSopenharmony_ci    destination variable has more bits than the result, and have their most
22365bd8deadSopenharmony_ci    significant bits discarded if the destination variable has fewer bits.
22375bd8deadSopenharmony_ci
22385bd8deadSopenharmony_ci    Writes to individual components of a vector destination variable can be
22395bd8deadSopenharmony_ci    controlled at compile time by individual component write masks specified
22405bd8deadSopenharmony_ci    in the instruction.  The component write mask is specified by the
22415bd8deadSopenharmony_ci    <optWriteMask> grammar rule, and is a string of up to four characters,
22425bd8deadSopenharmony_ci    naming the components to enable for writing.  If no write mask is
22435bd8deadSopenharmony_ci    specified, all components are enabled for writing.  The characters "x",
22445bd8deadSopenharmony_ci    "y", "z", and "w" match the x, y, z, and w components respectively.  For
22455bd8deadSopenharmony_ci    example, a write mask mask of ".xzw" indicates that the x, z, and w
22465bd8deadSopenharmony_ci    components should be enabled for writing but the y component should not be
22475bd8deadSopenharmony_ci    written.  The grammar requires that the destination register mask
22485bd8deadSopenharmony_ci    components must be listed in "xyzw" order.  Additionally, write mask
22495bd8deadSopenharmony_ci    components of "r", "g", "b", and "a" are equivalent to "x", "y", "z", and
22505bd8deadSopenharmony_ci    "w", respectively.  The grammar does not allow mixing "x", "y", "z", or
22515bd8deadSopenharmony_ci    "w" components with "r", "g", "b", and "a" ones.
22525bd8deadSopenharmony_ci
22535bd8deadSopenharmony_ci    Writes to individual components of a vector destination variable, or to a
22545bd8deadSopenharmony_ci    scalar destination variable, can also be controlled at run time using
22555bd8deadSopenharmony_ci    condition code write masks.  The condition code write mask is specified by
22565bd8deadSopenharmony_ci    the <ccMask> grammar rule.  If a mask is specified, a condition code
22575bd8deadSopenharmony_ci    variable is loaded according to the <ccMaskRule> grammar rule and tested
22585bd8deadSopenharmony_ci    as described in Table X.16 to produce a four-component vector of TRUE/FALSE
22595bd8deadSopenharmony_ci    values.
22605bd8deadSopenharmony_ci
22615bd8deadSopenharmony_ci         mask rule         test name                condition
22625bd8deadSopenharmony_ci         ---------------   ----------------------   -----------------
22635bd8deadSopenharmony_ci         EQ,  EQ0,  EQ1    equal                    !SF && ZF
22645bd8deadSopenharmony_ci         GE,  GE0,  GE1    greater than or equal    !(SF ^ OF)
22655bd8deadSopenharmony_ci         GT,  GT0,  GT1    greater than             (!SF ^ OF) && !ZF
22665bd8deadSopenharmony_ci         LE,  LE0,  LE1    less than or equal       SF ^ (ZF || OF)
22675bd8deadSopenharmony_ci         LT,  LT0,  LT1    less than                (SF && !ZF) ^ OF
22685bd8deadSopenharmony_ci         NE,  NE0,  NE1    not equal                SF || !ZF
22695bd8deadSopenharmony_ci         FL,  FL0,  FL1    false                    always false
22705bd8deadSopenharmony_ci         TR,  TR0,  TR1    true                     always true
22715bd8deadSopenharmony_ci
22725bd8deadSopenharmony_ci         NAN, NAN0, NAN1   not a number             SF && ZF
22735bd8deadSopenharmony_ci         LEG, LEG0, LEG1   less, equal, or greater  !SF || !ZF
22745bd8deadSopenharmony_ci                             (anything but a NaN)
22755bd8deadSopenharmony_ci
22765bd8deadSopenharmony_ci         CF,  CF0,  CF1    carry flag               CF
22775bd8deadSopenharmony_ci         NCF, NCF0, NCF1   no carry flag            !CF
22785bd8deadSopenharmony_ci         OF,  OF0,  OF1    overflow flag            OF
22795bd8deadSopenharmony_ci         NOF, NOF0, NOF1   no overflow flag         !OF
22805bd8deadSopenharmony_ci         SF,  SF0,  SF1    sign flag                SF
22815bd8deadSopenharmony_ci         NSF, NSF0, NSF1   no sign flag             !SF
22825bd8deadSopenharmony_ci         AB,  AB0,  AB1    above                    CF && !ZF
22835bd8deadSopenharmony_ci         BLE, BLE0, BLE1   below or equal           !CF || ZF
22845bd8deadSopenharmony_ci       
22855bd8deadSopenharmony_ci      Table X.16, Condition Code Tests.  The allowed rules are specified in
22865bd8deadSopenharmony_ci      the "mask rule" column.  If "0" or "1" is appended to the rule name
22875bd8deadSopenharmony_ci      (e.g., "EQ1"), the corresponding condition code register (CC1 in this
22885bd8deadSopenharmony_ci      example) is loaded, otherwise CC0 is loaded.  After loading, each
22895bd8deadSopenharmony_ci      component is tested, using the expression listed in the "condition"
22905bd8deadSopenharmony_ci      column.
22915bd8deadSopenharmony_ci
22925bd8deadSopenharmony_ci    After the condition code tests are performed, the four-component result
22935bd8deadSopenharmony_ci    can be swizzled according to the <swizzleSuffix> grammar rule.  Individual
22945bd8deadSopenharmony_ci    components of the destination variable are written only if the
22955bd8deadSopenharmony_ci    corresponding component of the swizzled condition code test result is
22965bd8deadSopenharmony_ci    TRUE.  If both a (compile-time) component write mask and a condition code
22975bd8deadSopenharmony_ci    write mask are specified, destination variable components are written only
22985bd8deadSopenharmony_ci    if the corresponding component is enabled in both masks.
22995bd8deadSopenharmony_ci
23005bd8deadSopenharmony_ci    A program instruction can also optionally update one of the two condition
23015bd8deadSopenharmony_ci    code registers if the "CC", "CC0", or "CC1" instruction modifier are
23025bd8deadSopenharmony_ci    specified.  These instruction modifiers update condition code register
23035bd8deadSopenharmony_ci    CC0, CC0, or CC1, respectively.  The instructions "ADD.CC" or "ADD.CC0"
23045bd8deadSopenharmony_ci    will perform an add and update condition code zero, "ADD.CC1" will add and
23055bd8deadSopenharmony_ci    update condition code one, and "ADD" will simply perform the add without a
23065bd8deadSopenharmony_ci    condition code update.  The components of the selected condition code
23075bd8deadSopenharmony_ci    register are updated if and only if the corresponding component of the
23085bd8deadSopenharmony_ci    destination variable are enabled by both write masks.  For the purposes of
23095bd8deadSopenharmony_ci    condition code update, a scalar destination variable is treated as a
23105bd8deadSopenharmony_ci    vector where the scalar result is written to "x" (if enabled in the write
23115bd8deadSopenharmony_ci    mask), and writes to the "y", "z", and "w" components are disabled.
23125bd8deadSopenharmony_ci
23135bd8deadSopenharmony_ci    When condition code components are written, the condition code flags are
23145bd8deadSopenharmony_ci    updated based on the corresponding component of the result.  If a
23155bd8deadSopenharmony_ci    component of the destination register is not enabled for writes, the
23165bd8deadSopenharmony_ci    corresponding condition code component is also unchanged.
23175bd8deadSopenharmony_ci
23185bd8deadSopenharmony_ci    For floating-point results, the sign flag (SF) is set if the result is
23195bd8deadSopenharmony_ci    less than zero or is a NaN (not a number) value.  The zero flag (ZF) is
23205bd8deadSopenharmony_ci    set if the result is equal to zero or is a NaN.
23215bd8deadSopenharmony_ci
23225bd8deadSopenharmony_ci    For signed and unsigned integer results, the sign flag (SF) is set if the
23235bd8deadSopenharmony_ci    most significant bit of the value written to the result variable is set
23245bd8deadSopenharmony_ci    and the zero flag (ZF) is set if the result written is zero.  For
23255bd8deadSopenharmony_ci    instructions other than those performing an integer add or subtract (ADD,
23265bd8deadSopenharmony_ci    MAD, SAD, SUB), the overflow and carry flags (OF and CF) are cleared.
23275bd8deadSopenharmony_ci
23285bd8deadSopenharmony_ci    For integer add or subtract operations, the overflow and carry flags by
23295bd8deadSopenharmony_ci    doing both signed and unsigned adds/subtracts as follows:
23305bd8deadSopenharmony_ci
23315bd8deadSopenharmony_ci      The overflow flag (OF) is set by interpreting the two operands as signed
23325bd8deadSopenharmony_ci      integers and performing a signed add or subtract.  If the result is
23335bd8deadSopenharmony_ci      representable as a signed integer (i.e., doesn't overflow), the overflow
23345bd8deadSopenharmony_ci      flag is cleared; otherwise, it is set.
23355bd8deadSopenharmony_ci
23365bd8deadSopenharmony_ci      The carry flag (CF) is set by interpreting the two operands as unsigned
23375bd8deadSopenharmony_ci      integers and performing an unsigned add or subtract.  If the result of
23385bd8deadSopenharmony_ci      an add is representable as an unsigned integer (i.e., doesn't overflow),
23395bd8deadSopenharmony_ci      the carry flag is cleared; otherwise, it is set.  If the result of a
23405bd8deadSopenharmony_ci      subtract is greater than or equal to zero, the carry flag is set;
23415bd8deadSopenharmony_ci      otherwise, it is cleared.
23425bd8deadSopenharmony_ci
23435bd8deadSopenharmony_ci    For the purposes of condition code setting, negation modifiers turn add
23445bd8deadSopenharmony_ci    operations into subtracts and vice versa.  If the operation is equivalent
23455bd8deadSopenharmony_ci    to an add with both operands negated (-A-B), the carry and overflow flags
23465bd8deadSopenharmony_ci    are both undefined.
23475bd8deadSopenharmony_ci
23485bd8deadSopenharmony_ci
23495bd8deadSopenharmony_ci    Section 2.X.4.4, Program Texture Access
23505bd8deadSopenharmony_ci
23515bd8deadSopenharmony_ci    Certain program instructions may access texture images, as described in
23525bd8deadSopenharmony_ci    section 3.8.  The coordinates, level-of-detail, and partial derivatives
23535bd8deadSopenharmony_ci    used for performing the texture lookup are derived from values provided in
23545bd8deadSopenharmony_ci    the program as described in the various sub-sections of Section 2.X.8.
23555bd8deadSopenharmony_ci    These descriptions use the function
23565bd8deadSopenharmony_ci
23575bd8deadSopenharmony_ci      result_t_vec
23585bd8deadSopenharmony_ci        TextureSample(float_vec coord, float lod, float_vec ddx, 
23595bd8deadSopenharmony_ci                      float_vec ddy, int_vec offset);
23605bd8deadSopenharmony_ci
23615bd8deadSopenharmony_ci    which obtains a filtered texel value <tau> as described in Section 3.8.8
23625bd8deadSopenharmony_ci    and returns a 4-component vector (R,G,B,A) according to the format
23635bd8deadSopenharmony_ci    conversions specified in Table 3.21.  The result vector is interpreted as
23645bd8deadSopenharmony_ci    floating-point, signed integer, or unsigned integer, according to the data
23655bd8deadSopenharmony_ci    type modifier of the instruction.  If the internal format of the texture
23665bd8deadSopenharmony_ci    does not match the instruction's data type modifer, the results of the
23675bd8deadSopenharmony_ci    texture lookup are undefined.
23685bd8deadSopenharmony_ci
23695bd8deadSopenharmony_ci    (Note:  For unextended OpenGL 2.0, all supported texture internal formats
23705bd8deadSopenharmony_ci    store integer values but return floating-point results in the range [0,1]
23715bd8deadSopenharmony_ci    on a texture lookup.  The ARB_texture_float extension introduces
23725bd8deadSopenharmony_ci    floating-point internal format where components are both stored and
23735bd8deadSopenharmony_ci    returned as floating-point values.  The EXT_texture_integer extension
23745bd8deadSopenharmony_ci    introduces formats that both store and return either signed or unsigned
23755bd8deadSopenharmony_ci    integer values.)
23765bd8deadSopenharmony_ci
23775bd8deadSopenharmony_ci    <coord> is a four-component floating-point vector from which the (s,t,r)
23785bd8deadSopenharmony_ci    texture coordinates used for the texture access, the layer used for array
23795bd8deadSopenharmony_ci    textures, and the reference value used for depth comparisons (section
23805bd8deadSopenharmony_ci    3.8.14) are extracted according to Table X.17.  If the texture is a cube
23815bd8deadSopenharmony_ci    map, (s,t,r) is projected to one of the six cube faces to produce a new
23825bd8deadSopenharmony_ci    (s,t) vector according to Section 3.8.6.  For array textures, the layer
23835bd8deadSopenharmony_ci    used is derived by rounding the extracted floating-point component to the
23845bd8deadSopenharmony_ci    nearest integer and clamping the result to the range [0,<n>-1], where <n>
23855bd8deadSopenharmony_ci    is the number of layers in the texture.
23865bd8deadSopenharmony_ci
23875bd8deadSopenharmony_ci    <lod> specifies the level of detail parameter and replaces the value
23885bd8deadSopenharmony_ci    computed in equation 3.18.  <ddx> and <ddy> specify partial derivatives
23895bd8deadSopenharmony_ci    (ds/dx, dt/dx, dr/dx, ds/dy, dt/dy, and dr/dy) for the texture
23905bd8deadSopenharmony_ci    coordinates, and may be used to derive footprint shapes for anisotropic
23915bd8deadSopenharmony_ci    texture filtering.
23925bd8deadSopenharmony_ci
23935bd8deadSopenharmony_ci    <offset> is a constant 3-component signed integer vector specified
23945bd8deadSopenharmony_ci    according to the <texOffset> grammar rule, which is added to the computed
23955bd8deadSopenharmony_ci    <u>, <v>, and <w> texel locations prior to sampling.  One, two, or three
23965bd8deadSopenharmony_ci    components may be specified in the instruction; if fewer than three are
23975bd8deadSopenharmony_ci    specified, the remaining offset components are zero.  A limited range of
23985bd8deadSopenharmony_ci    offset values are supported; the minimum and maximum <texOffset> values
23995bd8deadSopenharmony_ci    are implementation-dependent and given by MIN_PROGRAM_TEXEL_OFFSET_EXT and
24005bd8deadSopenharmony_ci    MAX_PROGRAM_TEXEL_OFFSET_EXT, respectively.  A program will fail to load:
24015bd8deadSopenharmony_ci
24025bd8deadSopenharmony_ci      * if the texture target specified in the instruction is 1D, ARRAY1D,
24035bd8deadSopenharmony_ci        SHADOW1D, or SHADOWARRAY1D, and the second or third component of the
24045bd8deadSopenharmony_ci        offset vector is non-zero,
24055bd8deadSopenharmony_ci
24065bd8deadSopenharmony_ci      * if the texture target specified in the instruction is 2D, RECT,
24075bd8deadSopenharmony_ci        ARRAY2D, SHADOW2D, SHADOWRECT, or SHADOWARRAY2D, and the third
24085bd8deadSopenharmony_ci        component of the offset vector is non-zero,
24095bd8deadSopenharmony_ci
24105bd8deadSopenharmony_ci      * if the texture target is CUBE or SHADOWCUBE, and any component of the
24115bd8deadSopenharmony_ci        offset vector is non-zero -- texel offsets are not supported for cube
24125bd8deadSopenharmony_ci        map or buffer textures, or
24135bd8deadSopenharmony_ci
24145bd8deadSopenharmony_ci      * if any component of the offset vector is less than
24155bd8deadSopenharmony_ci        MIN_PROGRAM_TEXEL_OFFSET_EXT or greater than
24165bd8deadSopenharmony_ci        MAX_PROGRAM_TEXEL_OFFSET_EXT.
24175bd8deadSopenharmony_ci
24185bd8deadSopenharmony_ci    (NOTE:  Texel offsets are a new feature provided by this extension and are
24195bd8deadSopenharmony_ci    described in more detail in edits to Section 3.8 below.)
24205bd8deadSopenharmony_ci
24215bd8deadSopenharmony_ci    The texture used by TextureSample() is one of the textures bound to the
24225bd8deadSopenharmony_ci    texture image unit whose number is specified in the instruction according
24235bd8deadSopenharmony_ci    to the <texImageUnit> grammar rule.  The texture target accessed is
24245bd8deadSopenharmony_ci    specified according to the <texTarget> grammar rule and Table X.17.
24255bd8deadSopenharmony_ci    Fixed-function texture enables are always ignored when determining the
24265bd8deadSopenharmony_ci    texture to access in a program.
24275bd8deadSopenharmony_ci
24285bd8deadSopenharmony_ci                                                     coordinates used
24295bd8deadSopenharmony_ci      texTarget          Texture Type               s t r  layer  shadow
24305bd8deadSopenharmony_ci      ----------------   ---------------------      -----  -----  ------
24315bd8deadSopenharmony_ci      1D                 TEXTURE_1D                 x - -    -      -
24325bd8deadSopenharmony_ci      2D                 TEXTURE_2D                 x y -    -      -
24335bd8deadSopenharmony_ci      3D                 TEXTURE_3D                 x y z    -      -
24345bd8deadSopenharmony_ci      CUBE               TEXTURE_CUBE_MAP           x y z    -      -
24355bd8deadSopenharmony_ci      RECT               TEXTURE_RECTANGLE_ARB      x y -    -      -
24365bd8deadSopenharmony_ci      ARRAY1D            TEXTURE_1D_ARRAY_EXT       x - -    y      -
24375bd8deadSopenharmony_ci      ARRAY2D            TEXTURE_2D_ARRAY_EXT       x y -    z      -
24385bd8deadSopenharmony_ci      SHADOW1D           TEXTURE_1D                 x - -    -      z
24395bd8deadSopenharmony_ci      SHADOW2D           TEXTURE_2D                 x y -    -      z
24405bd8deadSopenharmony_ci      SHADOWRECT         TEXTURE_RECTANGLE_ARB      x y -    -      z
24415bd8deadSopenharmony_ci      SHADOWCUBE         TEXTURE_CUBE_MAP           x y z    -      w
24425bd8deadSopenharmony_ci      SHADOWARRAY1D      TEXTURE_1D_ARRAY_EXT       x - -    y      z
24435bd8deadSopenharmony_ci      SHADOWARRAY2D      TEXTURE_2D_ARRAY_EXT       x y -    z      w
24445bd8deadSopenharmony_ci      BUFFER             TEXTURE_BUFFER_EXT           <not supported>
24455bd8deadSopenharmony_ci
24465bd8deadSopenharmony_ci      Table X.17:  Texture types accessed for each of the <texTarget>, and
24475bd8deadSopenharmony_ci      coordinate mappings.  The "SHADOW" and "ARRAY" targets are special
24485bd8deadSopenharmony_ci      pseudo-targets described below.  The "coordinates used" column indicate
24495bd8deadSopenharmony_ci      the input values used for each coordinate of the texture lookup, the
24505bd8deadSopenharmony_ci      layer selector for array textures, and the reference value for texture
24515bd8deadSopenharmony_ci      comparisons.  Buffer textures are not supported by normal texture lookup
24525bd8deadSopenharmony_ci      functions, but are supported by TXF and TXQ, described below.
24535bd8deadSopenharmony_ci
24545bd8deadSopenharmony_ci    Texture targets with "SHADOW" are used to access textures with a
24555bd8deadSopenharmony_ci    DEPTH_COMPONENT base internal format using depth comparisons (Section
24565bd8deadSopenharmony_ci    3.8.14).  Results of a texture access are undefined:
24575bd8deadSopenharmony_ci
24585bd8deadSopenharmony_ci      * if a "SHADOW" target is used, and the corresponding texture has a base
24595bd8deadSopenharmony_ci        internal format other than DEPTH_COMPONENT or a TEXTURE_COMPARE_MODE
24605bd8deadSopenharmony_ci        of NONE, or
24615bd8deadSopenharmony_ci
24625bd8deadSopenharmony_ci      * if a non-"SHADOW" target is used, and the corresponding texture has a
24635bd8deadSopenharmony_ci        base internal format of DEPTH_COMPONENT and a TEXTURE_COMPARE_MODE
24645bd8deadSopenharmony_ci        other than NONE.
24655bd8deadSopenharmony_ci
24665bd8deadSopenharmony_ci    If the texture being accessed is not complete (or cube complete for
24675bd8deadSopenharmony_ci    cubemap textures), no texture access is performed and the result is
24685bd8deadSopenharmony_ci    undefined.
24695bd8deadSopenharmony_ci
24705bd8deadSopenharmony_ci    A program will fail to load if it attempts to sample from multiple texture
24715bd8deadSopenharmony_ci    targets (including the SHADOW pseudo-targets) on the same texture image
24725bd8deadSopenharmony_ci    unit.  For example, a program containing any two the following
24735bd8deadSopenharmony_ci    instructions will fail to load:
24745bd8deadSopenharmony_ci
24755bd8deadSopenharmony_ci      TEX out, coord, texture[0], 1D;
24765bd8deadSopenharmony_ci      TEX out, coord, texture[0], 2D;
24775bd8deadSopenharmony_ci      TEX out, coord, texture[0], ARRAY2D;
24785bd8deadSopenharmony_ci      TEX out, coord, texture[0], SHADOW2D;
24795bd8deadSopenharmony_ci      TEX out, coord, texture[0], 3D;
24805bd8deadSopenharmony_ci
24815bd8deadSopenharmony_ci    Additionally, multiple texture targets for a single texture image unit may
24825bd8deadSopenharmony_ci    not be used at the same time by the GL.  The error INVALID_OPERATION is
24835bd8deadSopenharmony_ci    generated by Begin, RasterPos, or any command that performs an implicit
24845bd8deadSopenharmony_ci    Begin if an enabled program accesses one texture target for a texture unit
24855bd8deadSopenharmony_ci    while another enabled program or fixed-function fragment processing
24865bd8deadSopenharmony_ci    accesses a different texture target for the same texture image unit.
24875bd8deadSopenharmony_ci
24885bd8deadSopenharmony_ci    Some texture instructions use standard methods to compute partial
24895bd8deadSopenharmony_ci    derivatives and/or the level-of-detail used to perform texture accesses.
24905bd8deadSopenharmony_ci    For fragment programs, the functions
24915bd8deadSopenharmony_ci
24925bd8deadSopenharmony_ci      float_vec ComputePartialsX(float_vec coord);
24935bd8deadSopenharmony_ci      float_vec ComputePartialsY(float_vec coord);
24945bd8deadSopenharmony_ci
24955bd8deadSopenharmony_ci    compute approximate component-wise partial derivatives of the
24965bd8deadSopenharmony_ci    floating-point vector <coord> relative to the X and Y coordinates,
24975bd8deadSopenharmony_ci    respectively.  For vertex and geometry programs, these functions always
24985bd8deadSopenharmony_ci    return (0,0,0,0).  The function
24995bd8deadSopenharmony_ci
25005bd8deadSopenharmony_ci      float ComputeLOD(float_vec ddx, float_vec ddy);
25015bd8deadSopenharmony_ci
25025bd8deadSopenharmony_ci    maps partial derivative vectors <ddx> and <ddy> to ds/dx, dt/dx, dr/dx,
25035bd8deadSopenharmony_ci    ds/dy, dt/dy, and dr/dy and computes lambda_base(x,y) according to
25045bd8deadSopenharmony_ci    equation 3.18.
25055bd8deadSopenharmony_ci
25065bd8deadSopenharmony_ci    The TXF instruction provides the ability to extract a single texel from a
25075bd8deadSopenharmony_ci    specified texture image using the function
25085bd8deadSopenharmony_ci    
25095bd8deadSopenharmony_ci      result_t_vec TexelFetch(int_vec coord, int_vec offset);
25105bd8deadSopenharmony_ci
25115bd8deadSopenharmony_ci    The extracted texel is converted to an (R,G,B,A) vector according to Table
25125bd8deadSopenharmony_ci    3.21.  The result vector is interpreted as floating-point, signed integer,
25135bd8deadSopenharmony_ci    or unsigned integer, according to the data type modifier of the
25145bd8deadSopenharmony_ci    instruction.  If the internal format of the texture is not compatible with
25155bd8deadSopenharmony_ci    the instruction's data type modifer, the extracted texel value is
25165bd8deadSopenharmony_ci    undefined.
25175bd8deadSopenharmony_ci
25185bd8deadSopenharmony_ci    <coord> is a four-component signed integer vector used to identify the
25195bd8deadSopenharmony_ci    single texel accessed.  The (i,j,k) coordinates of the texel and the layer
25205bd8deadSopenharmony_ci    used for array textures are extracted according to Table X.18.  The level
25215bd8deadSopenharmony_ci    of detail accessed is obtained by adding the w component of <coord> to the
25225bd8deadSopenharmony_ci    base level (level_base).  <offset> is a constant 3-component signed
25235bd8deadSopenharmony_ci    integer vector added to the texel coordinates prior to the texel fetch as
25245bd8deadSopenharmony_ci    described above.  In addition to the restrictions described above,
25255bd8deadSopenharmony_ci    non-zero offset components are also not supported for BUFFER targets.
25265bd8deadSopenharmony_ci
25275bd8deadSopenharmony_ci    The texture used by TexelFetch() is specified by the image unit and target
25285bd8deadSopenharmony_ci    parameters provided in the instruction, as for TextureSample() above.
25295bd8deadSopenharmony_ci    Single texel fetches can not perform depth comparisons or access cubemaps.
25305bd8deadSopenharmony_ci    If a program contains a TXF instruction specifying one of the "SHADOW" or
25315bd8deadSopenharmony_ci    "CUBE" targets, it will fail to load.
25325bd8deadSopenharmony_ci
25335bd8deadSopenharmony_ci                                      coordinates used
25345bd8deadSopenharmony_ci      texTarget          supported      i j k  layer  lod
25355bd8deadSopenharmony_ci      ----------------   ---------      -----  -----  ---
25365bd8deadSopenharmony_ci      1D                    yes         x - -    -     w
25375bd8deadSopenharmony_ci      2D                    yes         x y -    -     w
25385bd8deadSopenharmony_ci      3D                    yes         x y z    -     w
25395bd8deadSopenharmony_ci      CUBE                  no          - - -    -     -
25405bd8deadSopenharmony_ci      RECT                  yes         x y -    -     w
25415bd8deadSopenharmony_ci      ARRAY1D               yes         x - -    y     w
25425bd8deadSopenharmony_ci      ARRAY2D               yes         x y -    z     w
25435bd8deadSopenharmony_ci      SHADOW1D              no          - - -    -     -
25445bd8deadSopenharmony_ci      SHADOW2D              no          - - -    -     -
25455bd8deadSopenharmony_ci      SHADOWRECT            no          - - -    -     -
25465bd8deadSopenharmony_ci      SHADOWCUBE            no          - - -    -     -
25475bd8deadSopenharmony_ci      SHADOWARRAY1D         no          - - -    -     -
25485bd8deadSopenharmony_ci      SHADOWARRAY2D         no          - - -    -     -
25495bd8deadSopenharmony_ci      BUFFER                yes         x - -    -     -
25505bd8deadSopenharmony_ci
25515bd8deadSopenharmony_ci      Table X.18, Mappings of texel fetch coordinates to texel location.
25525bd8deadSopenharmony_ci
25535bd8deadSopenharmony_ci    Single-texel fetches do not support LOD clamping or any texture wrap mode,
25545bd8deadSopenharmony_ci    and require a mipmapped minification filter to access any level of detail
25555bd8deadSopenharmony_ci    other than the base level.  The results of the texel fetch are undefined:
25565bd8deadSopenharmony_ci
25575bd8deadSopenharmony_ci      * if the computed LOD is less than the texture's base level (level_base)
25585bd8deadSopenharmony_ci        or greater than the maximum level (level_max),
25595bd8deadSopenharmony_ci
25605bd8deadSopenharmony_ci      * if the computed LOD is not the texture's base level and the texture's
25615bd8deadSopenharmony_ci        minification filter is NEAREST or LINEAR,
25625bd8deadSopenharmony_ci
25635bd8deadSopenharmony_ci      * if the layer specified for array textures is negative or greater than
25645bd8deadSopenharmony_ci        the number of layers in the array texture,
25655bd8deadSopenharmony_ci
25665bd8deadSopenharmony_ci      * if the texel at (i,j,k) coordinates refer to a border texel outside
25675bd8deadSopenharmony_ci        the defined extents of the specified LOD, where
25685bd8deadSopenharmony_ci
25695bd8deadSopenharmony_ci         i < -b_s, j < -b_s, k < -b_s, 
25705bd8deadSopenharmony_ci         i >= w_s - b_s, j >= h_s - b_s, or k >= d_s - b_s, 
25715bd8deadSopenharmony_ci
25725bd8deadSopenharmony_ci        where the size parameters (w_s, h_s, d_s, and b_s) refer to the width,
25735bd8deadSopenharmony_ci        height, depth, and border size of the image, as in equations 3.15,
25745bd8deadSopenharmony_ci        3.16, and 3.17, or
25755bd8deadSopenharmony_ci
25765bd8deadSopenharmony_ci      * if the texture being accessed is not complete (or cube complete for
25775bd8deadSopenharmony_ci        cubemaps).
25785bd8deadSopenharmony_ci
25795bd8deadSopenharmony_ci
25805bd8deadSopenharmony_ci    Section 2.X.5, Program Flow Control
25815bd8deadSopenharmony_ci
25825bd8deadSopenharmony_ci    In addition to basic arithmetic, logical, and texture instructions, a
25835bd8deadSopenharmony_ci    number of flow control instructions are provided, which are described in
25845bd8deadSopenharmony_ci    detail in Section 2.X.8.  Programs can contain several types of
25855bd8deadSopenharmony_ci    instruction blocks:  IF/ELSE/ENDIF blocks, REP/ENDREP blocks, and
25865bd8deadSopenharmony_ci    subroutine blocks.  IF/ELSE/ENDIF blocks are a set of instructions
25875bd8deadSopenharmony_ci    beginning with an "IF" instruction, ending with an "ENDIF" instruction,
25885bd8deadSopenharmony_ci    and possibly containing an optional "ELSE" instruction.  REP/ENDREP blocks
25895bd8deadSopenharmony_ci    are a set of instructions beginning with a "REP" instruction and ending
25905bd8deadSopenharmony_ci    with an "ENDREP" instruction.  Subroutine blocks begin with an instruction
25915bd8deadSopenharmony_ci    label identifying the name of the subroutine and ending just before the
25925bd8deadSopenharmony_ci    next instruction label or the end of the program.  Examples include the
25935bd8deadSopenharmony_ci    following:
25945bd8deadSopenharmony_ci
25955bd8deadSopenharmony_ci        MOVC CC, R0;
25965bd8deadSopenharmony_ci        IF GT.x;
25975bd8deadSopenharmony_ci          MOV R0, R1;     # executes if R0.x > 0
25985bd8deadSopenharmony_ci        ELSE;
25995bd8deadSopenharmony_ci          MOV R0, R2;     # executes if R0.x <= 0
26005bd8deadSopenharmony_ci        ENDIF;
26015bd8deadSopenharmony_ci
26025bd8deadSopenharmony_ci        REP repCount;
26035bd8deadSopenharmony_ci        ADD R0, R0, R1;
26045bd8deadSopenharmony_ci        ENDREP;
26055bd8deadSopenharmony_ci
26065bd8deadSopenharmony_ci      square:             # subroutine to compute R0^2
26075bd8deadSopenharmony_ci        MUL R0, R0, R0;
26085bd8deadSopenharmony_ci        RET;
26095bd8deadSopenharmony_ci      main:
26105bd8deadSopenharmony_ci        MOV R0, 9.0;
26115bd8deadSopenharmony_ci        CAL square;       # compute 9.0^2 in R0
26125bd8deadSopenharmony_ci
26135bd8deadSopenharmony_ci    IF/ELSE/ENDIF and REP/ENDREP blocks may be nested inside each other, and
26145bd8deadSopenharmony_ci    inside subroutines.  In all cases, each instruction block must be
26155bd8deadSopenharmony_ci    terminated with the appropriate instruction (ENDIF for IF, ENDREP for
26165bd8deadSopenharmony_ci    REP).  Nested instruction blocks must be wholly contained within a block
26175bd8deadSopenharmony_ci    -- if a REP instruction is found between an IF and ELSE instruction, the
26185bd8deadSopenharmony_ci    corresponding ENDREP must also be present between the IF and ELSE.
26195bd8deadSopenharmony_ci    Subroutines may not be nested inside IF/ELSE/ENDIF or REP/ENDREP blocks,
26205bd8deadSopenharmony_ci    or inside other subroutines.  A program will fail to load if any
26215bd8deadSopenharmony_ci    instruction block is terminated by an incorrect instruction, is not
26225bd8deadSopenharmony_ci    terminated before the block containing it, or contains an instruction
26235bd8deadSopenharmony_ci    label.
26245bd8deadSopenharmony_ci
26255bd8deadSopenharmony_ci    IF/ELSE/ENDIF blocks evaluate a condition to determine which instructions
26265bd8deadSopenharmony_ci    to execute.  If the condition is true, all instructions between the IF and
26275bd8deadSopenharmony_ci    ELSE are executed.  If the condition is false, all instructions between
26285bd8deadSopenharmony_ci    the ELSE and ENDIF are executed.  The ELSE instruction is optional.  If
26295bd8deadSopenharmony_ci    the ELSE is omitted, all instructions between the IF and ENDIF are
26305bd8deadSopenharmony_ci    executed if the condition is true, or skipped if the condition is false.
26315bd8deadSopenharmony_ci    A limited amount of nesting is supported -- a program will fail to load if
26325bd8deadSopenharmony_ci    an IF instruction is nested inside MAX_PROGRAM_IF_DEPTH_NV or more
26335bd8deadSopenharmony_ci    IF/ELSE/ENDIF blocks.
26345bd8deadSopenharmony_ci
26355bd8deadSopenharmony_ci    REP/ENDREP blocks are used to execute a sequence of instructions multiple
26365bd8deadSopenharmony_ci    times.  The REP instruction includes an optional scalar operand to specify
26375bd8deadSopenharmony_ci    a loop count indicating the number of times the block of instructions
26385bd8deadSopenharmony_ci    should be repeated.  If the loop count is omitted, the contents of a
26395bd8deadSopenharmony_ci    REP/ENDREP block will be repeated indefinitely until the loop is
26405bd8deadSopenharmony_ci    explicitly terminated.  A limited amount of nesting is supported -- a
26415bd8deadSopenharmony_ci    program will fail to load if a REP instruction is nested inside
26425bd8deadSopenharmony_ci    MAX_PROGRAM_LOOP_DEPTH_NV or more REP/ENDREP blocks.
26435bd8deadSopenharmony_ci
26445bd8deadSopenharmony_ci    Within a REP/ENDREP block, the CONT instruction can be used to terminate
26455bd8deadSopenharmony_ci    the current iteration of the loop by effectively jumping to the ENDREP
26465bd8deadSopenharmony_ci    instruction.  The BRK instruction can be used to terminate the entire loop
26475bd8deadSopenharmony_ci    by effectively jumping to the instruction immediately following the ENDREP
26485bd8deadSopenharmony_ci    instruction.  If CONT and BRK instructions are found inside multiply
26495bd8deadSopenharmony_ci    nested REP/ENDREP blocks, they apply to the innermost block.  A program
26505bd8deadSopenharmony_ci    will fail to load if it includes a CONT or BRK instruction that is not
26515bd8deadSopenharmony_ci    contained inside a REP/ENDREP block.
26525bd8deadSopenharmony_ci
26535bd8deadSopenharmony_ci    A REP/ENDREP block without a specified loop count can result in an
26545bd8deadSopenharmony_ci    infinite loop.  To prevent obvious infinite loops, a program will fail to
26555bd8deadSopenharmony_ci    load if it contains a REP/ENDREP block that contains neither a BRK
26565bd8deadSopenharmony_ci    instruction at the current nesting level or a RET instruction at any
26575bd8deadSopenharmony_ci    nesting level.
26585bd8deadSopenharmony_ci
26595bd8deadSopenharmony_ci    Subroutines are supported via the CAL and RET instructions.  A subroutine
26605bd8deadSopenharmony_ci    block is identified by an instruction, which can be any valid identifier
26615bd8deadSopenharmony_ci    according to the <instLabel> grammar rule.  The CAL instruction identifies
26625bd8deadSopenharmony_ci    a subroutine name to call according to the <instTarget> grammar rule.
26635bd8deadSopenharmony_ci    Instruction labels used in CAL instructions do not need to be defined in
26645bd8deadSopenharmony_ci    the program text that precedes the instruction, but a program will fail to
26655bd8deadSopenharmony_ci    load if it includes a CAL instruction that references an instruction label
26665bd8deadSopenharmony_ci    that is not defined anywhere in the program.  When a CAL instruction is
26675bd8deadSopenharmony_ci    executed, it transfers control to the instruction immediately following
26685bd8deadSopenharmony_ci    the specified instruction label.  Subsequent instructions in that
26695bd8deadSopenharmony_ci    subroutine are executed until a RET instruction is executed, or until
26705bd8deadSopenharmony_ci    program execution reaches another instruction label or the end of the
26715bd8deadSopenharmony_ci    program text.  After the subroutine finishes, execution continues with the
26725bd8deadSopenharmony_ci    instruction immediately following the CAL instruction.  When a RET
26735bd8deadSopenharmony_ci    instruction is issued, it will break out of any IF/ELSE/ENDIF or
26745bd8deadSopenharmony_ci    REP/ENDREP blocks that contain it.
26755bd8deadSopenharmony_ci
26765bd8deadSopenharmony_ci    Subroutines may call other subroutines before completing, up to an
26775bd8deadSopenharmony_ci    implementation-dependent maximum depth of MAX_PROGRAM_CALL_DEPTH_NV calls.
26785bd8deadSopenharmony_ci    Subroutines may call any subroutine in the program, including themselves,
26795bd8deadSopenharmony_ci    as long as the call depth limit is obeyed.  The results of issuing a CAL
26805bd8deadSopenharmony_ci    instruction while MAX_PROGRAM_CALL_DEPTH subroutines have not completed
26815bd8deadSopenharmony_ci    has undefined results, including possible program termination.
26825bd8deadSopenharmony_ci
26835bd8deadSopenharmony_ci    Several flow control instructions include condition code tests.  The IF
26845bd8deadSopenharmony_ci    instruction requires a condition test to determine what instructions are
26855bd8deadSopenharmony_ci    executed.  The CONT, BRK, CAL, and RET instructions have an optional
26865bd8deadSopenharmony_ci    condition code test; if the test fails, the instructions are not executed.
26875bd8deadSopenharmony_ci    Condition code tests are specified by the <ccTest> grammar rule.  The test
26885bd8deadSopenharmony_ci    is evaluated like the condition code write mask (section 2.X.4.3), and
26895bd8deadSopenharmony_ci    passes if and only if any of the four components passes.
26905bd8deadSopenharmony_ci
26915bd8deadSopenharmony_ci    If an instruction label named "main" is specified, GPU program execution
26925bd8deadSopenharmony_ci    begins with the instruction immediately following that label.  Otherwise,
26935bd8deadSopenharmony_ci    it begins with the first instruction of the program.  Instructions are
26945bd8deadSopenharmony_ci    executed in sequence until either a RET instruction is issued in the main
26955bd8deadSopenharmony_ci    subroutine or the end of the program text is reached.
26965bd8deadSopenharmony_ci
26975bd8deadSopenharmony_ci
26985bd8deadSopenharmony_ci    Section 2.X.6, Program Options
26995bd8deadSopenharmony_ci
27005bd8deadSopenharmony_ci    Programs may specify a number of options to indicate that one or more
27015bd8deadSopenharmony_ci    extended language features are used by the program.  All program options
27025bd8deadSopenharmony_ci    used by the program must be declared at the beginning of the program
27035bd8deadSopenharmony_ci    string.  Each program option specified in a program string will modify the
27045bd8deadSopenharmony_ci    syntactic or semantic rules used to interpet the program and the execution
27055bd8deadSopenharmony_ci    environment used to execute the program.  Features in program options
27065bd8deadSopenharmony_ci    not declared by the program are ignored, even if the option is otherwise
27075bd8deadSopenharmony_ci    supported by the GL.  Each option declaration consists of two tokens: the
27085bd8deadSopenharmony_ci    keyword "OPTION" and an identifier.
27095bd8deadSopenharmony_ci
27105bd8deadSopenharmony_ci    The set of available options depends on the program type, and is
27115bd8deadSopenharmony_ci    enumerated in the specifications for each program type.  Some program
27125bd8deadSopenharmony_ci    types may not provide any options.
27135bd8deadSopenharmony_ci
27145bd8deadSopenharmony_ci
27155bd8deadSopenharmony_ci    Section 2.X.7, Program Declarations
27165bd8deadSopenharmony_ci
27175bd8deadSopenharmony_ci    Programs may include a number of declaration statements to specify
27185bd8deadSopenharmony_ci    characteristics of the program.  Each declaration statement is followed by
27195bd8deadSopenharmony_ci    one or more arguments, separated by commas.
27205bd8deadSopenharmony_ci
27215bd8deadSopenharmony_ci    The set of available declarations depends on the program type, and is
27225bd8deadSopenharmony_ci    enumerated in the specifications for each program type.  Some program
27235bd8deadSopenharmony_ci    types may not provide declarations.
27245bd8deadSopenharmony_ci
27255bd8deadSopenharmony_ci
27265bd8deadSopenharmony_ci    Section 2.X.8, Program Instruction Set
27275bd8deadSopenharmony_ci
27285bd8deadSopenharmony_ci    The following sections enumerate the set of instructions supported for GPU
27295bd8deadSopenharmony_ci    programs.  
27305bd8deadSopenharmony_ci
27315bd8deadSopenharmony_ci    Some instructions allow the use of one of the three basic data type
27325bd8deadSopenharmony_ci    modifiers (floating point, signed integer, and unsigned integer).  Unless
27335bd8deadSopenharmony_ci    otherwise mentioned:
27345bd8deadSopenharmony_ci
27355bd8deadSopenharmony_ci      * the result and all of the operands will be interpreted according to
27365bd8deadSopenharmony_ci        the specified data type, and
27375bd8deadSopenharmony_ci
27385bd8deadSopenharmony_ci      * if no data type modifier is specified, the instruction will operate as
27395bd8deadSopenharmony_ci        though a floating-point modifier ("F") were specified.
27405bd8deadSopenharmony_ci
27415bd8deadSopenharmony_ci    Some instructions will override one or both of these rules.
27425bd8deadSopenharmony_ci
27435bd8deadSopenharmony_ci
27445bd8deadSopenharmony_ci    Section 2.X.8.Z, ABS:  Absolute Value
27455bd8deadSopenharmony_ci
27465bd8deadSopenharmony_ci    The ABS instruction performs a component-wise absolute value operation on
27475bd8deadSopenharmony_ci    the single operand to yield a result vector.
27485bd8deadSopenharmony_ci
27495bd8deadSopenharmony_ci      tmp = VectorLoad(op0); 
27505bd8deadSopenharmony_ci      result.x = abs(tmp.x);
27515bd8deadSopenharmony_ci      result.y = abs(tmp.y);
27525bd8deadSopenharmony_ci      result.z = abs(tmp.z);
27535bd8deadSopenharmony_ci      result.w = abs(tmp.w);
27545bd8deadSopenharmony_ci
27555bd8deadSopenharmony_ci    ABS supports all three data type modifiers.  Taking the absolute value of
27565bd8deadSopenharmony_ci    an unsigned integer is not a useful operation, but is not illegal.
27575bd8deadSopenharmony_ci
27585bd8deadSopenharmony_ci
27595bd8deadSopenharmony_ci    Section 2.X.8.Z, ADD:  Add
27605bd8deadSopenharmony_ci
27615bd8deadSopenharmony_ci    The ADD instruction performs a component-wise add of the two operands to
27625bd8deadSopenharmony_ci    yield a result vector.
27635bd8deadSopenharmony_ci
27645bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27655bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
27665bd8deadSopenharmony_ci      result.x = tmp0.x + tmp1.x;
27675bd8deadSopenharmony_ci      result.y = tmp0.y + tmp1.y;
27685bd8deadSopenharmony_ci      result.z = tmp0.z + tmp1.z;
27695bd8deadSopenharmony_ci      result.w = tmp0.w + tmp1.w;
27705bd8deadSopenharmony_ci
27715bd8deadSopenharmony_ci    ADD supports all three data type modifiers.    
27725bd8deadSopenharmony_ci
27735bd8deadSopenharmony_ci
27745bd8deadSopenharmony_ci    Section 2.X.8.Z, AND:  Bitwise AND
27755bd8deadSopenharmony_ci
27765bd8deadSopenharmony_ci    The AND instruction performs a bitwise AND operation on the components of
27775bd8deadSopenharmony_ci    the two source vectors to yield a result vector.
27785bd8deadSopenharmony_ci
27795bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
27805bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
27815bd8deadSopenharmony_ci      result.x = tmp0.x & tmp1.x;
27825bd8deadSopenharmony_ci      result.y = tmp0.y & tmp1.y;
27835bd8deadSopenharmony_ci      result.z = tmp0.z & tmp1.z;
27845bd8deadSopenharmony_ci      result.w = tmp0.w & tmp1.w;
27855bd8deadSopenharmony_ci
27865bd8deadSopenharmony_ci    AND supports only signed and unsigned integer data type modifiers.  If no
27875bd8deadSopenharmony_ci    type modifier is specified, both operands and the result are treated as
27885bd8deadSopenharmony_ci    signed integers.
27895bd8deadSopenharmony_ci
27905bd8deadSopenharmony_ci
27915bd8deadSopenharmony_ci    Section 2.X.8.Z, BRK:  Break out of Loop Instruction
27925bd8deadSopenharmony_ci
27935bd8deadSopenharmony_ci    The BRK instruction conditionally transfers control to the instruction
27945bd8deadSopenharmony_ci    immediately following the next ENDREP instruction.  A BRK instruction has
27955bd8deadSopenharmony_ci    no effect if the condition code test evaluates to FALSE.
27965bd8deadSopenharmony_ci
27975bd8deadSopenharmony_ci    The following pseudocode describes the operation of the instruction:
27985bd8deadSopenharmony_ci
27995bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
28005bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
28015bd8deadSopenharmony_ci        continue execution at instruction following the next ENDREP;
28025bd8deadSopenharmony_ci      }
28035bd8deadSopenharmony_ci
28045bd8deadSopenharmony_ci
28055bd8deadSopenharmony_ci    Section 2.X.8.Z, CAL:  Subroutine Call
28065bd8deadSopenharmony_ci
28075bd8deadSopenharmony_ci    The CAL instruction conditionally transfers control to the instruction
28085bd8deadSopenharmony_ci    following the label specified in the instruction.  It also pushes a
28095bd8deadSopenharmony_ci    reference to the instruction immediately following the CAL instruction
28105bd8deadSopenharmony_ci    onto the call stack, where execution will continue after executing the
28115bd8deadSopenharmony_ci    matching RET instruction.  The following pseudocode describes the
28125bd8deadSopenharmony_ci    operation of the instruction:
28135bd8deadSopenharmony_ci
28145bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
28155bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
28165bd8deadSopenharmony_ci        if (callStackDepth >= MAX_PROGRAM_CALL_DEPTH_NV) {
28175bd8deadSopenharmony_ci          // undefined results
28185bd8deadSopenharmony_ci        } else {
28195bd8deadSopenharmony_ci          callStack[callStackDepth] = nextInstruction;
28205bd8deadSopenharmony_ci          callStackDepth++;
28215bd8deadSopenharmony_ci        }
28225bd8deadSopenharmony_ci        // continue execution at instruction following <instTarget>
28235bd8deadSopenharmony_ci      } else {
28245bd8deadSopenharmony_ci        // do nothing
28255bd8deadSopenharmony_ci      }
28265bd8deadSopenharmony_ci
28275bd8deadSopenharmony_ci    In the pseudocode, <instTarget> is the label specified in the instruction
28285bd8deadSopenharmony_ci    matching the <branchLabel> grammar rule, <callStackDepth> is the current
28295bd8deadSopenharmony_ci    depth of the call stack, <callStack> is an array holding the call stack,
28305bd8deadSopenharmony_ci    and <nextInstruction> is a reference to the instruction immediately
28315bd8deadSopenharmony_ci    following the CAL instruction in the program string.
28325bd8deadSopenharmony_ci
28335bd8deadSopenharmony_ci    If the call stack overflows, the results of the CAL instruction are
28345bd8deadSopenharmony_ci    undefined, and can result in immediate program termination.
28355bd8deadSopenharmony_ci
28365bd8deadSopenharmony_ci    An instruction label signifies the beginning of a new subroutine.
28375bd8deadSopenharmony_ci    Subroutines may not nest or overlap.  If a CAL instruction is executed and
28385bd8deadSopenharmony_ci    subsequent program execution reaches an instruction label before a
28395bd8deadSopenharmony_ci    corresponding RET instruction is executed, the subroutine call returns
28405bd8deadSopenharmony_ci    immediately, as though an unconditional RET instruction were inserted
28415bd8deadSopenharmony_ci    immediately before the instruction label.
28425bd8deadSopenharmony_ci
28435bd8deadSopenharmony_ci    (Note:  On previous vertex program extensions -- NV_vertex_program2 and
28445bd8deadSopenharmony_ci    NV_vertex_program3 -- instruction labels were also used as targets for
28455bd8deadSopenharmony_ci    branch (BRA) instructions.  This unstructured branching functionality has
28465bd8deadSopenharmony_ci    been replaced with the structured branching constructs found in this
28475bd8deadSopenharmony_ci    instruction set.)
28485bd8deadSopenharmony_ci
28495bd8deadSopenharmony_ci
28505bd8deadSopenharmony_ci    Section 2.X.8.Z, CEIL:  Ceiling
28515bd8deadSopenharmony_ci
28525bd8deadSopenharmony_ci    The CEIL instruction loads a single vector operand and performs a
28535bd8deadSopenharmony_ci    component-wise ceiling operation to generate a result vector.
28545bd8deadSopenharmony_ci
28555bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
28565bd8deadSopenharmony_ci      iresult.x = ceil(tmp.x);
28575bd8deadSopenharmony_ci      iresult.y = ceil(tmp.y);
28585bd8deadSopenharmony_ci      iresult.z = ceil(tmp.z);
28595bd8deadSopenharmony_ci      iresult.w = ceil(tmp.w);
28605bd8deadSopenharmony_ci
28615bd8deadSopenharmony_ci    The ceiling operation returns the nearest integer greater than or equal to
28625bd8deadSopenharmony_ci    the operand.  For example ceil(-1.7) = -1.0, ceil(+1.0) = +1.0, and
28635bd8deadSopenharmony_ci    ceil(+3.7) = +4.0.
28645bd8deadSopenharmony_ci
28655bd8deadSopenharmony_ci    CEIL supports all three data type modifiers.  The single operand is always
28665bd8deadSopenharmony_ci    treated as a floating-point vector, but the result is written as a
28675bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
28685bd8deadSopenharmony_ci    specified by the data type modifier.  If a value is not exactly
28695bd8deadSopenharmony_ci    representable using the data type of the result (e.g., an overflow or
28705bd8deadSopenharmony_ci    writing a negative value to an unsigned integer), the result is undefined.
28715bd8deadSopenharmony_ci
28725bd8deadSopenharmony_ci
28735bd8deadSopenharmony_ci    Section 2.X.8.Z, CMP:  Compare
28745bd8deadSopenharmony_ci
28755bd8deadSopenharmony_ci    The CMP instructions performs a component-wise comparison of the first
28765bd8deadSopenharmony_ci    operand against zero, and copies the values of the second or third
28775bd8deadSopenharmony_ci    operands based on the results of the compare.
28785bd8deadSopenharmony_ci    
28795bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
28805bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
28815bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
28825bd8deadSopenharmony_ci      result.x = (tmp0.x < 0) ? tmp1.x : tmp2.x;
28835bd8deadSopenharmony_ci      result.y = (tmp0.y < 0) ? tmp1.y : tmp2.y;
28845bd8deadSopenharmony_ci      result.z = (tmp0.z < 0) ? tmp1.z : tmp2.z;
28855bd8deadSopenharmony_ci      result.w = (tmp0.w < 0) ? tmp1.w : tmp2.w;
28865bd8deadSopenharmony_ci
28875bd8deadSopenharmony_ci    CMP supports all three data type modifiers.  CMP with an unsigned data
28885bd8deadSopenharmony_ci    type modifier is not a useful operation, but is not illegal.
28895bd8deadSopenharmony_ci
28905bd8deadSopenharmony_ci
28915bd8deadSopenharmony_ci    Section 2.X.8.Z, CONT:  Continue with Next Loop Iteration
28925bd8deadSopenharmony_ci
28935bd8deadSopenharmony_ci    The CONT instruction conditionally transfers control to the next ENDREP
28945bd8deadSopenharmony_ci    instruction.  A CONT instruction has no effect if the condition code test
28955bd8deadSopenharmony_ci    evaluates to FALSE.
28965bd8deadSopenharmony_ci
28975bd8deadSopenharmony_ci    The following pseudocode describes the operation of the instruction:
28985bd8deadSopenharmony_ci
28995bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
29005bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
29015bd8deadSopenharmony_ci        continue execution at the next ENDREP;
29025bd8deadSopenharmony_ci      }
29035bd8deadSopenharmony_ci
29045bd8deadSopenharmony_ci
29055bd8deadSopenharmony_ci    Section 2.X.8.Z, COS:  Cosine with Reduction to [-PI,PI]
29065bd8deadSopenharmony_ci
29075bd8deadSopenharmony_ci    The COS instruction approximates the trigonometric cosine of the angle
29085bd8deadSopenharmony_ci    specified by the scalar operand and replicates it to all four components
29095bd8deadSopenharmony_ci    of the result vector.  The angle is specified in radians and does not have
29105bd8deadSopenharmony_ci    to be in the range [-PI,PI].
29115bd8deadSopenharmony_ci
29125bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
29135bd8deadSopenharmony_ci      result.x = ApproxCosine(tmp);
29145bd8deadSopenharmony_ci      result.y = ApproxCosine(tmp);
29155bd8deadSopenharmony_ci      result.z = ApproxCosine(tmp);
29165bd8deadSopenharmony_ci      result.w = ApproxCosine(tmp);
29175bd8deadSopenharmony_ci
29185bd8deadSopenharmony_ci    COS supports only floating-point data type modifiers.
29195bd8deadSopenharmony_ci
29205bd8deadSopenharmony_ci
29215bd8deadSopenharmony_ci    Section 2.X.8.Z, DDX:  Partial Derivative Relative to X
29225bd8deadSopenharmony_ci
29235bd8deadSopenharmony_ci    The DDX instruction computes approximate partial derivatives of a vector
29245bd8deadSopenharmony_ci    operand with respect to the X window coordinate, and is only available to
29255bd8deadSopenharmony_ci    fragment programs.  See the NV_fragment_program4 specification for more
29265bd8deadSopenharmony_ci    details.
29275bd8deadSopenharmony_ci
29285bd8deadSopenharmony_ci
29295bd8deadSopenharmony_ci    Section 2.X.8.Z, DDY:  Partial Derivative Relative to Y
29305bd8deadSopenharmony_ci
29315bd8deadSopenharmony_ci    The DDY instruction computes approximate partial derivatives of a vector
29325bd8deadSopenharmony_ci    operand with respect to the Y window coordinate, and is only available to
29335bd8deadSopenharmony_ci    fragment programs.  See the NV_fragment_program4 specification for more
29345bd8deadSopenharmony_ci    details.
29355bd8deadSopenharmony_ci
29365bd8deadSopenharmony_ci
29375bd8deadSopenharmony_ci    Section 2.X.8.Z, DIV:  Divide Vector Components by Scalar
29385bd8deadSopenharmony_ci
29395bd8deadSopenharmony_ci    The DIV instruction performs a component-wise divide of the first vector
29405bd8deadSopenharmony_ci    operand by the second scalar operand to produce a 4-component result
29415bd8deadSopenharmony_ci    vector.
29425bd8deadSopenharmony_ci
29435bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
29445bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
29455bd8deadSopenharmony_ci      result.x = tmp0.x / tmp1;
29465bd8deadSopenharmony_ci      result.y = tmp0.y / tmp1;
29475bd8deadSopenharmony_ci      result.z = tmp0.z / tmp1;
29485bd8deadSopenharmony_ci      result.w = tmp0.w / tmp1;
29495bd8deadSopenharmony_ci
29505bd8deadSopenharmony_ci    DIV supports all three data type modifiers.  For floating-point division,
29515bd8deadSopenharmony_ci    this instruction is not guaranteed to produce results identical to a
29525bd8deadSopenharmony_ci    RCP/MUL instruction sequence.
29535bd8deadSopenharmony_ci
29545bd8deadSopenharmony_ci    The results of an signed or unsigned integer division by zero are
29555bd8deadSopenharmony_ci    undefined.
29565bd8deadSopenharmony_ci
29575bd8deadSopenharmony_ci    
29585bd8deadSopenharmony_ci    Section 2.X.8.Z, DP2:  2-Component Dot Product
29595bd8deadSopenharmony_ci
29605bd8deadSopenharmony_ci    The DP2 instruction computes a two-component dot product of the two
29615bd8deadSopenharmony_ci    operands (using the first two components) and replicates the dot product
29625bd8deadSopenharmony_ci    to all four components of the result vector.
29635bd8deadSopenharmony_ci
29645bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
29655bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
29665bd8deadSopenharmony_ci      dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y);
29675bd8deadSopenharmony_ci      result.x = dot;
29685bd8deadSopenharmony_ci      result.y = dot;
29695bd8deadSopenharmony_ci      result.z = dot;
29705bd8deadSopenharmony_ci      result.w = dot;
29715bd8deadSopenharmony_ci
29725bd8deadSopenharmony_ci    DP2 supports only floating-point data type modifiers.
29735bd8deadSopenharmony_ci
29745bd8deadSopenharmony_ci
29755bd8deadSopenharmony_ci    Section 2.X.8.Z, DP2A:  2-Component Dot Product with Scalar Add
29765bd8deadSopenharmony_ci
29775bd8deadSopenharmony_ci    The DP2 instruction computes a two-component dot product of the two
29785bd8deadSopenharmony_ci    operands (using the first two components), adds the x component of the
29795bd8deadSopenharmony_ci    third operand, and replicates the result to all four components of the
29805bd8deadSopenharmony_ci    result vector.
29815bd8deadSopenharmony_ci
29825bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
29835bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
29845bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
29855bd8deadSopenharmony_ci      dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + tmp2.x;
29865bd8deadSopenharmony_ci      result.x = dot;
29875bd8deadSopenharmony_ci      result.y = dot;
29885bd8deadSopenharmony_ci      result.z = dot;
29895bd8deadSopenharmony_ci      result.w = dot;
29905bd8deadSopenharmony_ci
29915bd8deadSopenharmony_ci    DP2A supports only floating-point data type modifiers.
29925bd8deadSopenharmony_ci
29935bd8deadSopenharmony_ci
29945bd8deadSopenharmony_ci    Section 2.X.8.Z, DP3:  3-Component Dot Product
29955bd8deadSopenharmony_ci
29965bd8deadSopenharmony_ci    The DP3 instruction computes a three-component dot product of the two
29975bd8deadSopenharmony_ci    operands (using the x, y, and z components) and replicates the dot product
29985bd8deadSopenharmony_ci    to all four components of the result vector.
29995bd8deadSopenharmony_ci
30005bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30015bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
30025bd8deadSopenharmony_ci      dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
30035bd8deadSopenharmony_ci            (tmp0.z * tmp1.z);
30045bd8deadSopenharmony_ci      result.x = dot;
30055bd8deadSopenharmony_ci      result.y = dot;
30065bd8deadSopenharmony_ci      result.z = dot;
30075bd8deadSopenharmony_ci      result.w = dot;
30085bd8deadSopenharmony_ci
30095bd8deadSopenharmony_ci    DP3 supports only floating-point data type modifiers.
30105bd8deadSopenharmony_ci
30115bd8deadSopenharmony_ci
30125bd8deadSopenharmony_ci    Section 2.X.8.Z, DP4:  4-Component Dot Product
30135bd8deadSopenharmony_ci
30145bd8deadSopenharmony_ci    The DP4 instruction computes a four-component dot product of the two
30155bd8deadSopenharmony_ci    operands and replicates the dot product to all four components of the
30165bd8deadSopenharmony_ci    result vector.
30175bd8deadSopenharmony_ci
30185bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30195bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1):
30205bd8deadSopenharmony_ci      dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
30215bd8deadSopenharmony_ci            (tmp0.z * tmp1.z) + (tmp0.w * tmp1.w);
30225bd8deadSopenharmony_ci      result.x = dot;
30235bd8deadSopenharmony_ci      result.y = dot;
30245bd8deadSopenharmony_ci      result.z = dot;
30255bd8deadSopenharmony_ci      result.w = dot;
30265bd8deadSopenharmony_ci
30275bd8deadSopenharmony_ci    DP4 supports only floating-point data type modifiers.
30285bd8deadSopenharmony_ci
30295bd8deadSopenharmony_ci
30305bd8deadSopenharmony_ci    Section 2.X.8.Z, DPH:  Homogeneous Dot Product
30315bd8deadSopenharmony_ci
30325bd8deadSopenharmony_ci    The DPH instruction computes a three-component dot product of the two
30335bd8deadSopenharmony_ci    operands (using the x, y, and z components), adds the w component of the
30345bd8deadSopenharmony_ci    second operand, and replicates the sum to all four components of the
30355bd8deadSopenharmony_ci    result vector.  This is equivalent to a four-component dot product where
30365bd8deadSopenharmony_ci    the w component of the first operand is forced to 1.0.
30375bd8deadSopenharmony_ci
30385bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30395bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1):
30405bd8deadSopenharmony_ci      dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 
30415bd8deadSopenharmony_ci            (tmp0.z * tmp1.z) + tmp1.w;
30425bd8deadSopenharmony_ci      result.x = dot;
30435bd8deadSopenharmony_ci      result.y = dot;
30445bd8deadSopenharmony_ci      result.z = dot;
30455bd8deadSopenharmony_ci      result.w = dot;
30465bd8deadSopenharmony_ci
30475bd8deadSopenharmony_ci    DPH supports only floating-point data type modifiers.
30485bd8deadSopenharmony_ci
30495bd8deadSopenharmony_ci
30505bd8deadSopenharmony_ci    Section 2.X.8.Z, DST:  Distance Vector
30515bd8deadSopenharmony_ci
30525bd8deadSopenharmony_ci    The DST instruction computes a distance vector from two specially-
30535bd8deadSopenharmony_ci    formatted operands.  The first operand should be of the form [NA, d^2,
30545bd8deadSopenharmony_ci    d^2, NA] and the second operand should be of the form [NA, 1/d, NA, 1/d],
30555bd8deadSopenharmony_ci    where NA values are not relevant to the calculation and d is a vector
30565bd8deadSopenharmony_ci    length.  If both vectors satisfy these conditions, the result vector will
30575bd8deadSopenharmony_ci    be of the form [1.0, d, d^2, 1/d].
30585bd8deadSopenharmony_ci
30595bd8deadSopenharmony_ci    The exact behavior is specified in the following pseudo-code:
30605bd8deadSopenharmony_ci
30615bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
30625bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
30635bd8deadSopenharmony_ci      result.x = 1.0;
30645bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y;
30655bd8deadSopenharmony_ci      result.z = tmp0.z;
30665bd8deadSopenharmony_ci      result.w = tmp1.w;
30675bd8deadSopenharmony_ci
30685bd8deadSopenharmony_ci    Given an arbitrary vector, d^2 can be obtained using the DP3 instruction
30695bd8deadSopenharmony_ci    (using the same vector for both operands) and 1/d can be obtained from d^2
30705bd8deadSopenharmony_ci    using the RSQ instruction.
30715bd8deadSopenharmony_ci
30725bd8deadSopenharmony_ci    This distance vector is useful for per-vertex light attenuation
30735bd8deadSopenharmony_ci    calculations:  a DP3 operation using the distance vector and an
30745bd8deadSopenharmony_ci    attenuation constants vector as operands will yield the attenuation
30755bd8deadSopenharmony_ci    factor.
30765bd8deadSopenharmony_ci
30775bd8deadSopenharmony_ci    DST supports only floating-point data type modifiers.
30785bd8deadSopenharmony_ci
30795bd8deadSopenharmony_ci
30805bd8deadSopenharmony_ci    Section 2.X.8.Z, ELSE:  Start of If Test Else Block
30815bd8deadSopenharmony_ci
30825bd8deadSopenharmony_ci    The ELSE instruction signifies the end of the "execute if true" portion of
30835bd8deadSopenharmony_ci    an IF/ELSE/ENDIF block and the beginning of the "execute if false"
30845bd8deadSopenharmony_ci    portion.
30855bd8deadSopenharmony_ci
30865bd8deadSopenharmony_ci    If the condition evaluated at the IF statement was TRUE, when a program
30875bd8deadSopenharmony_ci    reaches the ELSE statement, it has completed the entire "execute if true"
30885bd8deadSopenharmony_ci    portion of the IF/ELSE/ENDIF block.  Execution will continue at the
30895bd8deadSopenharmony_ci    corresponding ENDIF instruction.
30905bd8deadSopenharmony_ci
30915bd8deadSopenharmony_ci    If the condition evaluated at the IF statement was FALSE, program
30925bd8deadSopenharmony_ci    execution would skip over the entire "execute if true" portion of the
30935bd8deadSopenharmony_ci    IF/ELSE/ENDIF block, including the ELSE instruction.
30945bd8deadSopenharmony_ci
30955bd8deadSopenharmony_ci
30965bd8deadSopenharmony_ci    Section 2.X.8.Z, EMIT:  Emit Vertex
30975bd8deadSopenharmony_ci
30985bd8deadSopenharmony_ci    The EMIT instruction emits a new vertex to be added to the current output
30995bd8deadSopenharmony_ci    primitive generated by a geometry program, and is only available to
31005bd8deadSopenharmony_ci    geometry programs.  See the NV_geometry_program4 specification for more
31015bd8deadSopenharmony_ci    details.
31025bd8deadSopenharmony_ci
31035bd8deadSopenharmony_ci
31045bd8deadSopenharmony_ci    Section 2.X.8.Z, ENDIF:  End of If Test Block
31055bd8deadSopenharmony_ci
31065bd8deadSopenharmony_ci    The ENDIF instruction signifies the end of an IF/ELSE/ENDIF block.  It has
31075bd8deadSopenharmony_ci    no other effect on program execution.
31085bd8deadSopenharmony_ci
31095bd8deadSopenharmony_ci
31105bd8deadSopenharmony_ci    Section 2.X.8,Z, ENDPRIM:  End of Primitive
31115bd8deadSopenharmony_ci
31125bd8deadSopenharmony_ci    A geometry program can emit multiple primitives in a single invocation.
31135bd8deadSopenharmony_ci    The ENDPRIM instruction is used in a geometry program to signify the end
31145bd8deadSopenharmony_ci    of the current primitive and the beginning of a new primitive of the same
31155bd8deadSopenharmony_ci    type.  It is only available to geometry programs.  See the
31165bd8deadSopenharmony_ci    NV_geometry_program4 specification for more details.
31175bd8deadSopenharmony_ci
31185bd8deadSopenharmony_ci
31195bd8deadSopenharmony_ci    Section 2.X.8.Z, ENDREP:  End of Repeat Block
31205bd8deadSopenharmony_ci
31215bd8deadSopenharmony_ci    The ENDREP instruction specifies the end of a REP block.  
31225bd8deadSopenharmony_ci
31235bd8deadSopenharmony_ci    When used with in conjunction with a REP instruction with a loop count,
31245bd8deadSopenharmony_ci    ENDREP decrements the loop counter.  If the decremented loop counter is
31255bd8deadSopenharmony_ci    greater than zero, ENDREP transfers control to the instruction immediately
31265bd8deadSopenharmony_ci    after the corresponding REP instruction.  If the loop counter is less than
31275bd8deadSopenharmony_ci    or equal to zero, execution continues at the instruction following the
31285bd8deadSopenharmony_ci    ENDREP instruction.  When used in conjunction with a REP instruction
31295bd8deadSopenharmony_ci    without loop count, ENDREP always transfers control to the instruction
31305bd8deadSopenharmony_ci    immediately after the REP instruction.
31315bd8deadSopenharmony_ci
31325bd8deadSopenharmony_ci      if (REP instruction includes a loop count) {
31335bd8deadSopenharmony_ci        LoopCount--;
31345bd8deadSopenharmony_ci        if (LoopCount > 0) {
31355bd8deadSopenharmony_ci          continue execution at instruction following corresponding REP
31365bd8deadSopenharmony_ci            instruction;
31375bd8deadSopenharmony_ci        }
31385bd8deadSopenharmony_ci      } else {
31395bd8deadSopenharmony_ci        continue execution at instruction following corresponding REP
31405bd8deadSopenharmony_ci          instruction;
31415bd8deadSopenharmony_ci      }
31425bd8deadSopenharmony_ci
31435bd8deadSopenharmony_ci
31445bd8deadSopenharmony_ci    Section 2.X.8.Z, EX2:  Exponential Base 2
31455bd8deadSopenharmony_ci
31465bd8deadSopenharmony_ci    The EX2 instruction approximates 2 raised to the power of the scalar
31475bd8deadSopenharmony_ci    operand and replicates the approximation to all four components of the
31485bd8deadSopenharmony_ci    result vector.
31495bd8deadSopenharmony_ci
31505bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
31515bd8deadSopenharmony_ci      result.x = Approx2ToX(tmp);
31525bd8deadSopenharmony_ci      result.y = Approx2ToX(tmp);
31535bd8deadSopenharmony_ci      result.z = Approx2ToX(tmp);
31545bd8deadSopenharmony_ci      result.w = Approx2ToX(tmp);
31555bd8deadSopenharmony_ci
31565bd8deadSopenharmony_ci    EX2 supports only floating-point data type modifiers.
31575bd8deadSopenharmony_ci
31585bd8deadSopenharmony_ci
31595bd8deadSopenharmony_ci    Section 2.X.8.Z, FLR:  Floor
31605bd8deadSopenharmony_ci
31615bd8deadSopenharmony_ci    The FLR instruction loads a single vector operand and performs a
31625bd8deadSopenharmony_ci    component-wise floor operation to generate a result vector.
31635bd8deadSopenharmony_ci
31645bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
31655bd8deadSopenharmony_ci      result.x = floor(tmp.x);
31665bd8deadSopenharmony_ci      result.y = floor(tmp.y);
31675bd8deadSopenharmony_ci      result.z = floor(tmp.z);
31685bd8deadSopenharmony_ci      result.w = floor(tmp.w);
31695bd8deadSopenharmony_ci
31705bd8deadSopenharmony_ci    The floor operation returns the nearest integer less than or equal to the
31715bd8deadSopenharmony_ci    operand.  For example floor(-1.7) = -2.0, floor(+1.0) = +1.0, and floor(+3.7)
31725bd8deadSopenharmony_ci    = +3.0.
31735bd8deadSopenharmony_ci
31745bd8deadSopenharmony_ci    FLR supports all three data type modifiers.  The single operand is always
31755bd8deadSopenharmony_ci    treated as a floating-point value, but the result is written as a
31765bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
31775bd8deadSopenharmony_ci    specified by the data type modifier.  If a value is not exactly
31785bd8deadSopenharmony_ci    representable using the data type of the result (e.g., an overflow or
31795bd8deadSopenharmony_ci    writing a negative value to an unsigned integer), the result is undefined.
31805bd8deadSopenharmony_ci
31815bd8deadSopenharmony_ci
31825bd8deadSopenharmony_ci    Section 2.X.8.Z, FRC:  Fraction
31835bd8deadSopenharmony_ci
31845bd8deadSopenharmony_ci    The FRC instruction extracts the fractional portion of each component of
31855bd8deadSopenharmony_ci    the operand to generate a result vector.  The fractional portion of a
31865bd8deadSopenharmony_ci    component is defined as the result after subtracting off the floor of the
31875bd8deadSopenharmony_ci    component (see FLR), and is always in the range [0.0, 1.0).
31885bd8deadSopenharmony_ci
31895bd8deadSopenharmony_ci    For negative values, the fractional portion is NOT the number written to
31905bd8deadSopenharmony_ci    the right of the decimal point -- the fractional portion of -1.7 is not
31915bd8deadSopenharmony_ci    0.7 -- it is 0.3.  0.3 is produced by subtracting the floor of -1.7 (-2.0)
31925bd8deadSopenharmony_ci    from -1.7.
31935bd8deadSopenharmony_ci
31945bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
31955bd8deadSopenharmony_ci      result.x = fraction(tmp.x);
31965bd8deadSopenharmony_ci      result.y = fraction(tmp.y);
31975bd8deadSopenharmony_ci      result.z = fraction(tmp.z);
31985bd8deadSopenharmony_ci      result.w = fraction(tmp.w);
31995bd8deadSopenharmony_ci
32005bd8deadSopenharmony_ci    FRC supports only floating-point data type modifiers.
32015bd8deadSopenharmony_ci
32025bd8deadSopenharmony_ci
32035bd8deadSopenharmony_ci    Section 2.X.8.Z, I2F:  Integer to Float
32045bd8deadSopenharmony_ci
32055bd8deadSopenharmony_ci    The I2F instruction converts the components of an integer vector operand
32065bd8deadSopenharmony_ci    to floating-point to produce a floating-point result vector.
32075bd8deadSopenharmony_ci
32085bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
32095bd8deadSopenharmony_ci      result.x = (float) tmp.x;
32105bd8deadSopenharmony_ci      result.y = (float) tmp.y;
32115bd8deadSopenharmony_ci      result.z = (float) tmp.z;
32125bd8deadSopenharmony_ci      result.w = (float) tmp.w;
32135bd8deadSopenharmony_ci
32145bd8deadSopenharmony_ci    I2F supports only signed and unsigned integer data type modifiers.  The
32155bd8deadSopenharmony_ci    single operand is interpreted according to the data type modifier.  If no
32165bd8deadSopenharmony_ci    data type modifier is specified, the operand is treated as a signed
32175bd8deadSopenharmony_ci    integer vector.  The result is always written as a float.
32185bd8deadSopenharmony_ci
32195bd8deadSopenharmony_ci
32205bd8deadSopenharmony_ci    Section 2.X.8.Z, IF:  Start of If Test Block
32215bd8deadSopenharmony_ci
32225bd8deadSopenharmony_ci    The IF instruction performs a condition code test to determine what
32235bd8deadSopenharmony_ci    instructions inside an IF/ELSE/ENDIF block are executed.  If the test
32245bd8deadSopenharmony_ci    passes, execution continues at the instruction immediately following the
32255bd8deadSopenharmony_ci    IF instruction.  If the test fails, IF transfers control to the
32265bd8deadSopenharmony_ci    instruction immediately following the corresponding ELSE instruction (if
32275bd8deadSopenharmony_ci    present) or the ENDIF instruction (if no ELSE is present).
32285bd8deadSopenharmony_ci
32295bd8deadSopenharmony_ci    Implementations may have a limited ability to nest IF blocks in any
32305bd8deadSopenharmony_ci    subroutine.  If the number of IF/ENDIF blocks nested inside each other is
32315bd8deadSopenharmony_ci    MAX_PROGRAM_IF_DEPTH_NV or higher, a program will fail to compile.
32325bd8deadSopenharmony_ci
32335bd8deadSopenharmony_ci      // Evaluate the condition.  If the condition is true, continue at the
32345bd8deadSopenharmony_ci      // next instruction.  Otherwise, continue at the 
32355bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
32365bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
32375bd8deadSopenharmony_ci        continue execution at the next instruction;
32385bd8deadSopenharmony_ci      } else if (IF block contains an ELSE statement) {
32395bd8deadSopenharmony_ci        continue execution at instruction following corresponding ELSE;
32405bd8deadSopenharmony_ci      } else {
32415bd8deadSopenharmony_ci        continue execution at instruction following corresponding ENDIF;
32425bd8deadSopenharmony_ci      }
32435bd8deadSopenharmony_ci
32445bd8deadSopenharmony_ci    (Note:  Unlike the NV_fragment_program2 extension, there is no run-time
32455bd8deadSopenharmony_ci    limit on the maximum overall depth of IF/ENDIF nesting.  As long as each
32465bd8deadSopenharmony_ci    individual subroutine of the program obeys the static nesting limits,
32475bd8deadSopenharmony_ci    there will be no run-time errors in the program.  With the
32485bd8deadSopenharmony_ci    NV_fragment_program2 extension, a program could terminate abnormally if it
32495bd8deadSopenharmony_ci    called a subroutine inside a very deeply nested set of IF/ENDIF blocks and
32505bd8deadSopenharmony_ci    the called subroutine also contained deeply nested IF/ENDIF blocks.  SUch
32515bd8deadSopenharmony_ci    an error could occur even if neither subroutine exceeded static limits.)
32525bd8deadSopenharmony_ci
32535bd8deadSopenharmony_ci
32545bd8deadSopenharmony_ci    Section 2.X.8.Z, KIL:  Kill Fragment
32555bd8deadSopenharmony_ci
32565bd8deadSopenharmony_ci    The KIL instruction conditionally kills a fragment, and is only available
32575bd8deadSopenharmony_ci    to fragment programs.  See the NV_fragment_program4 specification for more
32585bd8deadSopenharmony_ci    details.
32595bd8deadSopenharmony_ci
32605bd8deadSopenharmony_ci
32615bd8deadSopenharmony_ci    Section 2.X.8.Z, LG2:  Logarithm Base 2
32625bd8deadSopenharmony_ci
32635bd8deadSopenharmony_ci    The LG2 instruction approximates the base 2 logarithm of the scalar
32645bd8deadSopenharmony_ci    operand and replicates it to all four components of the result vector.
32655bd8deadSopenharmony_ci
32665bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
32675bd8deadSopenharmony_ci      result.x = ApproxLog2(tmp);
32685bd8deadSopenharmony_ci      result.y = ApproxLog2(tmp);
32695bd8deadSopenharmony_ci      result.z = ApproxLog2(tmp);
32705bd8deadSopenharmony_ci      result.w = ApproxLog2(tmp);
32715bd8deadSopenharmony_ci
32725bd8deadSopenharmony_ci    If the scalar operand is zero or negative, the result is undefined.
32735bd8deadSopenharmony_ci
32745bd8deadSopenharmony_ci    LG2 supports only floating-point data type modifiers.
32755bd8deadSopenharmony_ci
32765bd8deadSopenharmony_ci
32775bd8deadSopenharmony_ci    Section 2.X.8.Z, LIT:  Compute Lighting Coefficients
32785bd8deadSopenharmony_ci
32795bd8deadSopenharmony_ci    The LIT instruction accelerates lighting computations by computing
32805bd8deadSopenharmony_ci    lighting coefficients for ambient, diffuse, and specular light
32815bd8deadSopenharmony_ci    contributions.  The "x" component of the single operand is assumed to hold
32825bd8deadSopenharmony_ci    a diffuse dot product (n dot VP_pli, as in the vertex lighting equations
32835bd8deadSopenharmony_ci    in Section 2.13.1).  The "y" component of the operand is assumed to hold a
32845bd8deadSopenharmony_ci    specular dot product (n dot h_i).  The "w" component of the operand is
32855bd8deadSopenharmony_ci    assumed to hold the specular exponent of the material (s_rm), and is
32865bd8deadSopenharmony_ci    clamped to the range (-128, +128) exclusive.
32875bd8deadSopenharmony_ci
32885bd8deadSopenharmony_ci    The "x" component of the result vector receives the value that should be
32895bd8deadSopenharmony_ci    multiplied by the ambient light/material product (always 1.0).  The "y"
32905bd8deadSopenharmony_ci    component of the result vector receives the value that should be
32915bd8deadSopenharmony_ci    multiplied by the diffuse light/material product (n dot VP_pli).  The "z"
32925bd8deadSopenharmony_ci    component of the result vector receives the value that should be
32935bd8deadSopenharmony_ci    multiplied by the specular light/material product (f_i * (n dot h_i) ^
32945bd8deadSopenharmony_ci    s_rm).  The "w" component of the result is the constant 1.0.
32955bd8deadSopenharmony_ci
32965bd8deadSopenharmony_ci    Negative diffuse and specular dot products are clamped to 0.0, as is done
32975bd8deadSopenharmony_ci    in the standard per-vertex lighting operations.  In addition, if the
32985bd8deadSopenharmony_ci    diffuse dot product is zero or negative, the specular coefficient is
32995bd8deadSopenharmony_ci    forced to zero.
33005bd8deadSopenharmony_ci
33015bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
33025bd8deadSopenharmony_ci      if (tmp.x < 0) tmp.x = 0;
33035bd8deadSopenharmony_ci      if (tmp.y < 0) tmp.y = 0;
33045bd8deadSopenharmony_ci      if (tmp.w < -(128.0-epsilon)) tmp.w = -(128.0-epsilon);
33055bd8deadSopenharmony_ci      else if (tmp.w > 128-epsilon) tmp.w = 128-epsilon;
33065bd8deadSopenharmony_ci      result.x = 1.0;
33075bd8deadSopenharmony_ci      result.y = tmp.x;
33085bd8deadSopenharmony_ci      result.z = (tmp.x > 0) ? RoughApproxPower(tmp.y, tmp.w) : 0.0;
33095bd8deadSopenharmony_ci      result.w = 1.0;
33105bd8deadSopenharmony_ci
33115bd8deadSopenharmony_ci    Since 0^0 is defined to be 1, RoughApproxPower(0.0, 0.0) will produce 1.0.
33125bd8deadSopenharmony_ci
33135bd8deadSopenharmony_ci    LIT supports only floating-point data type modifiers.
33145bd8deadSopenharmony_ci
33155bd8deadSopenharmony_ci
33165bd8deadSopenharmony_ci    Section 2.X.8.Z, LRP:  Linear Interpolation
33175bd8deadSopenharmony_ci
33185bd8deadSopenharmony_ci    The LRP instruction performs a component-wise linear interpolation between
33195bd8deadSopenharmony_ci    the second and third operands using the first operand as the blend factor.
33205bd8deadSopenharmony_ci    
33215bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
33225bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
33235bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
33245bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x + (1 - tmp0.x) * tmp2.x;
33255bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y + (1 - tmp0.y) * tmp2.y;
33265bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z + (1 - tmp0.z) * tmp2.z;
33275bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w + (1 - tmp0.w) * tmp2.w;
33285bd8deadSopenharmony_ci
33295bd8deadSopenharmony_ci    LRP supports only floating-point data type modifiers.
33305bd8deadSopenharmony_ci
33315bd8deadSopenharmony_ci
33325bd8deadSopenharmony_ci    Section 2.X.8.Z, MAD:  Multiply and Add
33335bd8deadSopenharmony_ci
33345bd8deadSopenharmony_ci    The MAD instruction performs a component-wise multiply of the first two
33355bd8deadSopenharmony_ci    operands, and then does a component-wise add of the product to the third
33365bd8deadSopenharmony_ci    operand to yield a result vector.
33375bd8deadSopenharmony_ci
33385bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
33395bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
33405bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
33415bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x + tmp2.x;
33425bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y + tmp2.y;
33435bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z + tmp2.z;
33445bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w + tmp2.w;
33455bd8deadSopenharmony_ci
33465bd8deadSopenharmony_ci    The multiplication and addition operations in this instruction are subject
33475bd8deadSopenharmony_ci    to the same rules as described for the MUL and ADD instructions.
33485bd8deadSopenharmony_ci
33495bd8deadSopenharmony_ci    MAD supports all three data type modifiers.
33505bd8deadSopenharmony_ci
33515bd8deadSopenharmony_ci
33525bd8deadSopenharmony_ci    Section 2.X.8.Z, MAX:  Maximum
33535bd8deadSopenharmony_ci
33545bd8deadSopenharmony_ci    The MAX instruction computes component-wise maximums of the values in the
33555bd8deadSopenharmony_ci    two operands to yield a result vector.
33565bd8deadSopenharmony_ci
33575bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
33585bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
33595bd8deadSopenharmony_ci      result.x = (tmp0.x > tmp1.x) ? tmp0.x : tmp1.x;
33605bd8deadSopenharmony_ci      result.y = (tmp0.y > tmp1.y) ? tmp0.y : tmp1.y;
33615bd8deadSopenharmony_ci      result.z = (tmp0.z > tmp1.z) ? tmp0.z : tmp1.z;
33625bd8deadSopenharmony_ci      result.w = (tmp0.w > tmp1.w) ? tmp0.w : tmp1.w;
33635bd8deadSopenharmony_ci
33645bd8deadSopenharmony_ci    MAX supports all three data type modifiers.
33655bd8deadSopenharmony_ci
33665bd8deadSopenharmony_ci
33675bd8deadSopenharmony_ci    Section 2.X.8.Z, MIN:  Minimum
33685bd8deadSopenharmony_ci
33695bd8deadSopenharmony_ci    The MIN instruction computes component-wise minimums of the values in the
33705bd8deadSopenharmony_ci    two operands to yield a result vector.
33715bd8deadSopenharmony_ci
33725bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
33735bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
33745bd8deadSopenharmony_ci      result.x = (tmp0.x > tmp1.x) ? tmp1.x : tmp0.x;
33755bd8deadSopenharmony_ci      result.y = (tmp0.y > tmp1.y) ? tmp1.y : tmp0.y;
33765bd8deadSopenharmony_ci      result.z = (tmp0.z > tmp1.z) ? tmp1.z : tmp0.z;
33775bd8deadSopenharmony_ci      result.w = (tmp0.w > tmp1.w) ? tmp1.w : tmp0.w;
33785bd8deadSopenharmony_ci
33795bd8deadSopenharmony_ci    MIN supports all three data type modifiers.
33805bd8deadSopenharmony_ci
33815bd8deadSopenharmony_ci
33825bd8deadSopenharmony_ci    Section 2.X.8.Z, MOD:  Modulus
33835bd8deadSopenharmony_ci
33845bd8deadSopenharmony_ci    The MOD instruction performs a component-wise modulus operation on the first
33855bd8deadSopenharmony_ci    vector operand by the second scalar operand to produce a 4-component result
33865bd8deadSopenharmony_ci    vector.
33875bd8deadSopenharmony_ci
33885bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
33895bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
33905bd8deadSopenharmony_ci      result.x = tmp0.x % tmp1;
33915bd8deadSopenharmony_ci      result.y = tmp0.y % tmp1;
33925bd8deadSopenharmony_ci      result.z = tmp0.z % tmp1;
33935bd8deadSopenharmony_ci      result.w = tmp0.w % tmp1;
33945bd8deadSopenharmony_ci
33955bd8deadSopenharmony_ci    MOD supports both signed and unsigned integer data type modifiers.  If no
33965bd8deadSopenharmony_ci    data type modifier is specified, both operands and the result are treated
33975bd8deadSopenharmony_ci    as signed integers.
33985bd8deadSopenharmony_ci    
33995bd8deadSopenharmony_ci    A result component is undefined if the corresponding component of the
34005bd8deadSopenharmony_ci    first operand is negative or if the second operand is less than or equal
34015bd8deadSopenharmony_ci    to zero.
34025bd8deadSopenharmony_ci
34035bd8deadSopenharmony_ci
34045bd8deadSopenharmony_ci    Section 2.X.8.Z, MOV:  Move
34055bd8deadSopenharmony_ci
34065bd8deadSopenharmony_ci    The MOV instruction copies the value of the operand to yield a result
34075bd8deadSopenharmony_ci    vector.
34085bd8deadSopenharmony_ci
34095bd8deadSopenharmony_ci      result = VectorLoad(op0);
34105bd8deadSopenharmony_ci
34115bd8deadSopenharmony_ci    MOV supports all three data type modifiers.
34125bd8deadSopenharmony_ci
34135bd8deadSopenharmony_ci
34145bd8deadSopenharmony_ci    Section 2.X.8.Z, MUL:  Multiply
34155bd8deadSopenharmony_ci
34165bd8deadSopenharmony_ci    The MUL instruction performs a component-wise multiply of the two operands
34175bd8deadSopenharmony_ci    to yield a result vector.
34185bd8deadSopenharmony_ci
34195bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
34205bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
34215bd8deadSopenharmony_ci      result.x = tmp0.x * tmp1.x;
34225bd8deadSopenharmony_ci      result.y = tmp0.y * tmp1.y;
34235bd8deadSopenharmony_ci      result.z = tmp0.z * tmp1.z;
34245bd8deadSopenharmony_ci      result.w = tmp0.w * tmp1.w;
34255bd8deadSopenharmony_ci
34265bd8deadSopenharmony_ci    MUL supports all three data type modifiers.  The MUL instruction
34275bd8deadSopenharmony_ci    additionally supports three special modifiers.
34285bd8deadSopenharmony_ci
34295bd8deadSopenharmony_ci    The "S24" and "U24" modifiers specify "fast" signed or unsigned integer
34305bd8deadSopenharmony_ci    multiplies of 24-bit quantities, respectively.  The results of such
34315bd8deadSopenharmony_ci    multiplies are undefined if either operand is outside the range
34325bd8deadSopenharmony_ci    [-2^23,+2^23-1] for S24 or [0,2^24-1] for U24.  If "S24" or "U24" is
34335bd8deadSopenharmony_ci    specified, the data type is implied and normal data type modifiers may not
34345bd8deadSopenharmony_ci    be provided.
34355bd8deadSopenharmony_ci
34365bd8deadSopenharmony_ci    The "HI" modifier specifies a 32-bit integer multiply that returns the 32
34375bd8deadSopenharmony_ci    most significant bits of the 64-bit product.  Integer multiplies without
34385bd8deadSopenharmony_ci    the "HI" modifier normally return the least significant bits of the
34395bd8deadSopenharmony_ci    product.  If "HI" is specified, either of the "S" or "U" integer data type
34405bd8deadSopenharmony_ci    modifiers must also be specified.  
34415bd8deadSopenharmony_ci
34425bd8deadSopenharmony_ci    Note that if condition code updates are performed on integer multiplies,
34435bd8deadSopenharmony_ci    the overflow or carry flags are always cleared, even if the product
34445bd8deadSopenharmony_ci    overflowed.  If it is necessary to determine if the results of an integer
34455bd8deadSopenharmony_ci    multiply overflowed, the MUL.HI instruction may be used.
34465bd8deadSopenharmony_ci
34475bd8deadSopenharmony_ci
34485bd8deadSopenharmony_ci    Section 2.X.8.Z, NOT:  Bitwise Not
34495bd8deadSopenharmony_ci
34505bd8deadSopenharmony_ci    The NOT instruction performs a component-wise bitwise NOT operation on the
34515bd8deadSopenharmony_ci    source vector to produce a result vector.
34525bd8deadSopenharmony_ci
34535bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
34545bd8deadSopenharmony_ci      tmp.x = ~tmp.x;
34555bd8deadSopenharmony_ci      tmp.y = ~tmp.y;
34565bd8deadSopenharmony_ci      tmp.z = ~tmp.z;
34575bd8deadSopenharmony_ci      tmp.w = ~tmp.w;
34585bd8deadSopenharmony_ci
34595bd8deadSopenharmony_ci    NOT supports only integer data type modifiers.  If no type modifier is
34605bd8deadSopenharmony_ci    specified, the operand and the result are treated as signed integers.
34615bd8deadSopenharmony_ci
34625bd8deadSopenharmony_ci
34635bd8deadSopenharmony_ci    Section 2.X.8.Z, NRM:  Normalize 3-Component Vector
34645bd8deadSopenharmony_ci
34655bd8deadSopenharmony_ci    The NRM instruction normalizes the vector given by the x, y, and z
34665bd8deadSopenharmony_ci    components of the vector operand to produce the x, y, and z components of
34675bd8deadSopenharmony_ci    the result vector.  The w component of the result is undefined.
34685bd8deadSopenharmony_ci
34695bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
34705bd8deadSopenharmony_ci      scale = ApproxRSQ(tmp.x * tmp.x + tmp.y * tmp.y + tmp.z * tmp.z);
34715bd8deadSopenharmony_ci      result.x = tmp.x * scale;
34725bd8deadSopenharmony_ci      result.y = tmp.y * scale;
34735bd8deadSopenharmony_ci      result.z = tmp.z * scale;
34745bd8deadSopenharmony_ci      result.w = undefined;
34755bd8deadSopenharmony_ci
34765bd8deadSopenharmony_ci    NRM supports only floating-point data type modifiers.
34775bd8deadSopenharmony_ci
34785bd8deadSopenharmony_ci
34795bd8deadSopenharmony_ci    Section 2.X.8.Z, OR:  Bitwise Or
34805bd8deadSopenharmony_ci
34815bd8deadSopenharmony_ci    The OR instruction performs a bitwise OR operation on the components of
34825bd8deadSopenharmony_ci    the two source vectors to yield a result vector.
34835bd8deadSopenharmony_ci
34845bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
34855bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
34865bd8deadSopenharmony_ci      result.x = tmp0.x | tmp1.x;
34875bd8deadSopenharmony_ci      result.y = tmp0.y | tmp1.y;
34885bd8deadSopenharmony_ci      result.z = tmp0.z | tmp1.z;
34895bd8deadSopenharmony_ci      result.w = tmp0.w | tmp1.w;
34905bd8deadSopenharmony_ci
34915bd8deadSopenharmony_ci    OR supports only integer data type modifiers.  If no type modifier is
34925bd8deadSopenharmony_ci    specified, both operands and the result are treated as signed integers.
34935bd8deadSopenharmony_ci
34945bd8deadSopenharmony_ci
34955bd8deadSopenharmony_ci    Section 2.X.8.Z, PK2H:  Pack Two 16-bit Floats
34965bd8deadSopenharmony_ci
34975bd8deadSopenharmony_ci    The PK2H instruction converts the "x" and "y" components of the single
34985bd8deadSopenharmony_ci    floating-point vector operand into 16-bit floating-point format, packs the
34995bd8deadSopenharmony_ci    bit representation of these two floats into a 32-bit unsigned integer, and
35005bd8deadSopenharmony_ci    replicates that value to all four components of the result vector.  The
35015bd8deadSopenharmony_ci    PK2H instruction can be reversed by the UP2H instruction below.
35025bd8deadSopenharmony_ci
35035bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
35045bd8deadSopenharmony_ci      /* result obtained by combining raw bits of tmp0.x, tmp0.y */
35055bd8deadSopenharmony_ci      result.x = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
35065bd8deadSopenharmony_ci      result.y = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
35075bd8deadSopenharmony_ci      result.z = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
35085bd8deadSopenharmony_ci      result.w = RawBits(tmp0.x) | (RawBits(tmp0.y) << 16);
35095bd8deadSopenharmony_ci
35105bd8deadSopenharmony_ci    PK2H supports all three data type modifiers.  The single operand is always
35115bd8deadSopenharmony_ci    treated as a floating-point value, but the result is written as a
35125bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
35135bd8deadSopenharmony_ci    specified by the data type modifier.  For integer results, the bits can be
35145bd8deadSopenharmony_ci    interpreted as described above.  For floating-point result variables, the
35155bd8deadSopenharmony_ci    packed results do not constitute a meaningful floating-point variable and
35165bd8deadSopenharmony_ci    should only be used to feed future unpack instructions.
35175bd8deadSopenharmony_ci
35185bd8deadSopenharmony_ci    A program will fail to load if it contains a PK2H instruction that writes
35195bd8deadSopenharmony_ci    its results to a variable declared as "SHORT".
35205bd8deadSopenharmony_ci
35215bd8deadSopenharmony_ci
35225bd8deadSopenharmony_ci    Section 2.X.8.Z, PK2US:  Pack Two Floats as Unsigned 16-bit
35235bd8deadSopenharmony_ci
35245bd8deadSopenharmony_ci    The PK2US instruction converts the "x" and "y" components of the single
35255bd8deadSopenharmony_ci    floating-point vector operand into a packed pair of 16-bit unsigned
35265bd8deadSopenharmony_ci    scalars.  The scalars are represented in a bit pattern where all '0' bits
35275bd8deadSopenharmony_ci    corresponds to 0.0 and all '1' bits corresponds to 1.0.  The bit
35285bd8deadSopenharmony_ci    representations of the two converted components are packed into a 32-bit
35295bd8deadSopenharmony_ci    unsigned integer, and that value is replicated to all four components of
35305bd8deadSopenharmony_ci    the result vector.  The PK2US instruction can be reversed by the UP2US
35315bd8deadSopenharmony_ci    instruction below.
35325bd8deadSopenharmony_ci
35335bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
35345bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
35355bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
35365bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
35375bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
35385bd8deadSopenharmony_ci      us.x = round(65535.0 * tmp0.x);  /* us is a ushort vector */
35395bd8deadSopenharmony_ci      us.y = round(65535.0 * tmp0.y);
35405bd8deadSopenharmony_ci      /* result obtained by combining raw bits of us. */
35415bd8deadSopenharmony_ci      result.x = ((us.x) | (us.y << 16));
35425bd8deadSopenharmony_ci      result.y = ((us.x) | (us.y << 16));
35435bd8deadSopenharmony_ci      result.z = ((us.x) | (us.y << 16));
35445bd8deadSopenharmony_ci      result.w = ((us.x) | (us.y << 16));
35455bd8deadSopenharmony_ci
35465bd8deadSopenharmony_ci    PK2US supports all three data type modifiers.  The single operand is
35475bd8deadSopenharmony_ci    always treated as a floating-point value, but the result is written as a
35485bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
35495bd8deadSopenharmony_ci    specified by the data type modifier.  For integer result variables, the
35505bd8deadSopenharmony_ci    bits can be interpreted as described above.  For floating-point result
35515bd8deadSopenharmony_ci    variables, the packed results do not constitute a meaningful
35525bd8deadSopenharmony_ci    floating-point variable and should only be used to feed future unpack
35535bd8deadSopenharmony_ci    instructions.
35545bd8deadSopenharmony_ci
35555bd8deadSopenharmony_ci    A program will fail to load if it contains a PK2US instruction that writes
35565bd8deadSopenharmony_ci    its results to a variable declared as "SHORT".
35575bd8deadSopenharmony_ci
35585bd8deadSopenharmony_ci
35595bd8deadSopenharmony_ci    Section 2.X.8.Z, PK4B:  Pack Four Floats as Signed 8-bit
35605bd8deadSopenharmony_ci
35615bd8deadSopenharmony_ci    The PK4B instruction converts the four components of the single
35625bd8deadSopenharmony_ci    floating-point vector operand into 8-bit signed quantities.  The signed
35635bd8deadSopenharmony_ci    quantities are represented in a bit pattern where all '0' bits corresponds
35645bd8deadSopenharmony_ci    to -128/127 and all '1' bits corresponds to +127/127.  The bit
35655bd8deadSopenharmony_ci    representations of the four converted components are packed into a 32-bit
35665bd8deadSopenharmony_ci    unsigned integer, and that value is replicated to all four components of
35675bd8deadSopenharmony_ci    the result vector.  The PK4B instruction can be reversed by the UP4B
35685bd8deadSopenharmony_ci    instruction below.
35695bd8deadSopenharmony_ci
35705bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
35715bd8deadSopenharmony_ci      if (tmp0.x < -128/127) tmp0.x = -128/127;
35725bd8deadSopenharmony_ci      if (tmp0.y < -128/127) tmp0.y = -128/127;
35735bd8deadSopenharmony_ci      if (tmp0.z < -128/127) tmp0.z = -128/127;
35745bd8deadSopenharmony_ci      if (tmp0.w < -128/127) tmp0.w = -128/127;
35755bd8deadSopenharmony_ci      if (tmp0.x > +127/127) tmp0.x = +127/127;
35765bd8deadSopenharmony_ci      if (tmp0.y > +127/127) tmp0.y = +127/127;
35775bd8deadSopenharmony_ci      if (tmp0.z > +127/127) tmp0.z = +127/127;
35785bd8deadSopenharmony_ci      if (tmp0.w > +127/127) tmp0.w = +127/127;
35795bd8deadSopenharmony_ci      ub.x = round(127.0 * tmp0.x + 128.0);  /* ub is a ubyte vector */
35805bd8deadSopenharmony_ci      ub.y = round(127.0 * tmp0.y + 128.0);
35815bd8deadSopenharmony_ci      ub.z = round(127.0 * tmp0.z + 128.0);
35825bd8deadSopenharmony_ci      ub.w = round(127.0 * tmp0.w + 128.0);
35835bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
35845bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
35855bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
35865bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
35875bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
35885bd8deadSopenharmony_ci
35895bd8deadSopenharmony_ci    PK4B supports all three data type modifiers.  The single operand is always
35905bd8deadSopenharmony_ci    treated as a floating-point value, but the result is written as a
35915bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
35925bd8deadSopenharmony_ci    specified by the data type modifier.  For integer result variables, the
35935bd8deadSopenharmony_ci    bits can be interpreted as described above.  For floating-point result
35945bd8deadSopenharmony_ci    variables, the packed results do not constitute a meaningful
35955bd8deadSopenharmony_ci    floating-point variable and should only be used to feed future unpack
35965bd8deadSopenharmony_ci    instructions.  A program will fail to load if it contains a PK4B
35975bd8deadSopenharmony_ci    instruction that writes its results to a variable declared as "SHORT".
35985bd8deadSopenharmony_ci
35995bd8deadSopenharmony_ci
36005bd8deadSopenharmony_ci    Section 2.X.8.Z, PK4UB:  Pack Four Floats as Unsigned 8-bit
36015bd8deadSopenharmony_ci
36025bd8deadSopenharmony_ci    The PK4UB instruction converts the four components of the single
36035bd8deadSopenharmony_ci    floating-point vector operand into a packed grouping of 8-bit unsigned
36045bd8deadSopenharmony_ci    scalars.  The scalars are represented in a bit pattern where all '0' bits
36055bd8deadSopenharmony_ci    corresponds to 0.0 and all '1' bits corresponds to 1.0.  The bit
36065bd8deadSopenharmony_ci    representations of the four converted components are packed into a 32-bit
36075bd8deadSopenharmony_ci    unsigned integer, and that value is replicated to all four components of
36085bd8deadSopenharmony_ci    the result vector.  The PK4UB instruction can be reversed by the UP4UB
36095bd8deadSopenharmony_ci    instruction below.
36105bd8deadSopenharmony_ci
36115bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
36125bd8deadSopenharmony_ci      if (tmp0.x < 0.0) tmp0.x = 0.0;
36135bd8deadSopenharmony_ci      if (tmp0.x > 1.0) tmp0.x = 1.0;
36145bd8deadSopenharmony_ci      if (tmp0.y < 0.0) tmp0.y = 0.0;
36155bd8deadSopenharmony_ci      if (tmp0.y > 1.0) tmp0.y = 1.0;
36165bd8deadSopenharmony_ci      if (tmp0.z < 0.0) tmp0.z = 0.0;
36175bd8deadSopenharmony_ci      if (tmp0.z > 1.0) tmp0.z = 1.0;
36185bd8deadSopenharmony_ci      if (tmp0.w < 0.0) tmp0.w = 0.0;
36195bd8deadSopenharmony_ci      if (tmp0.w > 1.0) tmp0.w = 1.0;
36205bd8deadSopenharmony_ci      ub.x = round(255.0 * tmp0.x);  /* ub is a ubyte vector */
36215bd8deadSopenharmony_ci      ub.y = round(255.0 * tmp0.y);
36225bd8deadSopenharmony_ci      ub.z = round(255.0 * tmp0.z);
36235bd8deadSopenharmony_ci      ub.w = round(255.0 * tmp0.w);
36245bd8deadSopenharmony_ci      /* result obtained by combining raw bits of ub. */
36255bd8deadSopenharmony_ci      result.x = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
36265bd8deadSopenharmony_ci      result.y = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
36275bd8deadSopenharmony_ci      result.z = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
36285bd8deadSopenharmony_ci      result.w = ((ub.x) | (ub.y << 8) | (ub.z << 16) | (ub.w << 24));
36295bd8deadSopenharmony_ci
36305bd8deadSopenharmony_ci    PK4UB supports all three data type modifiers.  The single operand is
36315bd8deadSopenharmony_ci    always treated as a floating-point value, but the result is written as a
36325bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
36335bd8deadSopenharmony_ci    specified by the data type modifier.  For integer result variables, the
36345bd8deadSopenharmony_ci    bits can be interpreted as described above.  For floating-point result
36355bd8deadSopenharmony_ci    variables, the packed results do not constitute a meaningful
36365bd8deadSopenharmony_ci    floating-point variable and should only be used to feed future unpack
36375bd8deadSopenharmony_ci    instructions.
36385bd8deadSopenharmony_ci
36395bd8deadSopenharmony_ci    A program will fail to load if it contains a PK4UB instruction that writes
36405bd8deadSopenharmony_ci    its results to a variable declared as "SHORT".
36415bd8deadSopenharmony_ci
36425bd8deadSopenharmony_ci
36435bd8deadSopenharmony_ci    Section 2.X.8.Z, POW:  Exponentiate
36445bd8deadSopenharmony_ci
36455bd8deadSopenharmony_ci    The POW instruction approximates the value of the first scalar operand
36465bd8deadSopenharmony_ci    raised to the power of the second scalar operand and replicates it to all
36475bd8deadSopenharmony_ci    four components of the result vector.
36485bd8deadSopenharmony_ci
36495bd8deadSopenharmony_ci      tmp0 = ScalarLoad(op0);
36505bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
36515bd8deadSopenharmony_ci      result.x = ApproxPower(tmp0, tmp1);
36525bd8deadSopenharmony_ci      result.y = ApproxPower(tmp0, tmp1);
36535bd8deadSopenharmony_ci      result.z = ApproxPower(tmp0, tmp1);
36545bd8deadSopenharmony_ci      result.w = ApproxPower(tmp0, tmp1);
36555bd8deadSopenharmony_ci
36565bd8deadSopenharmony_ci    The exponentiation approximation function may be implemented using the
36575bd8deadSopenharmony_ci    base 2 exponentiation and logarithm approximation operations in the EX2
36585bd8deadSopenharmony_ci    and LG2 instructions.  In particular,
36595bd8deadSopenharmony_ci
36605bd8deadSopenharmony_ci      ApproxPower(a,b) = ApproxExp2(b * ApproxLog2(a)).
36615bd8deadSopenharmony_ci
36625bd8deadSopenharmony_ci    Note that a logarithm may be involved even for cases where the exponent is
36635bd8deadSopenharmony_ci    an integer.  This means that it may not be possible to exponentiate
36645bd8deadSopenharmony_ci    correctly with a negative base.  In constrast, it is possible in a
36655bd8deadSopenharmony_ci    "normal" mathematical formulation to raise negative numbers to integral
36665bd8deadSopenharmony_ci    powers (e.g., (-3)^2== 9, and (-0.5)^-2==4).
36675bd8deadSopenharmony_ci
36685bd8deadSopenharmony_ci    POW supports only floating-point data type modifiers.
36695bd8deadSopenharmony_ci
36705bd8deadSopenharmony_ci
36715bd8deadSopenharmony_ci    Section 2.X.8.Z, RCC:  Reciprocal (Clamped)
36725bd8deadSopenharmony_ci
36735bd8deadSopenharmony_ci    The RCC instruction approximates the reciprocal of the scalar operand,
36745bd8deadSopenharmony_ci    clamps the result to one of two ranges, and replicates the clamped result
36755bd8deadSopenharmony_ci    to all four components of the result vector.
36765bd8deadSopenharmony_ci
36775bd8deadSopenharmony_ci    If the approximated reciprocal is greater than 0.0, the result is clamped
36785bd8deadSopenharmony_ci    to the range [2^-64, 2^+64].  If the approximate reciprocal is not greater
36795bd8deadSopenharmony_ci    than zero, the result is clamped to the range [-2^+64, -2^-64].
36805bd8deadSopenharmony_ci
36815bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
36825bd8deadSopenharmony_ci      result.x = ClampApproxReciprocal(tmp);
36835bd8deadSopenharmony_ci      result.y = ClampApproxReciprocal(tmp);
36845bd8deadSopenharmony_ci      result.z = ClampApproxReciprocal(tmp);
36855bd8deadSopenharmony_ci      result.w = ClampApproxReciprocal(tmp);
36865bd8deadSopenharmony_ci
36875bd8deadSopenharmony_ci    RCC supports only floating-point data type modifiers.
36885bd8deadSopenharmony_ci
36895bd8deadSopenharmony_ci
36905bd8deadSopenharmony_ci    Section 2.X.8.Z, RCP:  Reciprocal
36915bd8deadSopenharmony_ci
36925bd8deadSopenharmony_ci    The RCP instruction approximates the reciprocal of the scalar operand and
36935bd8deadSopenharmony_ci    replicates it to all four components of the result vector.
36945bd8deadSopenharmony_ci
36955bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
36965bd8deadSopenharmony_ci      result.x = ApproxReciprocal(tmp);
36975bd8deadSopenharmony_ci      result.y = ApproxReciprocal(tmp);
36985bd8deadSopenharmony_ci      result.z = ApproxReciprocal(tmp);
36995bd8deadSopenharmony_ci      result.w = ApproxReciprocal(tmp);
37005bd8deadSopenharmony_ci
37015bd8deadSopenharmony_ci    RCP supports only floating-point data type modifiers.
37025bd8deadSopenharmony_ci
37035bd8deadSopenharmony_ci
37045bd8deadSopenharmony_ci    Section 2.X.8.Z, REP:  Start of Repeat Block
37055bd8deadSopenharmony_ci
37065bd8deadSopenharmony_ci    The REP instruction begins a REP/ENDREP block.  The REP instruction
37075bd8deadSopenharmony_ci    supports an optional operand whose x component specifies the initial value
37085bd8deadSopenharmony_ci    for the loop count.  The loop count indicates the number of times the
37095bd8deadSopenharmony_ci    instructions between the REP and corresponding ENDREP instruction will be
37105bd8deadSopenharmony_ci    executed.  If the initial value of the loop count is not positive, the
37115bd8deadSopenharmony_ci    entire block is skipped and execution continues at the instruction
37125bd8deadSopenharmony_ci    following the corresponding ENDREP instruction.  If the loop count is
37135bd8deadSopenharmony_ci    specified as a floating-point value, it is converted to the largest
37145bd8deadSopenharmony_ci    integer less than or equal to the specified value (i.e., taking its
37155bd8deadSopenharmony_ci    floor).
37165bd8deadSopenharmony_ci
37175bd8deadSopenharmony_ci    If no operand is provided to REP, the loop count is ignored and the
37185bd8deadSopenharmony_ci    corresponding ENDREP instruction unconditionally transfers control to the
37195bd8deadSopenharmony_ci    instruction immediately following the REP instruction.  The only way to
37205bd8deadSopenharmony_ci    exit such a loop is with the BRK instruction.  To prevent obvious infinite
37215bd8deadSopenharmony_ci    loops, a program that includes a REP/ENDREP block with no loop count will
37225bd8deadSopenharmony_ci    fail to compile unless it contains either a BRK instruction at the current
37235bd8deadSopenharmony_ci    nesting level or a RET instruction at any nesting level.
37245bd8deadSopenharmony_ci
37255bd8deadSopenharmony_ci    Implementations may have a limited ability to nest REP/ENDREP blocks.  If
37265bd8deadSopenharmony_ci    the number of REP/ENDREP blocks nested inside each other is
37275bd8deadSopenharmony_ci    MAX_PROGRAM_LOOP_DEPTH_NV or higher, a program will fail to compile.
37285bd8deadSopenharmony_ci
37295bd8deadSopenharmony_ci      // Set up loop information for the new nesting level.
37305bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
37315bd8deadSopenharmony_ci      LoopCount = floor(tmp.x);
37325bd8deadSopenharmony_ci      if (LoopCount <= 0) {
37335bd8deadSopenharmony_ci        continue execution at the corresponding ENDREP;
37345bd8deadSopenharmony_ci      }
37355bd8deadSopenharmony_ci
37365bd8deadSopenharmony_ci    REP supports all three data type modifiers.  The single operand is
37375bd8deadSopenharmony_ci    interpreted according to the data type modifier.
37385bd8deadSopenharmony_ci
37395bd8deadSopenharmony_ci    (Note:  Unlike the NV_fragment_program2 extension, REP blocks in this
37405bd8deadSopenharmony_ci    extension support fully general looping; the specified loop count can be
37415bd8deadSopenharmony_ci    computed in the program itself.  Additionally, there is no run-time limit
37425bd8deadSopenharmony_ci    on the maximum overall depth of REP/ENDREP nesting.  As long as each
37435bd8deadSopenharmony_ci    individual subroutine of the program obeys the static nesting limits,
37445bd8deadSopenharmony_ci    there will be no run-time errors in the program.  With the
37455bd8deadSopenharmony_ci    NV_fragment_program2 extension, a program could terminate abnormally if it
37465bd8deadSopenharmony_ci    called a subroutine inside a deeply nested set of REP/ENDREP blocks and
37475bd8deadSopenharmony_ci    the called subroutine also contained deeply nested REP/ENDREP blocks.
37485bd8deadSopenharmony_ci    Such an error could occur even if neither subroutine exceeded static
37495bd8deadSopenharmony_ci    limits.)
37505bd8deadSopenharmony_ci
37515bd8deadSopenharmony_ci
37525bd8deadSopenharmony_ci    Section 2.X.8.Z, RET:  Subroutine Return
37535bd8deadSopenharmony_ci
37545bd8deadSopenharmony_ci    The RET instruction conditionally returns from a subroutine initiated by a
37555bd8deadSopenharmony_ci    CAL instruction by popping an instruction reference off the top of the
37565bd8deadSopenharmony_ci    call stack and transferring control to the referenced instruction.  The
37575bd8deadSopenharmony_ci    following pseudocode describes the operation of the instruction:
37585bd8deadSopenharmony_ci
37595bd8deadSopenharmony_ci      if (TestCC(cc.c***) || TestCC(cc.*c**) || 
37605bd8deadSopenharmony_ci          TestCC(cc.**c*) || TestCC(cc.***c)) {
37615bd8deadSopenharmony_ci        if (callStackDepth <= 0) {
37625bd8deadSopenharmony_ci          // terminate program
37635bd8deadSopenharmony_ci        } else {
37645bd8deadSopenharmony_ci          callStackDepth--;
37655bd8deadSopenharmony_ci          instruction = callStack[callStackDepth];
37665bd8deadSopenharmony_ci        }
37675bd8deadSopenharmony_ci
37685bd8deadSopenharmony_ci        // continue execution at <instruction>
37695bd8deadSopenharmony_ci      } else {
37705bd8deadSopenharmony_ci        // do nothing
37715bd8deadSopenharmony_ci      }
37725bd8deadSopenharmony_ci
37735bd8deadSopenharmony_ci    In the pseudocode, <callStackDepth> is the depth of the call stack,
37745bd8deadSopenharmony_ci    <callStack> is an array holding the call stack, and <instruction> is a
37755bd8deadSopenharmony_ci    reference to an instruction previously pushed onto the call stack.
37765bd8deadSopenharmony_ci
37775bd8deadSopenharmony_ci    If the call stack is empty when RET executes, the program terminates
37785bd8deadSopenharmony_ci    normally.
37795bd8deadSopenharmony_ci
37805bd8deadSopenharmony_ci
37815bd8deadSopenharmony_ci    Section 2.X.8.Z, RFL:  Reflection Vector
37825bd8deadSopenharmony_ci
37835bd8deadSopenharmony_ci    The RFL instruction computes the reflection of the second vector operand
37845bd8deadSopenharmony_ci    (the "direction" vector) about the vector specified by the first vector
37855bd8deadSopenharmony_ci    operand (the "axis" vector).  Both operands are treated as 3D vectors (the
37865bd8deadSopenharmony_ci    w components are ignored).  The result vector is another 3D vector (the
37875bd8deadSopenharmony_ci    "reflected direction" vector).  The length of the result vector, ignoring
37885bd8deadSopenharmony_ci    rounding errors, should equal that of the second operand.
37895bd8deadSopenharmony_ci
37905bd8deadSopenharmony_ci      axis = VectorLoad(op0);
37915bd8deadSopenharmony_ci      direction = VectorLoad(op1);
37925bd8deadSopenharmony_ci      tmp.w = (axis.x * axis.x + axis.y * axis.y + axis.z * axis.z);
37935bd8deadSopenharmony_ci      tmp.x = (axis.x * direction.x + axis.y * direction.y + 
37945bd8deadSopenharmony_ci               axis.z * direction.z);
37955bd8deadSopenharmony_ci      tmp.x = 2.0 * tmp.x;
37965bd8deadSopenharmony_ci      tmp.x = tmp.x / tmp.w;
37975bd8deadSopenharmony_ci      result.x = tmp.x * axis.x - direction.x;
37985bd8deadSopenharmony_ci      result.y = tmp.x * axis.y - direction.y;
37995bd8deadSopenharmony_ci      result.z = tmp.x * axis.z - direction.z;
38005bd8deadSopenharmony_ci      result.w = undefined;
38015bd8deadSopenharmony_ci
38025bd8deadSopenharmony_ci    RFL supports only floating-point data type modifiers.
38035bd8deadSopenharmony_ci
38045bd8deadSopenharmony_ci
38055bd8deadSopenharmony_ci    Section 2.X.8.Z, ROUND:  Round to Nearest Integer
38065bd8deadSopenharmony_ci
38075bd8deadSopenharmony_ci    The ROUND instruction loads a single vector operand and performs a
38085bd8deadSopenharmony_ci    component-wise round operation to generate a result vector.
38095bd8deadSopenharmony_ci
38105bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
38115bd8deadSopenharmony_ci      result.x = round(tmp.x);
38125bd8deadSopenharmony_ci      result.y = round(tmp.y);
38135bd8deadSopenharmony_ci      result.z = round(tmp.z);
38145bd8deadSopenharmony_ci      result.w = round(tmp.w);
38155bd8deadSopenharmony_ci
38165bd8deadSopenharmony_ci    The round operation returns the nearest integer to the operand.  If the
38175bd8deadSopenharmony_ci    fractional portion of the operand is 0.5, round() selects the nearest even
38185bd8deadSopenharmony_ci    integer.  For example round(-1.7) = -2.0, round(+1.0) = +1.0, and
38195bd8deadSopenharmony_ci    round(+3.7) = +4.0.
38205bd8deadSopenharmony_ci
38215bd8deadSopenharmony_ci    ROUND supports all three data type modifiers.  The single operand is
38225bd8deadSopenharmony_ci    always treated as a floating-point value, but the result is written as a
38235bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
38245bd8deadSopenharmony_ci    specified by the data type modifier.  If a value is not exactly
38255bd8deadSopenharmony_ci    representable using the data type of the result (e.g., an overflow or
38265bd8deadSopenharmony_ci    writing a negative value to an unsigned integer), the result is undefined.
38275bd8deadSopenharmony_ci
38285bd8deadSopenharmony_ci
38295bd8deadSopenharmony_ci    Section 2.X.8.Z, RSQ:  Reciprocal Square Root
38305bd8deadSopenharmony_ci
38315bd8deadSopenharmony_ci    The RSQ instruction approximates the reciprocal of the square root of the
38325bd8deadSopenharmony_ci    scalar operand and replicates it to all four components of the result
38335bd8deadSopenharmony_ci    vector.
38345bd8deadSopenharmony_ci
38355bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
38365bd8deadSopenharmony_ci      result.x = ApproxRSQRT(tmp);
38375bd8deadSopenharmony_ci      result.y = ApproxRSQRT(tmp);
38385bd8deadSopenharmony_ci      result.z = ApproxRSQRT(tmp);
38395bd8deadSopenharmony_ci      result.w = ApproxRSQRT(tmp);
38405bd8deadSopenharmony_ci
38415bd8deadSopenharmony_ci    If the operand is less than or equal to zero, the results of the
38425bd8deadSopenharmony_ci    instruction are undefined.
38435bd8deadSopenharmony_ci
38445bd8deadSopenharmony_ci    RSQ supports only floating-point data type modifiers.
38455bd8deadSopenharmony_ci
38465bd8deadSopenharmony_ci    Note that this instruction differs from the RSQ instruction in
38475bd8deadSopenharmony_ci    ARB_vertex_program in that it does not implicitly take the absolute value
38485bd8deadSopenharmony_ci    of its operand.  The |abs| operator can be used to achieve equivalent
38495bd8deadSopenharmony_ci    semantics.
38505bd8deadSopenharmony_ci
38515bd8deadSopenharmony_ci
38525bd8deadSopenharmony_ci    Section 2.X.8.Z, SAD:  Sum of Absolute Differences
38535bd8deadSopenharmony_ci
38545bd8deadSopenharmony_ci    The SAD instruction performs a component-wise difference of the first two
38555bd8deadSopenharmony_ci    integer operands (subtracting the second from the first), and then does a
38565bd8deadSopenharmony_ci    component-wise add of the absolute value of the difference to the third
38575bd8deadSopenharmony_ci    unsigned integer operand to yield an unsigned integer result vector.
38585bd8deadSopenharmony_ci
38595bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
38605bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
38615bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
38625bd8deadSopenharmony_ci      result.x = abs(tmp0.x - tmp1.x) + tmp2.x;
38635bd8deadSopenharmony_ci      result.y = abs(tmp0.y - tmp1.y) + tmp2.y;
38645bd8deadSopenharmony_ci      result.z = abs(tmp0.z - tmp1.z) + tmp2.z;
38655bd8deadSopenharmony_ci      result.w = abs(tmp0.w - tmp1.w) + tmp2.w;
38665bd8deadSopenharmony_ci
38675bd8deadSopenharmony_ci    SAD supports signed and unsigned integer data type modifiers.  The first
38685bd8deadSopenharmony_ci    two operands are interpreted according to the data type modifier.  The
38695bd8deadSopenharmony_ci    third operand and the result are always unsigned integers.
38705bd8deadSopenharmony_ci
38715bd8deadSopenharmony_ci
38725bd8deadSopenharmony_ci    Section 2.X.8.Z, SCS:  Sine/Cosine without Reduction
38735bd8deadSopenharmony_ci
38745bd8deadSopenharmony_ci    The SCS instruction approximates the trigonometric sine and cosine of the
38755bd8deadSopenharmony_ci    angle specified by the scalar operand and places the cosine in the x
38765bd8deadSopenharmony_ci    component and the sine in the y component of the result vector.  The z and
38775bd8deadSopenharmony_ci    w components of the result vector are undefined.  The angle is specified
38785bd8deadSopenharmony_ci    in radians and must be in the range [-PI,PI].
38795bd8deadSopenharmony_ci
38805bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
38815bd8deadSopenharmony_ci      result.x = ApproxCosine(tmp);
38825bd8deadSopenharmony_ci      result.y = ApproxSine(tmp);
38835bd8deadSopenharmony_ci      result.z = undefined;
38845bd8deadSopenharmony_ci      result.w = undefined;
38855bd8deadSopenharmony_ci
38865bd8deadSopenharmony_ci    If the scalar operand is not in the range [-PI,PI], the result vector is
38875bd8deadSopenharmony_ci    undefined.
38885bd8deadSopenharmony_ci
38895bd8deadSopenharmony_ci    SCS supports only floating-point data type modifiers.
38905bd8deadSopenharmony_ci
38915bd8deadSopenharmony_ci
38925bd8deadSopenharmony_ci    Section 2.X.8.Z, SEQ:  Set on Equal
38935bd8deadSopenharmony_ci
38945bd8deadSopenharmony_ci    The SEQ instruction performs a component-wise comparison of the two
38955bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
38965bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
38975bd8deadSopenharmony_ci    equal to that of the second, and a FALSE value otherwise.
38985bd8deadSopenharmony_ci
38995bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
39005bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
39015bd8deadSopenharmony_ci      result.x = (tmp0.x == tmp1.x) ? TRUE : FALSE;
39025bd8deadSopenharmony_ci      result.y = (tmp0.y == tmp1.y) ? TRUE : FALSE;
39035bd8deadSopenharmony_ci      result.z = (tmp0.z == tmp1.z) ? TRUE : FALSE;
39045bd8deadSopenharmony_ci      result.w = (tmp0.w == tmp1.w) ? TRUE : FALSE;
39055bd8deadSopenharmony_ci
39065bd8deadSopenharmony_ci    SEQ supports all data type modifiers.  For floating-point data types, the
39075bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
39085bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
39095bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
39105bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
39115bd8deadSopenharmony_ci
39125bd8deadSopenharmony_ci
39135bd8deadSopenharmony_ci    Section 2.X.8.Z, SFL:  Set on False
39145bd8deadSopenharmony_ci
39155bd8deadSopenharmony_ci    The SFL instruction is a degenerate case of the other "Set on"
39165bd8deadSopenharmony_ci    instructions that sets all components of the result vector to a FALSE
39175bd8deadSopenharmony_ci    value (described below).
39185bd8deadSopenharmony_ci
39195bd8deadSopenharmony_ci      result.x = FALSE;
39205bd8deadSopenharmony_ci      result.y = FALSE;
39215bd8deadSopenharmony_ci      result.z = FALSE;
39225bd8deadSopenharmony_ci      result.w = FALSE;
39235bd8deadSopenharmony_ci
39245bd8deadSopenharmony_ci    SFL supports all data type modifiers.  For floating-point data types, the
39255bd8deadSopenharmony_ci    FALSE value is 0.0.  For signed and unsigned integer data types, the FALSE
39265bd8deadSopenharmony_ci    value is zero.
39275bd8deadSopenharmony_ci
39285bd8deadSopenharmony_ci
39295bd8deadSopenharmony_ci    Section 2.X.8.Z, SGE:  Set on Greater Than or Equal
39305bd8deadSopenharmony_ci
39315bd8deadSopenharmony_ci    The SGE instruction performs a component-wise comparison of the two
39325bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
39335bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
39345bd8deadSopenharmony_ci    greater than or equal to that of the second, and a FALSE value otherwise.
39355bd8deadSopenharmony_ci
39365bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
39375bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
39385bd8deadSopenharmony_ci      result.x = (tmp0.x >= tmp1.x) ? TRUE : FALSE;
39395bd8deadSopenharmony_ci      result.y = (tmp0.y >= tmp1.y) ? TRUE : FALSE;
39405bd8deadSopenharmony_ci      result.z = (tmp0.z >= tmp1.z) ? TRUE : FALSE;
39415bd8deadSopenharmony_ci      result.w = (tmp0.w >= tmp1.w) ? TRUE : FALSE;
39425bd8deadSopenharmony_ci
39435bd8deadSopenharmony_ci    SGE supports all data type modifiers.  For floating-point data types, the
39445bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
39455bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
39465bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
39475bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
39485bd8deadSopenharmony_ci
39495bd8deadSopenharmony_ci
39505bd8deadSopenharmony_ci    Section 2.X.8.Z, SGT:  Set on Greater Than
39515bd8deadSopenharmony_ci
39525bd8deadSopenharmony_ci    The SGT instruction performs a component-wise comparison of the two
39535bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
39545bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
39555bd8deadSopenharmony_ci    greater than that of the second, and a FALSE value otherwise.
39565bd8deadSopenharmony_ci
39575bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
39585bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
39595bd8deadSopenharmony_ci      result.x = (tmp0.x > tmp1.x) ? TRUE : FALSE;
39605bd8deadSopenharmony_ci      result.y = (tmp0.y > tmp1.y) ? TRUE : FALSE;
39615bd8deadSopenharmony_ci      result.z = (tmp0.z > tmp1.z) ? TRUE : FALSE;
39625bd8deadSopenharmony_ci      result.w = (tmp0.w > tmp1.w) ? TRUE : FALSE;
39635bd8deadSopenharmony_ci
39645bd8deadSopenharmony_ci    SGT supports all data type modifiers.  For floating-point data types, the
39655bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
39665bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
39675bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
39685bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
39695bd8deadSopenharmony_ci
39705bd8deadSopenharmony_ci
39715bd8deadSopenharmony_ci    Section 2.X.8.Z, SHL:  Shift Left
39725bd8deadSopenharmony_ci
39735bd8deadSopenharmony_ci    The SHL instruction performs a component-wise left shift of the bits of
39745bd8deadSopenharmony_ci    the first operand by the value of the second scalar operand to produce a
39755bd8deadSopenharmony_ci    result vector.  The bits vacated during the shift operation are filled
39765bd8deadSopenharmony_ci    with zeroes.
39775bd8deadSopenharmony_ci
39785bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
39795bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
39805bd8deadSopenharmony_ci      result.x = tmp0.x << tmp1;
39815bd8deadSopenharmony_ci      result.y = tmp0.y << tmp1;
39825bd8deadSopenharmony_ci      result.z = tmp0.z << tmp1;
39835bd8deadSopenharmony_ci      result.w = tmp0.w << tmp1;
39845bd8deadSopenharmony_ci
39855bd8deadSopenharmony_ci    The results of a shift operation ("<<") are undefined if the value of the
39865bd8deadSopenharmony_ci    second operand is negative, or greater than or equal to the number of bits
39875bd8deadSopenharmony_ci    in the first operand.
39885bd8deadSopenharmony_ci
39895bd8deadSopenharmony_ci    SHL supports both signed and unsigned integer data type modifiers.  If no
39905bd8deadSopenharmony_ci    modifier is provided, the operands and the result are treated as signed
39915bd8deadSopenharmony_ci    integers.
39925bd8deadSopenharmony_ci
39935bd8deadSopenharmony_ci
39945bd8deadSopenharmony_ci    Section 2.X.8.Z, SHR:  Shift Right
39955bd8deadSopenharmony_ci
39965bd8deadSopenharmony_ci    The SHR instruction performs a component-wise right shift of the bits of
39975bd8deadSopenharmony_ci    the first operand by the value of the second scalar operand to produce a
39985bd8deadSopenharmony_ci    result vector.  The bits vacated during shift operation are filled with
39995bd8deadSopenharmony_ci    zeros if the operand is non-negative and ones otherwise.
40005bd8deadSopenharmony_ci
40015bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
40025bd8deadSopenharmony_ci      tmp1 = ScalarLoad(op1);
40035bd8deadSopenharmony_ci      result.x = tmp0.x >> tmp1;
40045bd8deadSopenharmony_ci      result.y = tmp0.y >> tmp1;
40055bd8deadSopenharmony_ci      result.z = tmp0.z >> tmp1;
40065bd8deadSopenharmony_ci      result.w = tmp0.w >> tmp1;
40075bd8deadSopenharmony_ci
40085bd8deadSopenharmony_ci    The results of a shift operation (">>") are undefined if the value of the
40095bd8deadSopenharmony_ci    second operand is negative, or greater than or equal to the number of bits
40105bd8deadSopenharmony_ci    in the first operand.
40115bd8deadSopenharmony_ci
40125bd8deadSopenharmony_ci    SHR supports both signed and unsigned integer data type modifiers.  If no
40135bd8deadSopenharmony_ci    modifiers are provided, the operands and the result are treated as signed
40145bd8deadSopenharmony_ci    integers.
40155bd8deadSopenharmony_ci
40165bd8deadSopenharmony_ci
40175bd8deadSopenharmony_ci    Section 2.X.8.Z, SIN:  Sine with Reduction to [-PI,PI]
40185bd8deadSopenharmony_ci
40195bd8deadSopenharmony_ci    The SIN instruction approximates the trigonometric sine of the angle
40205bd8deadSopenharmony_ci    specified by the scalar operand and replicates it to all four components
40215bd8deadSopenharmony_ci    of the result vector.  The angle is specified in radians and does not have
40225bd8deadSopenharmony_ci    to be in the range [-PI,PI].
40235bd8deadSopenharmony_ci
40245bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
40255bd8deadSopenharmony_ci      result.x = ApproxSine(tmp);
40265bd8deadSopenharmony_ci      result.y = ApproxSine(tmp);
40275bd8deadSopenharmony_ci      result.z = ApproxSine(tmp);
40285bd8deadSopenharmony_ci      result.w = ApproxSine(tmp);
40295bd8deadSopenharmony_ci
40305bd8deadSopenharmony_ci    SIN supports only floating-point data type modifiers.
40315bd8deadSopenharmony_ci
40325bd8deadSopenharmony_ci
40335bd8deadSopenharmony_ci    Section 2.X.8.Z, SLE:  Set on Less Than or Equal
40345bd8deadSopenharmony_ci
40355bd8deadSopenharmony_ci    The SLE instruction performs a component-wise comparison of the two
40365bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
40375bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
40385bd8deadSopenharmony_ci    less than or equal to that of the second, and a FALSE value otherwise.
40395bd8deadSopenharmony_ci
40405bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
40415bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
40425bd8deadSopenharmony_ci      result.x = (tmp0.x <= tmp1.x) ? TRUE : FALSE;
40435bd8deadSopenharmony_ci      result.y = (tmp0.y <= tmp1.y) ? TRUE : FALSE;
40445bd8deadSopenharmony_ci      result.z = (tmp0.z <= tmp1.z) ? TRUE : FALSE;
40455bd8deadSopenharmony_ci      result.w = (tmp0.w <= tmp1.w) ? TRUE : FALSE;
40465bd8deadSopenharmony_ci
40475bd8deadSopenharmony_ci    SLE supports all data type modifiers.  For floating-point data types, the
40485bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
40495bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
40505bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
40515bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
40525bd8deadSopenharmony_ci
40535bd8deadSopenharmony_ci
40545bd8deadSopenharmony_ci    Section 2.X.8.Z, SLT:  Set on Less Than
40555bd8deadSopenharmony_ci
40565bd8deadSopenharmony_ci    The SLT instruction performs a component-wise comparison of the two
40575bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
40585bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
40595bd8deadSopenharmony_ci    less than that of the second, and a FALSE value otherwise.
40605bd8deadSopenharmony_ci
40615bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
40625bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
40635bd8deadSopenharmony_ci      result.x = (tmp0.x < tmp1.x) ? TRUE : FALSE;
40645bd8deadSopenharmony_ci      result.y = (tmp0.y < tmp1.y) ? TRUE : FALSE;
40655bd8deadSopenharmony_ci      result.z = (tmp0.z < tmp1.z) ? TRUE : FALSE;
40665bd8deadSopenharmony_ci      result.w = (tmp0.w < tmp1.w) ? TRUE : FALSE;
40675bd8deadSopenharmony_ci
40685bd8deadSopenharmony_ci    SLT supports all data type modifiers.  For floating-point data types, the
40695bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
40705bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
40715bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
40725bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
40735bd8deadSopenharmony_ci
40745bd8deadSopenharmony_ci
40755bd8deadSopenharmony_ci    Section 2.X.8.Z, SNE:  Set on Not Equal
40765bd8deadSopenharmony_ci
40775bd8deadSopenharmony_ci    The SNE instruction performs a component-wise comparison of the two
40785bd8deadSopenharmony_ci    operands.  Each component of the result vector returns a TRUE value
40795bd8deadSopenharmony_ci    (described below) if the corresponding component of the first operand is
40805bd8deadSopenharmony_ci    less than that of the second, and a FALSE value otherwise.
40815bd8deadSopenharmony_ci
40825bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
40835bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
40845bd8deadSopenharmony_ci      result.x = (tmp0.x != tmp1.x) ? TRUE : FALSE;
40855bd8deadSopenharmony_ci      result.y = (tmp0.y != tmp1.y) ? TRUE : FALSE;
40865bd8deadSopenharmony_ci      result.z = (tmp0.z != tmp1.z) ? TRUE : FALSE;
40875bd8deadSopenharmony_ci      result.w = (tmp0.w != tmp1.w) ? TRUE : FALSE;
40885bd8deadSopenharmony_ci
40895bd8deadSopenharmony_ci    SNE supports all data type modifiers.  For floating-point data types, the
40905bd8deadSopenharmony_ci    TRUE value is 1.0 and the FALSE value is 0.0.  For signed integer data
40915bd8deadSopenharmony_ci    types, the TRUE value is -1 and the FALSE value is 0.  For unsigned
40925bd8deadSopenharmony_ci    integer data types, the TRUE value is the maximum integer value (all bits
40935bd8deadSopenharmony_ci    are ones) and the FALSE value is zero.
40945bd8deadSopenharmony_ci
40955bd8deadSopenharmony_ci
40965bd8deadSopenharmony_ci    Section 2.X.8.Z, SSG:  Set Sign
40975bd8deadSopenharmony_ci
40985bd8deadSopenharmony_ci    The SSG instruction generates a result vector containing the signs of
40995bd8deadSopenharmony_ci    each component of the single vector operand.  Each component of the
41005bd8deadSopenharmony_ci    result vector is 1.0 if the corresponding component of the operand
41015bd8deadSopenharmony_ci    is greater than zero, 0.0 if the corresponding component of the
41025bd8deadSopenharmony_ci    operand is equal to zero, and -1.0 if the corresponding component
41035bd8deadSopenharmony_ci    of the operand is less than zero.
41045bd8deadSopenharmony_ci
41055bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
41065bd8deadSopenharmony_ci      result.x = SetSign(tmp.x);
41075bd8deadSopenharmony_ci      result.y = SetSign(tmp.y);
41085bd8deadSopenharmony_ci      result.z = SetSign(tmp.z);
41095bd8deadSopenharmony_ci      result.w = SetSign(tmp.w);
41105bd8deadSopenharmony_ci
41115bd8deadSopenharmony_ci    SSG supports only floating-point data type modifiers.
41125bd8deadSopenharmony_ci
41135bd8deadSopenharmony_ci
41145bd8deadSopenharmony_ci    Section 2.X.8.Z, STR:  Set on True
41155bd8deadSopenharmony_ci
41165bd8deadSopenharmony_ci    The STR instruction is a degenerate case of the other "Set on"
41175bd8deadSopenharmony_ci    instructions that sets all components of the result vector to a TRUE value
41185bd8deadSopenharmony_ci    (described below).
41195bd8deadSopenharmony_ci
41205bd8deadSopenharmony_ci      result.x = TRUE;
41215bd8deadSopenharmony_ci      result.y = TRUE;
41225bd8deadSopenharmony_ci      result.z = TRUE;
41235bd8deadSopenharmony_ci      result.w = TRUE;
41245bd8deadSopenharmony_ci
41255bd8deadSopenharmony_ci    STR supports all data type modifiers.  For floating-point data types, the
41265bd8deadSopenharmony_ci    TRUE value is 1.0.  For signed integer data types, the TRUE value is -1.
41275bd8deadSopenharmony_ci    For unsigned integer data types, the TRUE value is the maximum integer
41285bd8deadSopenharmony_ci    value (all bits are ones).
41295bd8deadSopenharmony_ci
41305bd8deadSopenharmony_ci
41315bd8deadSopenharmony_ci    Section 2.X.8.Z, SUB:  Subtract
41325bd8deadSopenharmony_ci
41335bd8deadSopenharmony_ci    The SUB instruction performs a component-wise subtraction of the second
41345bd8deadSopenharmony_ci    operand from the first to yield a result vector.
41355bd8deadSopenharmony_ci
41365bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
41375bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
41385bd8deadSopenharmony_ci      result.x = tmp0.x - tmp1.x;
41395bd8deadSopenharmony_ci      result.y = tmp0.y - tmp1.y;
41405bd8deadSopenharmony_ci      result.z = tmp0.z - tmp1.z;
41415bd8deadSopenharmony_ci      result.w = tmp0.w - tmp1.w;
41425bd8deadSopenharmony_ci
41435bd8deadSopenharmony_ci    SUB supports all three data type modifiers.
41445bd8deadSopenharmony_ci
41455bd8deadSopenharmony_ci
41465bd8deadSopenharmony_ci    Section 2.X.8.Z, SWZ:  Extended Swizzle
41475bd8deadSopenharmony_ci
41485bd8deadSopenharmony_ci    The SWZ instruction loads the single vector operand, and performs a
41495bd8deadSopenharmony_ci    swizzle operation more powerful than that provided for loading normal
41505bd8deadSopenharmony_ci    vector operands to yield an instruction vector.
41515bd8deadSopenharmony_ci
41525bd8deadSopenharmony_ci    After the operand is loaded, the "x", "y", "z", and "w" components of the
41535bd8deadSopenharmony_ci    result vector are selected by the first, second, third, and fourth matches
41545bd8deadSopenharmony_ci    of the <extSwizComp> pattern in the <extendedSwizzle> rule.
41555bd8deadSopenharmony_ci
41565bd8deadSopenharmony_ci    A result component can be selected from any of the four components of the
41575bd8deadSopenharmony_ci    operand or the constants 0.0 and 1.0.  The result component can also be
41585bd8deadSopenharmony_ci    optionally negated.  The following pseudocode describes the component
41595bd8deadSopenharmony_ci    selection method.  "operand" refers to the vector operand, "select" is an
41605bd8deadSopenharmony_ci    enumerant where the values ZERO, ONE, X, Y, Z, and W correspond to the
41615bd8deadSopenharmony_ci    <extSwizSel> rule matching "0", "1", "x", "y", "z", and "w", respectively.
41625bd8deadSopenharmony_ci    "negate" is TRUE if and only if the <optionalSign> rule in <extSwizComp>
41635bd8deadSopenharmony_ci    matches "-".
41645bd8deadSopenharmony_ci
41655bd8deadSopenharmony_ci      float ExtSwizComponent(floatVec operand, enum select, boolean negate)
41665bd8deadSopenharmony_ci      {
41675bd8deadSopenharmony_ci          float result;
41685bd8deadSopenharmony_ci          switch (select) {
41695bd8deadSopenharmony_ci            case ZERO:  result = 0.0; break;
41705bd8deadSopenharmony_ci            case ONE:   result = 1.0; break;
41715bd8deadSopenharmony_ci            case X:     result = operand.x; break;
41725bd8deadSopenharmony_ci            case Y:     result = operand.y; break;
41735bd8deadSopenharmony_ci            case Z:     result = operand.z; break;
41745bd8deadSopenharmony_ci            case W:     result = operand.w; break;
41755bd8deadSopenharmony_ci          }
41765bd8deadSopenharmony_ci          if (negate) {
41775bd8deadSopenharmony_ci            result = -result;
41785bd8deadSopenharmony_ci          }
41795bd8deadSopenharmony_ci          return result;
41805bd8deadSopenharmony_ci      }
41815bd8deadSopenharmony_ci
41825bd8deadSopenharmony_ci    The entire extended swizzle operation is then defined using the following
41835bd8deadSopenharmony_ci    pseudocode:
41845bd8deadSopenharmony_ci
41855bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
41865bd8deadSopenharmony_ci      result.x = ExtSwizComponent(tmp, xSelect, xNegate);
41875bd8deadSopenharmony_ci      result.y = ExtSwizComponent(tmp, ySelect, yNegate);
41885bd8deadSopenharmony_ci      result.z = ExtSwizComponent(tmp, zSelect, zNegate);
41895bd8deadSopenharmony_ci      result.w = ExtSwizComponent(tmp, wSelect, wNegate);
41905bd8deadSopenharmony_ci
41915bd8deadSopenharmony_ci    "xSelect", "xNegate", "ySelect", "yNegate", "zSelect", "zNegate",
41925bd8deadSopenharmony_ci    "wSelect", and "wNegate" correspond to the "select" and "negate" values
41935bd8deadSopenharmony_ci    above for the four <extSwizComp> matches.  
41945bd8deadSopenharmony_ci
41955bd8deadSopenharmony_ci    Since this instruction allows for component selection and negation for
41965bd8deadSopenharmony_ci    each individual component, the grammar does not allow the use of the
41975bd8deadSopenharmony_ci    normal swizzle and negation operations allowed for vector operands in
41985bd8deadSopenharmony_ci    other instructions.
41995bd8deadSopenharmony_ci
42005bd8deadSopenharmony_ci    SWZ supports only floating-point data type modifiers.
42015bd8deadSopenharmony_ci
42025bd8deadSopenharmony_ci
42035bd8deadSopenharmony_ci    Section 2.X.8.Z, TEX:  Texture Sample
42045bd8deadSopenharmony_ci
42055bd8deadSopenharmony_ci    The TEX instruction takes the four components of a single floating-point
42065bd8deadSopenharmony_ci    source vector and performs a filtered texture access as described in
42075bd8deadSopenharmony_ci    Section 2.X.4.4.  The returned (R,G,B,A) value is written to the
42085bd8deadSopenharmony_ci    floating-point result vector.  Partial derivatives and the level of detail
42095bd8deadSopenharmony_ci    are computed automatically.
42105bd8deadSopenharmony_ci
42115bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
42125bd8deadSopenharmony_ci      ddx = ComputePartialsX(tmp);
42135bd8deadSopenharmony_ci      ddy = ComputePartialsY(tmp);
42145bd8deadSopenharmony_ci      lambda = ComputeLOD(ddx, ddy);
42155bd8deadSopenharmony_ci      result = TextureSample(tmp, lambda, ddx, ddy, texelOffset);
42165bd8deadSopenharmony_ci
42175bd8deadSopenharmony_ci    TEX supports all three data type modifiers.  The single operand is always
42185bd8deadSopenharmony_ci    treated as a floating-point vector; the results are interpreted according
42195bd8deadSopenharmony_ci    to the data type modifier.
42205bd8deadSopenharmony_ci
42215bd8deadSopenharmony_ci
42225bd8deadSopenharmony_ci    Section 2.X.8.Z, TRUNC:  Truncate (Round Toward Zero)
42235bd8deadSopenharmony_ci
42245bd8deadSopenharmony_ci    The TRUNC instruction loads a single vector operand and performs a
42255bd8deadSopenharmony_ci    component-wise truncate operation to generate a result vector.
42265bd8deadSopenharmony_ci
42275bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
42285bd8deadSopenharmony_ci      result.x = trunc(tmp.x);
42295bd8deadSopenharmony_ci      result.y = trunc(tmp.y);
42305bd8deadSopenharmony_ci      result.z = trunc(tmp.z);
42315bd8deadSopenharmony_ci      result.w = trunc(tmp.w);
42325bd8deadSopenharmony_ci
42335bd8deadSopenharmony_ci    The truncate operation returns the nearest integer to zero smaller in
42345bd8deadSopenharmony_ci    magnitude than the operand.  For example trunc(-1.7) = -1.0, trunc(+1.0) =
42355bd8deadSopenharmony_ci    +1.0, and trunc(+3.7) = +3.0.
42365bd8deadSopenharmony_ci
42375bd8deadSopenharmony_ci    TRUNC supports all three data type modifiers.  The single operand is
42385bd8deadSopenharmony_ci    always treated as a floating-point value, but the result is written as a
42395bd8deadSopenharmony_ci    floating-point value, a signed integer, or an unsigned integer, as
42405bd8deadSopenharmony_ci    specified by the data type modifier.  If a value is not exactly
42415bd8deadSopenharmony_ci    representable using the data type of the result (e.g., an overflow or
42425bd8deadSopenharmony_ci    writing a negative value to an unsigned integer), the result is undefined.
42435bd8deadSopenharmony_ci
42445bd8deadSopenharmony_ci
42455bd8deadSopenharmony_ci    Section 2.X.8.Z, TXB:  Texture Sample with Bias
42465bd8deadSopenharmony_ci
42475bd8deadSopenharmony_ci    The TXB instruction takes the four components of a single floating-point
42485bd8deadSopenharmony_ci    source vector and performs a filtered texture access as described in
42495bd8deadSopenharmony_ci    Section 2.X.4.4.  The returned (R,G,B,A) value is written to the
42505bd8deadSopenharmony_ci    floating-point result vector.  Partial derivatives and the level of detail
42515bd8deadSopenharmony_ci    are computed automatically, but the fourth component of the source vector
42525bd8deadSopenharmony_ci    is added to the computed LOD prior to sampling.
42535bd8deadSopenharmony_ci
42545bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
42555bd8deadSopenharmony_ci      ddx = ComputePartialsX(tmp);
42565bd8deadSopenharmony_ci      ddy = ComputePartialsY(tmp);
42575bd8deadSopenharmony_ci      lambda = ComputeLOD(ddx, ddy);
42585bd8deadSopenharmony_ci      result = TextureSample(tmp, lambda + tmp.w, ddx, ddy, texelOffset);
42595bd8deadSopenharmony_ci
42605bd8deadSopenharmony_ci    The single source vector in the TXB instruction does not have enough
42615bd8deadSopenharmony_ci    coordinates to specify a lookup into a two-dimensional array texture or
42625bd8deadSopenharmony_ci    cube map texture with both an LOD bias and an explicit reference value for
42635bd8deadSopenharmony_ci    depth comparison.  A program will fail to load if it contains a TXB
42645bd8deadSopenharmony_ci    instruction with a target of SHADOWCUBE or SHADOWARRAY2D.
42655bd8deadSopenharmony_ci
42665bd8deadSopenharmony_ci    TXB supports all three data type modifiers.  The single operand is always
42675bd8deadSopenharmony_ci    treated as a floating-point vector; the results are interpreted according
42685bd8deadSopenharmony_ci    to the data type modifier.
42695bd8deadSopenharmony_ci
42705bd8deadSopenharmony_ci
42715bd8deadSopenharmony_ci    Section 2.X.8.Z, TXD:  Texture Sample with Partials      
42725bd8deadSopenharmony_ci
42735bd8deadSopenharmony_ci    The TXD instruction takes the four components of the first floating-point
42745bd8deadSopenharmony_ci    source vector and performs a filtered texture access as described in
42755bd8deadSopenharmony_ci    Section 2.X.4.4.  The returned (R,G,B,A) value is written to the
42765bd8deadSopenharmony_ci    floating-point result vector.  The partial derivatives of the texture
42775bd8deadSopenharmony_ci    coordinates with respect to X and Y are specified by the second and third
42785bd8deadSopenharmony_ci    floating-point source vectors.  The level of detail is computed
42795bd8deadSopenharmony_ci    automatically using the provided partial derivatives.
42805bd8deadSopenharmony_ci
42815bd8deadSopenharmony_ci    Note that for cube map texture targets, the provided partial derivatives
42825bd8deadSopenharmony_ci    are in the coordinate system used before texture coordinates are projected
42835bd8deadSopenharmony_ci    onto the appropriate cube face.  The partial derivatives of the
42845bd8deadSopenharmony_ci    post-projection texture coordinates, which are used for level-of-detail
42855bd8deadSopenharmony_ci    and anisotropic filtering calculations, are derived from the original
42865bd8deadSopenharmony_ci    coordinates and partial derivatives in an implementation-dependent manner.
42875bd8deadSopenharmony_ci
42885bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
42895bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
42905bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
42915bd8deadSopenharmony_ci      lambda = ComputeLOD(tmp1, tmp2);
42925bd8deadSopenharmony_ci      result = TextureSample(tmp0, lambda, tmp1, tmp2, texelOffset);
42935bd8deadSopenharmony_ci
42945bd8deadSopenharmony_ci    TXD supports all three data type modifiers.  All three operands are always
42955bd8deadSopenharmony_ci    treated as floating-point vectors; the results are interpreted according
42965bd8deadSopenharmony_ci    to the data type modifier.
42975bd8deadSopenharmony_ci
42985bd8deadSopenharmony_ci
42995bd8deadSopenharmony_ci    Section 2.X.8.Z, TXF:  Texel Fetch
43005bd8deadSopenharmony_ci
43015bd8deadSopenharmony_ci    The TXF instruction takes the four components of a single signed integer
43025bd8deadSopenharmony_ci    source vector and performs a single texel fetch as described in Section
43035bd8deadSopenharmony_ci    2.X.4.4.  The first three components provide the <i>, <j>, and <k> values
43045bd8deadSopenharmony_ci    for the texel fetch, and the fourth component is used to determine the LOD
43055bd8deadSopenharmony_ci    to access.  The returned (R,G,B,A) value is written to the floating-point
43065bd8deadSopenharmony_ci    result vector.  Partial derivatives are irrelevant for single texel
43075bd8deadSopenharmony_ci    fetches.
43085bd8deadSopenharmony_ci
43095bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
43105bd8deadSopenharmony_ci      result = TexelFetch(tmp, texelOffset);
43115bd8deadSopenharmony_ci
43125bd8deadSopenharmony_ci    TXF supports all three data type modifiers.  The single vector operand is
43135bd8deadSopenharmony_ci    treated as a signed integer vector; the results are interpreted according
43145bd8deadSopenharmony_ci    to the data type modifier.
43155bd8deadSopenharmony_ci
43165bd8deadSopenharmony_ci
43175bd8deadSopenharmony_ci    Section 2.X.8.Z, TXL:  Texture Sample with LOD
43185bd8deadSopenharmony_ci
43195bd8deadSopenharmony_ci    The TXL instruction takes the four components of a single floating-point
43205bd8deadSopenharmony_ci    source vector and performs a filtered texture access as described in
43215bd8deadSopenharmony_ci    Section 2.X.4.4.  The returned (R,G,B,A) value is written to the
43225bd8deadSopenharmony_ci    floating-point result vector.  The level of detail is taken from the
43235bd8deadSopenharmony_ci    fourth component of the source vector.
43245bd8deadSopenharmony_ci
43255bd8deadSopenharmony_ci    Partial derivatives are not computed by the TXL instruction and
43265bd8deadSopenharmony_ci    anisotropic filtering is not performed.
43275bd8deadSopenharmony_ci
43285bd8deadSopenharmony_ci      tmp = VectorLoad(op0);
43295bd8deadSopenharmony_ci      ddx = (0,0,0);
43305bd8deadSopenharmony_ci      ddy = (0,0,0);
43315bd8deadSopenharmony_ci      result = TextureSample(tmp, tmp.w, ddx, ddy, texelOffset);
43325bd8deadSopenharmony_ci
43335bd8deadSopenharmony_ci    The single source vector in the TXL instruction does not have enough
43345bd8deadSopenharmony_ci    coordinates to specify a lookup into a 2D array or cube map texture with
43355bd8deadSopenharmony_ci    both an explicit LOD and a reference value for depth comparison.  A
43365bd8deadSopenharmony_ci    program will fail to load if it contains a TXL instruction with a target
43375bd8deadSopenharmony_ci    of SHADOWCUBE or SHADOWARRAY2D.
43385bd8deadSopenharmony_ci
43395bd8deadSopenharmony_ci    TXL supports all three data type modifiers.  The single vector operand is
43405bd8deadSopenharmony_ci    treated as a floating-point vector; the results are interpreted according
43415bd8deadSopenharmony_ci    to the data type modifier.
43425bd8deadSopenharmony_ci
43435bd8deadSopenharmony_ci
43445bd8deadSopenharmony_ci    Section 2.X.8.Z, TXP:  Texture Sample with Projection
43455bd8deadSopenharmony_ci
43465bd8deadSopenharmony_ci    The TXP instruction divides the first three components of its single
43475bd8deadSopenharmony_ci    floating-point source vector by its fourth component, maps the results to
43485bd8deadSopenharmony_ci    s, t, and r, and performs a filtered texture access as described in
43495bd8deadSopenharmony_ci    Section 2.X.4.4.  The returned (R,G,B,A) value is written to the
43505bd8deadSopenharmony_ci    floating-point result vector.  Partial derivatives and the level of detail
43515bd8deadSopenharmony_ci    are computed automatically.
43525bd8deadSopenharmony_ci
43535bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
43545bd8deadSopenharmony_ci      tmp0.x = tmp0.x / tmp0.w;
43555bd8deadSopenharmony_ci      tmp0.y = tmp0.y / tmp0.w;
43565bd8deadSopenharmony_ci      tmp0.z = tmp0.z / tmp0.w;
43575bd8deadSopenharmony_ci      ddx = ComputePartialsX(tmp);
43585bd8deadSopenharmony_ci      ddy = ComputePartialsY(tmp);
43595bd8deadSopenharmony_ci      lambda = ComputeLOD(ddx, ddy);
43605bd8deadSopenharmony_ci      result = TextureSample(tmp, lambda, ddx, ddy, texelOffset);
43615bd8deadSopenharmony_ci
43625bd8deadSopenharmony_ci    The single source vector in the TXP instruction does not have enough
43635bd8deadSopenharmony_ci    coordinates to specify a lookup into a 2D array or cube map texture with
43645bd8deadSopenharmony_ci    both a Q coordinate and an explicit reference value for depth comparison.
43655bd8deadSopenharmony_ci    A program will fail to load if it contains a TXP instruction with a target
43665bd8deadSopenharmony_ci    of SHADOWCUBE or SHADOWARRAY2D.
43675bd8deadSopenharmony_ci
43685bd8deadSopenharmony_ci    TXP supports all three data type modifiers.  The single vector operand is
43695bd8deadSopenharmony_ci    treated as a floating-point vector; the results are interpreted according
43705bd8deadSopenharmony_ci    to the data type modifier.
43715bd8deadSopenharmony_ci
43725bd8deadSopenharmony_ci
43735bd8deadSopenharmony_ci    Section 2.X.8.Z, TXQ:  Texture Size Query
43745bd8deadSopenharmony_ci
43755bd8deadSopenharmony_ci    The TXQ instruction takes the first component of the single integer vector
43765bd8deadSopenharmony_ci    operand, adds the number of the base level of the specified texture to
43775bd8deadSopenharmony_ci    determine a texture image level, and returns an integer result vector
43785bd8deadSopenharmony_ci    containing the size of the image at that level of the texture.
43795bd8deadSopenharmony_ci
43805bd8deadSopenharmony_ci    For one-dimensional and one-dimensional array textures, the "x" component
43815bd8deadSopenharmony_ci    of the result vector is filled with the width of the image(s).  For
43825bd8deadSopenharmony_ci    two-dimensional, rectangle, cube map, and two-dimensional array textures,
43835bd8deadSopenharmony_ci    the "x" and "y" components are filled with the width and height of the
43845bd8deadSopenharmony_ci    image(s).  For three-dimensional textures, the "x", "y", and "z"
43855bd8deadSopenharmony_ci    components are filled with the width, height, and depth of the image.
43865bd8deadSopenharmony_ci    Additionally, the number of layers in an array texture is returned in the
43875bd8deadSopenharmony_ci    "y" component of the result for one-dimensional array textures or the "z"
43885bd8deadSopenharmony_ci    component for two-dimensional array textures.  All other components of the
43895bd8deadSopenharmony_ci    result vector is undefined.  For the purposes of this instruction, the
43905bd8deadSopenharmony_ci    width, height, and depth of a texture do NOT include any border.
43915bd8deadSopenharmony_ci
43925bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
43935bd8deadSopenharmony_ci      tmp0.x = tmp0.x + texture[op1].target[op2].base_level;
43945bd8deadSopenharmony_ci      result.x = texture[op1].target[op2].level[tmp0.x].width;
43955bd8deadSopenharmony_ci      result.y = texture[op1].target[op2].level[tmp0.x].height;
43965bd8deadSopenharmony_ci      result.z = texture[op1].target[op2].level[tmp0.x].depth;
43975bd8deadSopenharmony_ci
43985bd8deadSopenharmony_ci    If the level computed by adding the operand to the base level of the
43995bd8deadSopenharmony_ci    texture is less than the base level number or greater than the maximum
44005bd8deadSopenharmony_ci    level number, the results are undefined.
44015bd8deadSopenharmony_ci
44025bd8deadSopenharmony_ci    TXQ supports no data type modifiers; the scalar operand and the result
44035bd8deadSopenharmony_ci    vector are both interpreted as signed integers.
44045bd8deadSopenharmony_ci
44055bd8deadSopenharmony_ci
44065bd8deadSopenharmony_ci    Section 2.X.8.Z, UP2H:  Unpack Two 16-bit Floats
44075bd8deadSopenharmony_ci
44085bd8deadSopenharmony_ci    The UP2H instruction unpacks two 16-bit floats stored together in a 32-bit
44095bd8deadSopenharmony_ci    scalar operand.  The first 16-bit float (stored in the 16 least
44105bd8deadSopenharmony_ci    significant bits) is written into the "x" and "z" components of the result
44115bd8deadSopenharmony_ci    vector; the second is written into the "y" and "w" components of the
44125bd8deadSopenharmony_ci    result vector.
44135bd8deadSopenharmony_ci
44145bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
44155bd8deadSopenharmony_ci    the PK2H instruction.
44165bd8deadSopenharmony_ci
44175bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
44185bd8deadSopenharmony_ci      result.x = (fp16) (RawBits(tmp) & 0xFFFF);
44195bd8deadSopenharmony_ci      result.y = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
44205bd8deadSopenharmony_ci      result.z = (fp16) (RawBits(tmp) & 0xFFFF);
44215bd8deadSopenharmony_ci      result.w = (fp16) ((RawBits(tmp) >> 16) & 0xFFFF);
44225bd8deadSopenharmony_ci
44235bd8deadSopenharmony_ci    UP2H supports all three data type modifiers.  The single operand is read
44245bd8deadSopenharmony_ci    as a floating-point value, a signed integer, or an unsigned integer, as
44255bd8deadSopenharmony_ci    specified by the data type modifier; the 32 least significant bits of the
44265bd8deadSopenharmony_ci    encoding are used for unpacking.  For floating-point operand variables, it
44275bd8deadSopenharmony_ci    is expected (but not required) that the operand was produced by a previous
44285bd8deadSopenharmony_ci    pack instruction.  The result is always written as a floating-point
44295bd8deadSopenharmony_ci    vector.
44305bd8deadSopenharmony_ci    
44315bd8deadSopenharmony_ci    A program will fail to load if it contains a UP2H instruction whose
44325bd8deadSopenharmony_ci    operand is a variable declared as "SHORT".
44335bd8deadSopenharmony_ci
44345bd8deadSopenharmony_ci
44355bd8deadSopenharmony_ci    Section 2.X.8.Z, UP2US:  Unpack Two Unsigned 16-bit Integers
44365bd8deadSopenharmony_ci
44375bd8deadSopenharmony_ci    The UP2US instruction unpacks two 16-bit unsigned values packed
44385bd8deadSopenharmony_ci    together in a 32-bit scalar operand.  The unsigned quantities are
44395bd8deadSopenharmony_ci    encoded where a bit pattern of all '0' bits corresponds to 0.0 and
44405bd8deadSopenharmony_ci    a pattern of all '1' bits corresponds to 1.0.  The "x" and "z"
44415bd8deadSopenharmony_ci    components of the result vector are obtained from the 16 least
44425bd8deadSopenharmony_ci    significant bits of the operand; the "y" and "w" components are
44435bd8deadSopenharmony_ci    obtained from the 16 most significant bits.
44445bd8deadSopenharmony_ci
44455bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
44465bd8deadSopenharmony_ci    the PK2US instruction.
44475bd8deadSopenharmony_ci
44485bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
44495bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
44505bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
44515bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 0)  & 0xFFFF) / 65535.0;
44525bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 16) & 0xFFFF) / 65535.0;
44535bd8deadSopenharmony_ci
44545bd8deadSopenharmony_ci    UP2US supports all three data type modifiers.  The single operand is read
44555bd8deadSopenharmony_ci    as a floating-point value, a signed integer, or an unsigned integer, as
44565bd8deadSopenharmony_ci    specified by the data type modifier; the 32 least significant bits of the
44575bd8deadSopenharmony_ci    encoding are used for unpacking.  For floating-point operand variables, it
44585bd8deadSopenharmony_ci    is expected (but not required) that the operand was produced by a previous
44595bd8deadSopenharmony_ci    pack instruction.  The result is always written as a floating-point
44605bd8deadSopenharmony_ci    vector.
44615bd8deadSopenharmony_ci
44625bd8deadSopenharmony_ci    A GPU program will fail to load if it contains a UP2S instruction
44635bd8deadSopenharmony_ci    whose operand is a variable declared as "SHORT".
44645bd8deadSopenharmony_ci
44655bd8deadSopenharmony_ci
44665bd8deadSopenharmony_ci    Section 2.X.8.Z, UP4B:  Unpack Four Signed 8-bit Integers
44675bd8deadSopenharmony_ci
44685bd8deadSopenharmony_ci    The UP4B instruction unpacks four 8-bit signed values packed together
44695bd8deadSopenharmony_ci    in a 32-bit scalar operand.  The signed quantities are encoded where
44705bd8deadSopenharmony_ci    a bit pattern of all '0' bits corresponds to -128/127 and a pattern
44715bd8deadSopenharmony_ci    of all '1' bits corresponds to +127/127.  The "x" component of the
44725bd8deadSopenharmony_ci    result vector is the converted value corresponding to the 8 least
44735bd8deadSopenharmony_ci    significant bits of the operand; the "w" component corresponds to
44745bd8deadSopenharmony_ci    the 8 most significant bits.
44755bd8deadSopenharmony_ci
44765bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
44775bd8deadSopenharmony_ci    the PK4B instruction.
44785bd8deadSopenharmony_ci
44795bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
44805bd8deadSopenharmony_ci      result.x = (((RawBits(tmp) >> 0) & 0xFF) - 128) / 127.0;
44815bd8deadSopenharmony_ci      result.y = (((RawBits(tmp) >> 8) & 0xFF) - 128) / 127.0;
44825bd8deadSopenharmony_ci      result.z = (((RawBits(tmp) >> 16) & 0xFF) - 128) / 127.0;
44835bd8deadSopenharmony_ci      result.w = (((RawBits(tmp) >> 24) & 0xFF) - 128) / 127.0;
44845bd8deadSopenharmony_ci
44855bd8deadSopenharmony_ci    UP2B supports all three data type modifiers.  The single operand is read
44865bd8deadSopenharmony_ci    as a floating-point value, a signed integer, or an unsigned integer, as
44875bd8deadSopenharmony_ci    specified by the data type modifier; the 32 least significant bits of the
44885bd8deadSopenharmony_ci    encoding are used for unpacking.  For floating-point operand variables, it
44895bd8deadSopenharmony_ci    is expected (but not required) that the operand was produced by a previous
44905bd8deadSopenharmony_ci    pack instruction.  The result is always written as a floating-point
44915bd8deadSopenharmony_ci    vector.
44925bd8deadSopenharmony_ci
44935bd8deadSopenharmony_ci    A program will fail to load if it contains a UP4B instruction whose
44945bd8deadSopenharmony_ci    operand is a variable declared as "SHORT".
44955bd8deadSopenharmony_ci
44965bd8deadSopenharmony_ci
44975bd8deadSopenharmony_ci    Section 2.X.8.Z, UP4UB:  Unpack Four Unsigned 8-bit Integers
44985bd8deadSopenharmony_ci
44995bd8deadSopenharmony_ci    The UP4UB instruction unpacks four 8-bit unsigned values packed
45005bd8deadSopenharmony_ci    together in a 32-bit scalar operand.  The unsigned quantities are
45015bd8deadSopenharmony_ci    encoded where a bit pattern of all '0' bits corresponds to 0.0 and a
45025bd8deadSopenharmony_ci    pattern of all '1' bits corresponds to 1.0.  The "x" component of the
45035bd8deadSopenharmony_ci    result vector is obtained from the 8 least significant bits of the
45045bd8deadSopenharmony_ci    operand; the "w" component is obtained from the 8 most significant
45055bd8deadSopenharmony_ci    bits.
45065bd8deadSopenharmony_ci
45075bd8deadSopenharmony_ci    This operation undoes the type conversion and packing performed by
45085bd8deadSopenharmony_ci    the PK4UB instruction.
45095bd8deadSopenharmony_ci
45105bd8deadSopenharmony_ci      tmp = ScalarLoad(op0);
45115bd8deadSopenharmony_ci      result.x = ((RawBits(tmp) >> 0)  & 0xFF) / 255.0;
45125bd8deadSopenharmony_ci      result.y = ((RawBits(tmp) >> 8)  & 0xFF) / 255.0;
45135bd8deadSopenharmony_ci      result.z = ((RawBits(tmp) >> 16) & 0xFF) / 255.0;
45145bd8deadSopenharmony_ci      result.w = ((RawBits(tmp) >> 24) & 0xFF) / 255.0;
45155bd8deadSopenharmony_ci
45165bd8deadSopenharmony_ci    UP4UB supports all three data type modifiers.  The single operand is read
45175bd8deadSopenharmony_ci    as a floating-point value, a signed integer, or an unsigned integer, as
45185bd8deadSopenharmony_ci    specified by the data type modifier; the 32 least significant bits of the
45195bd8deadSopenharmony_ci    encoding are used for unpacking.  For floating-point operand variables, it
45205bd8deadSopenharmony_ci    is expected (but not required) that the operand was produced by a previous
45215bd8deadSopenharmony_ci    pack instruction.  The result is always written as a floating-point
45225bd8deadSopenharmony_ci    vector.
45235bd8deadSopenharmony_ci
45245bd8deadSopenharmony_ci    A program will fail to load if it contains a UP4UB instruction whose
45255bd8deadSopenharmony_ci    operand is a variable declared as "SHORT".
45265bd8deadSopenharmony_ci
45275bd8deadSopenharmony_ci
45285bd8deadSopenharmony_ci    Section 2.X.8.Z, X2D:  2D Coordinate Transformation
45295bd8deadSopenharmony_ci
45305bd8deadSopenharmony_ci    The X2D instruction multiplies the 2D offset vector specified by the
45315bd8deadSopenharmony_ci    "x" and "y" components of the second vector operand by the 2x2 matrix
45325bd8deadSopenharmony_ci    specified by the four components of the third vector operand, and adds
45335bd8deadSopenharmony_ci    the transformed offset vector to the 2D vector specified by the "x"
45345bd8deadSopenharmony_ci    and "y" components of the first vector operand.  The first component
45355bd8deadSopenharmony_ci    of the sum is written to the "x" and "z" components of the result;
45365bd8deadSopenharmony_ci    the second component is written to the "y" and "w" components of
45375bd8deadSopenharmony_ci    the result.
45385bd8deadSopenharmony_ci
45395bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
45405bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
45415bd8deadSopenharmony_ci      tmp2 = VectorLoad(op2);
45425bd8deadSopenharmony_ci      result.x = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
45435bd8deadSopenharmony_ci      result.y = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
45445bd8deadSopenharmony_ci      result.z = tmp0.x + tmp1.x * tmp2.x + tmp1.y * tmp2.y;
45455bd8deadSopenharmony_ci      result.w = tmp0.y + tmp1.x * tmp2.z + tmp1.y * tmp2.w;
45465bd8deadSopenharmony_ci
45475bd8deadSopenharmony_ci    X2D supports only floating-point data type modifiers.
45485bd8deadSopenharmony_ci
45495bd8deadSopenharmony_ci
45505bd8deadSopenharmony_ci    Section 2.X.8.Z, XOR:  Exclusive Or
45515bd8deadSopenharmony_ci
45525bd8deadSopenharmony_ci    The XOR instruction performs a bitwise XOR operation on the components of
45535bd8deadSopenharmony_ci    the two source vectors to yield a result vector.
45545bd8deadSopenharmony_ci
45555bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
45565bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
45575bd8deadSopenharmony_ci      result.x = tmp0.x ^ tmp1.x;
45585bd8deadSopenharmony_ci      result.y = tmp0.y ^ tmp1.y;
45595bd8deadSopenharmony_ci      result.z = tmp0.z ^ tmp1.z;
45605bd8deadSopenharmony_ci      result.w = tmp0.w ^ tmp1.w;
45615bd8deadSopenharmony_ci
45625bd8deadSopenharmony_ci    XOR supports only integer data type modifiers.  If no type modifier is
45635bd8deadSopenharmony_ci    specified, both operands and the result are treated as signed integers.
45645bd8deadSopenharmony_ci
45655bd8deadSopenharmony_ci
45665bd8deadSopenharmony_ci    Section 2.X.8.Z, XPD:  Cross Product
45675bd8deadSopenharmony_ci
45685bd8deadSopenharmony_ci    The XPD instruction computes the cross product using the first three
45695bd8deadSopenharmony_ci    components of its two vector operands to generate the x, y, and z
45705bd8deadSopenharmony_ci    components of the result vector.  The w component of the result vector is
45715bd8deadSopenharmony_ci    undefined.
45725bd8deadSopenharmony_ci
45735bd8deadSopenharmony_ci      tmp0 = VectorLoad(op0);
45745bd8deadSopenharmony_ci      tmp1 = VectorLoad(op1);
45755bd8deadSopenharmony_ci      result.x = tmp0.y * tmp1.z - tmp0.z * tmp1.y;
45765bd8deadSopenharmony_ci      result.y = tmp0.z * tmp1.x - tmp0.x * tmp1.z;
45775bd8deadSopenharmony_ci      result.z = tmp0.x * tmp1.y - tmp0.y * tmp1.x;
45785bd8deadSopenharmony_ci      result.w = undefined;
45795bd8deadSopenharmony_ci
45805bd8deadSopenharmony_ci    XPD supports only floating-point data type modifiers.
45815bd8deadSopenharmony_ci
45825bd8deadSopenharmony_ci
45835bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization)
45845bd8deadSopenharmony_ci
45855bd8deadSopenharmony_ci    Modify Section 3.8.1, Texture Image Specification, p. 150
45865bd8deadSopenharmony_ci
45875bd8deadSopenharmony_ci    (modify 4th paragraph, p. 151 -- add cubemaps to the list of texture
45885bd8deadSopenharmony_ci    targets that can be used with DEPTH_COMPONENT textures) Textures with a
45895bd8deadSopenharmony_ci    base internal format of DEPTH_COMPONENT are supported by texture image
45905bd8deadSopenharmony_ci    specification commands only if <target> is TEXTURE_1D, TEXTURE_2D,
45915bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP, TEXTURE_RECTANGLE_ARB, TEXTURE_1D_ARRAY_EXT,
45925bd8deadSopenharmony_ci    TEXTURE_2D_ARRAY_EXT, PROXY_TEXTURE_1D PROXY_TEXTURE_2D,
45935bd8deadSopenharmony_ci    PROXY_TEXTURE_CUBE_MAP, PROXY_TEXTURE_RECTANGLE_ARB,
45945bd8deadSopenharmony_ci    PROXY_TEXTURE_1D_ARRAY_EXT, or PROXY_TEXTURE_2D_ARRAY_EXT.  Using this
45955bd8deadSopenharmony_ci    format in conjunction with any other target will result in an
45965bd8deadSopenharmony_ci    INVALID_OPERATION error.
45975bd8deadSopenharmony_ci
45985bd8deadSopenharmony_ci
45995bd8deadSopenharmony_ci    Delete Section 3.8.7, Texture Wrap Modes.  (The language in this section
46005bd8deadSopenharmony_ci    is folded into updates to the following section, and is no longer needed
46015bd8deadSopenharmony_ci    here.)
46025bd8deadSopenharmony_ci
46035bd8deadSopenharmony_ci
46045bd8deadSopenharmony_ci    Modify Section 3.8.8, Texture Minification:
46055bd8deadSopenharmony_ci
46065bd8deadSopenharmony_ci    (replace the last paragraph, p. 171):  Let s(x,y) be the function that
46075bd8deadSopenharmony_ci    associates an s texture coordinate with each set of window coordinates
46085bd8deadSopenharmony_ci    (x,y) that lie within a primitive; define t(x,y) and r(x,y) analogously.
46095bd8deadSopenharmony_ci    Let
46105bd8deadSopenharmony_ci
46115bd8deadSopenharmony_ci      u(x,y) = w_t * s(x,y) + offsetu_shader,
46125bd8deadSopenharmony_ci      v(x,y) = h_t * t(x,y) + offsetv_shader, 
46135bd8deadSopenharmony_ci      w(x,y) = d_t * r(x,y) + offsetw_shader, and
46145bd8deadSopenharmony_ci
46155bd8deadSopenharmony_ci    where w_t, h_t, and d_t are as defined by equations 3.15, 3.16, and 3.17
46165bd8deadSopenharmony_ci    with w_s, h_s, and d_s equal to the width, height, and depth of the image
46175bd8deadSopenharmony_ci    array whose level is level_base.  (offsetu_shader, offsetv_shader,
46185bd8deadSopenharmony_ci    offsetw_shader) is the texel offset specified in the vertex, geometry, or
46195bd8deadSopenharmony_ci    fragment program instruction used to perform the access.  For
46205bd8deadSopenharmony_ci    fixed-function texture accesses, all three shader offsets are taken to be
46215bd8deadSopenharmony_ci    zero.  For a one-dimensional texture, define v(x,y) == 0 and w(x,y) === 0;
46225bd8deadSopenharmony_ci    for two-dimensional textures, define w(x,y) == 0.
46235bd8deadSopenharmony_ci
46245bd8deadSopenharmony_ci    After u(x,y), v(x,y), and w(x,y) are generated, they are clamped if the
46255bd8deadSopenharmony_ci    corresponding texture wrap modes are CLAMP or MIRROR_CLAMP_EXT.  Let
46265bd8deadSopenharmony_ci
46275bd8deadSopenharmony_ci      u'(x,y) = clamp(u(x,y), 0, w_t),      if TEXTURE_WRAP_S is CLAMP
46285bd8deadSopenharmony_ci                clamp(u(x,y), -w_t, w_t),   if TEXTURE_WRAP_S is
46295bd8deadSopenharmony_ci                                              MIRROR_CLAMP_EXT, or
46305bd8deadSopenharmony_ci                u(x,y),                     otherwise
46315bd8deadSopenharmony_ci      v'(x,y) = clamp(v(x,y), 0, w_t),      if TEXTURE_WRAP_T is CLAMP
46325bd8deadSopenharmony_ci                clamp(v(x,y), -w_t, w_t),   if TEXTURE_WRAP_T is
46335bd8deadSopenharmony_ci                                              MIRROR_CLAMP_EXT, or
46345bd8deadSopenharmony_ci                v(x,y),                     otherwise
46355bd8deadSopenharmony_ci      w'(x,y) = clamp(w(x,y), 0, w_t),      if TEXTURE_WRAP_R is CLAMP
46365bd8deadSopenharmony_ci                clamp(w(x,y), -w_t, w_t),   if TEXTURE_WRAP_R is
46375bd8deadSopenharmony_ci                                              MIRROR_CLAMP_EXT, or
46385bd8deadSopenharmony_ci                w(x,y),                     otherwise,
46395bd8deadSopenharmony_ci
46405bd8deadSopenharmony_ci    where clamp(<a>,<b>,<c>) returns <b> if <a> is less than <b>, <c> if a is
46415bd8deadSopenharmony_ci    greater than <c>, and <a> otherwise.
46425bd8deadSopenharmony_ci
46435bd8deadSopenharmony_ci    (start a new paragraph with "For a polygon, rho is given at a fragment
46445bd8deadSopenharmony_ci    with window coordinates...", and then continue with the original spec
46455bd8deadSopenharmony_ci    text.)
46465bd8deadSopenharmony_ci
46475bd8deadSopenharmony_ci    (replace text starting with the last paragraph on p. 172, continuing to
46485bd8deadSopenharmony_ci    the end of p. 174)
46495bd8deadSopenharmony_ci
46505bd8deadSopenharmony_ci    When lambda indicates minification, the value assigned to
46515bd8deadSopenharmony_ci    TEXTURE_MIN_FILTER is used to determine how the texture value for a
46525bd8deadSopenharmony_ci    fragment is selected.
46535bd8deadSopenharmony_ci
46545bd8deadSopenharmony_ci    When TEXTURE_MIN_FILTER is NEAREST, the texel in the image array of level
46555bd8deadSopenharmony_ci    level_base that is nearest (in Manhattan distance) to that specified by
46565bd8deadSopenharmony_ci    (s,t,r) is obtained.  Let i, j, and k be integers such that:
46575bd8deadSopenharmony_ci
46585bd8deadSopenharmony_ci      i = apply_wrap(floor(u'(x,y))),
46595bd8deadSopenharmony_ci      j = apply_wrap(floor(v'(x,y))), and
46605bd8deadSopenharmony_ci      k = apply_wrap(floor(w'(x,y))),
46615bd8deadSopenharmony_ci
46625bd8deadSopenharmony_ci    where the coordinate returned by apply_wrap() is as defined by Table X.19.
46635bd8deadSopenharmony_ci    The values of i, j, and k are then modified according to the texture wrap
46645bd8deadSopenharmony_ci    modes, as described in Table 3.19, to produce new values (i', j', and k').
46655bd8deadSopenharmony_ci    For a three-dimensional texture, the texel at location (i,j,k) becomes the
46665bd8deadSopenharmony_ci    texture value.  For a two-dimensional texture, k is irrelevant, and the
46675bd8deadSopenharmony_ci    texel at location (i,j) becomes the texture value.  For a one-dimensional
46685bd8deadSopenharmony_ci    texture, j and k are irrelevant, and the texel at location i becomes the
46695bd8deadSopenharmony_ci    texture value.
46705bd8deadSopenharmony_ci
46715bd8deadSopenharmony_ci      Wrap mode                   Result
46725bd8deadSopenharmony_ci      --------------------------  ------------------------------------------
46735bd8deadSopenharmony_ci      CLAMP_TO_EDGE               clamp(coord, 0, size-1)
46745bd8deadSopenharmony_ci      CLAMP_TO_BORDER             clamp(coord, -1, size)
46755bd8deadSopenharmony_ci      CLAMP                       { clamp(coord, 0, size-1), 
46765bd8deadSopenharmony_ci                                  {         for NEAREST filtering
46775bd8deadSopenharmony_ci                                  { clamp(coord, -1, size), 
46785bd8deadSopenharmony_ci                                  {         for LINEAR filtering
46795bd8deadSopenharmony_ci      REPEAT                      mod(coord, size)
46805bd8deadSopenharmony_ci      MIRROR_CLAMP_TO_EDGE_EXT    clamp(mirror(coord), 0, size-1)
46815bd8deadSopenharmony_ci      MIRROR_CLAMP_TO_BORDER_EXT  clamp(mirror(size), 0, size)
46825bd8deadSopenharmony_ci      MIRROR_CLAMP_EXT            { clamp(mirror(coord), 0, size-1), 
46835bd8deadSopenharmony_ci                                  {         for NEAREST filtering
46845bd8deadSopenharmony_ci                                  { clamp(mirror(size), 0, size), 
46855bd8deadSopenharmony_ci                                  {         for LINEAR filtering
46865bd8deadSopenharmony_ci      MIRRORED_REPEAT             (size-1) - mirror(mod(coord, 2*size)-size)
46875bd8deadSopenharmony_ci
46885bd8deadSopenharmony_ci      Table X.19:  Texel location wrap mode application.  mod(<a>,<b>) is
46895bd8deadSopenharmony_ci      defined to return <a>-<b>*floor(<a>/<b>), and mirror(<a>) is defined to
46905bd8deadSopenharmony_ci      return <a> if <a> is greater than or equal to zero or -(1+<a>)
46915bd8deadSopenharmony_ci      otherwise.  The values of "wrap mode" and size are TEXTURE_WRAP_S and
46925bd8deadSopenharmony_ci      w_t, TEXTURE_WRAP_T and h_t, and TEXTURE_WRAP_R and d_t, for i, j, and k
46935bd8deadSopenharmony_ci      coordinates, respectively.  The coordinate clamp and MIRROR_CLAMP_EXT
46945bd8deadSopenharmony_ci      depends on the filtering mode (NEAREST or LINEAR).
46955bd8deadSopenharmony_ci
46965bd8deadSopenharmony_ci    If the selected (i,j,k), (i,j), or i location refers to a border texel
46975bd8deadSopenharmony_ci    that satisfies any of the following conditions:
46985bd8deadSopenharmony_ci
46995bd8deadSopenharmony_ci      i < -b_s,
47005bd8deadSopenharmony_ci      j < -b_s, 
47015bd8deadSopenharmony_ci      k < -b_s, 
47025bd8deadSopenharmony_ci      i >= w_t + b_s, 
47035bd8deadSopenharmony_ci      j >= h_t + b_s, or
47045bd8deadSopenharmony_ci      j >= d_t + b_s,
47055bd8deadSopenharmony_ci 
47065bd8deadSopenharmony_ci    then the border values defined by TEXTURE_BORDER_COLOR are used in place
47075bd8deadSopenharmony_ci    of the non-existent texel. If the texture contains color components, the
47085bd8deadSopenharmony_ci    values of TEXTURE_BORDER_COLOR are interpreted as an RGBA color to match
47095bd8deadSopenharmony_ci    the texture's internal format in a manner consistent with table 3.15. If
47105bd8deadSopenharmony_ci    the texture contains depth components, the first component of
47115bd8deadSopenharmony_ci    TEXTURE_BORDER_COLOR is interpreted as a depth value.
47125bd8deadSopenharmony_ci
47135bd8deadSopenharmony_ci    When TEXTURE_MIN_FILTER is LINEAR, a 2x2x2 cube of texels in the image
47145bd8deadSopenharmony_ci    array of level level_base is selected.  Let:
47155bd8deadSopenharmony_ci
47165bd8deadSopenharmony_ci      i_0   = apply_wrap(floor(u' - 0.5)),
47175bd8deadSopenharmony_ci      j_0   = apply_wrap(floor(v' - 0.5)),
47185bd8deadSopenharmony_ci      k_0   = apply_wrap(floor(w' - 0.5)),
47195bd8deadSopenharmony_ci      i_1   = apply_wrap(floor(u' - 0.5) + 1),
47205bd8deadSopenharmony_ci      j_1   = apply_wrap(floor(v' - 0.5) + 1),
47215bd8deadSopenharmony_ci      k_1   = apply_wrap(floor(w' - 0.5) + 1),
47225bd8deadSopenharmony_ci      alpha = frac(u' - 0.5),
47235bd8deadSopenharmony_ci      beta  = frac(v' - 0.5),
47245bd8deadSopenharmony_ci      gamma = frac(w' - 0.5),
47255bd8deadSopenharmony_ci
47265bd8deadSopenharmony_ci    where frac(<x>) denotes the fractional part of <x>.
47275bd8deadSopenharmony_ci
47285bd8deadSopenharmony_ci    For a three-dimensional texture, the texture value tau is found as...
47295bd8deadSopenharmony_ci
47305bd8deadSopenharmony_ci    (replace last paragraph, p.174) For any texel in the equation above that
47315bd8deadSopenharmony_ci    refers to a border texel outside the defined range of the image, the texel
47325bd8deadSopenharmony_ci    value is taken from the texture border color as with NEAREST filtering.
47335bd8deadSopenharmony_ci
47345bd8deadSopenharmony_ci
47355bd8deadSopenharmony_ci    Modify Section 3.8.14, Texture Comparison Modes (p. 185)
47365bd8deadSopenharmony_ci
47375bd8deadSopenharmony_ci    (modify 2nd paragraph, p. 188, indicating that the Q texture coordinate is
47385bd8deadSopenharmony_ci    used for depth comparisons on cubemap textures)
47395bd8deadSopenharmony_ci
47405bd8deadSopenharmony_ci    Let D_t be the depth texture value, in the range [0, 1].  For
47415bd8deadSopenharmony_ci    fixed-function texture lookups, let R be the interpolated <r> texture
47425bd8deadSopenharmony_ci    coordinate, clamped to the range [0, 1].  For texture lookups generated by
47435bd8deadSopenharmony_ci    a program instruction, let R be the reference value for depth comparisons
47445bd8deadSopenharmony_ci    provided in the instruction, also clamped to [0, 1].  Then the effective
47455bd8deadSopenharmony_ci    texture value L_t, I_t, or A_t is computed as follows:
47465bd8deadSopenharmony_ci
47475bd8deadSopenharmony_ci
47485bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment
47495bd8deadSopenharmony_ciOperations and the Frame Buffer)
47505bd8deadSopenharmony_ci
47515bd8deadSopenharmony_ci    None.
47525bd8deadSopenharmony_ci
47535bd8deadSopenharmony_ci
47545bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.5 Specification (Special Functions)
47555bd8deadSopenharmony_ci
47565bd8deadSopenharmony_ci    None.
47575bd8deadSopenharmony_ci
47585bd8deadSopenharmony_ci
47595bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.5 Specification (State and
47605bd8deadSopenharmony_ciState Requests)
47615bd8deadSopenharmony_ci
47625bd8deadSopenharmony_ci    Modify Section 6.1.12 of the ARB_vertex_program specification.
47635bd8deadSopenharmony_ci
47645bd8deadSopenharmony_ci    (Add new integer program parameter queries, plus language that program
47655bd8deadSopenharmony_ci    environment or local parameter query results are undefined if the query
47665bd8deadSopenharmony_ci    specifies a data type incompatible with the data type of the parameter
47675bd8deadSopenharmony_ci    being queried.)
47685bd8deadSopenharmony_ci
47695bd8deadSopenharmony_ci    The commands
47705bd8deadSopenharmony_ci
47715bd8deadSopenharmony_ci      void GetProgramEnvParameterdvARB(enum target, uint index,
47725bd8deadSopenharmony_ci                                       double *params);
47735bd8deadSopenharmony_ci      void GetProgramEnvParameterfvARB(enum target, uint index,
47745bd8deadSopenharmony_ci                                       float *params);
47755bd8deadSopenharmony_ci      void GetProgramEnvParameterIivNV(enum target, uint index,
47765bd8deadSopenharmony_ci                                       int *params);
47775bd8deadSopenharmony_ci      void GetProgramEnvParameterIuivNV(enum target, uint index,
47785bd8deadSopenharmony_ci                                        uint *params);
47795bd8deadSopenharmony_ci
47805bd8deadSopenharmony_ci    obtain the current value for the program environment parameter numbered
47815bd8deadSopenharmony_ci    <index> for the given program target <target>, and places the information
47825bd8deadSopenharmony_ci    in the array <params>.  The values returned are undefined if the data type
47835bd8deadSopenharmony_ci    of the components of the parameter is not compatible with the data type of
47845bd8deadSopenharmony_ci    <params>.  Floating-point components are compatible with "double" or
47855bd8deadSopenharmony_ci    "float"; signed and unsigned integer components are compatible with "int"
47865bd8deadSopenharmony_ci    and "uint", respectively.  The error INVALID_ENUM is generated if <target>
47875bd8deadSopenharmony_ci    specifies a nonexistent program target or a program target that does not
47885bd8deadSopenharmony_ci    support program environment parameters.  The error INVALID_VALUE is
47895bd8deadSopenharmony_ci    generated if <index> is greater than or equal to the
47905bd8deadSopenharmony_ci    implementation-dependent number of supported program environment
47915bd8deadSopenharmony_ci    parameters for the program target.
47925bd8deadSopenharmony_ci
47935bd8deadSopenharmony_ci    ...
47945bd8deadSopenharmony_ci
47955bd8deadSopenharmony_ci    The commands
47965bd8deadSopenharmony_ci
47975bd8deadSopenharmony_ci      void GetProgramLocalParameterdvARB(enum target, uint index,
47985bd8deadSopenharmony_ci                                         double *params);
47995bd8deadSopenharmony_ci      void GetProgramLocalParameterfvARB(enum target, uint index,
48005bd8deadSopenharmony_ci                                         float *params);
48015bd8deadSopenharmony_ci      void GetProgramLocalParameterIivNV(enum target, uint index,
48025bd8deadSopenharmony_ci                                         int *params);
48035bd8deadSopenharmony_ci      void GetProgramLocalParameterIuivNV(enum target, uint index,
48045bd8deadSopenharmony_ci                                          uint *params);
48055bd8deadSopenharmony_ci
48065bd8deadSopenharmony_ci    obtain the current value for the program local parameter numbered <index>
48075bd8deadSopenharmony_ci    belonging to the program object currently bound to <target>, and places
48085bd8deadSopenharmony_ci    the information in the array <params>.  The values returned are undefined
48095bd8deadSopenharmony_ci    if the data type of the components of the parameter is not compatible with
48105bd8deadSopenharmony_ci    the data type of <params>.  Floating-point components are compatible with
48115bd8deadSopenharmony_ci    "double' or "float"; signed and unsigned integer components are compatible
48125bd8deadSopenharmony_ci    with "int" and "uint", respectively.  The error INVALID_ENUM is generated
48135bd8deadSopenharmony_ci    if <target> specifies a nonexistent program target or a program target
48145bd8deadSopenharmony_ci    that does not support program local parameters.  The error INVALID_VALUE
48155bd8deadSopenharmony_ci    is generated if <index> is greater than or equal to the
48165bd8deadSopenharmony_ci    implementation-dependent number of supported program local parameters for
48175bd8deadSopenharmony_ci    the program target.
48185bd8deadSopenharmony_ci
48195bd8deadSopenharmony_ci    ...
48205bd8deadSopenharmony_ci
48215bd8deadSopenharmony_ci    The command
48225bd8deadSopenharmony_ci
48235bd8deadSopenharmony_ci      void GetProgramivARB(enum target, enum pname, int *params);
48245bd8deadSopenharmony_ci
48255bd8deadSopenharmony_ci    obtains program state for the program target <target>, writing ...
48265bd8deadSopenharmony_ci    
48275bd8deadSopenharmony_ci    (add new paragraphs describing the new supported queries)
48285bd8deadSopenharmony_ci
48295bd8deadSopenharmony_ci    If <pname> is PROGRAM_ATTRIB_COMPONENTS_NV or
48305bd8deadSopenharmony_ci    PROGRAM_RESULT_COMPONENTS_NV, GetProgramivARB returns a single integer
48315bd8deadSopenharmony_ci    holding the number of active attribute or result variable components,
48325bd8deadSopenharmony_ci    respectively, used by the program object currently bound to <target>.
48335bd8deadSopenharmony_ci
48345bd8deadSopenharmony_ci    If <pname> is MAX_PROGRAM_ATTRIB_COMPONENTS or
48355bd8deadSopenharmony_ci    MAX_PROGRAM_RESULT_COMPONENTS_NV, GetProgramivARB returns a single integer
48365bd8deadSopenharmony_ci    holding the maximum number of active attribute or result variable
48375bd8deadSopenharmony_ci    components, respectively, supported for programs of type <target>.
48385bd8deadSopenharmony_ci
48395bd8deadSopenharmony_ci
48405bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.5 Specification (Invariance)
48415bd8deadSopenharmony_ci
48425bd8deadSopenharmony_ci    None.
48435bd8deadSopenharmony_ci
48445bd8deadSopenharmony_ci
48455bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
48465bd8deadSopenharmony_ci
48475bd8deadSopenharmony_ci    None.
48485bd8deadSopenharmony_ci
48495bd8deadSopenharmony_ci
48505bd8deadSopenharmony_ciGLX Protocol
48515bd8deadSopenharmony_ci
48525bd8deadSopenharmony_ci    The following new rendering commands are sent to the server as part
48535bd8deadSopenharmony_ci    of a glXRender request.
48545bd8deadSopenharmony_ci
48555bd8deadSopenharmony_ci    ProgramLocalParameterI4ivNV
48565bd8deadSopenharmony_ci
48575bd8deadSopenharmony_ci        2           28               rendering command length
48585bd8deadSopenharmony_ci        2           4303             rendering command opcode
48595bd8deadSopenharmony_ci        4           ENUM             target
48605bd8deadSopenharmony_ci        4           CARD32           index
48615bd8deadSopenharmony_ci        4           INT32            params[0]
48625bd8deadSopenharmony_ci        4           INT32            params[1]
48635bd8deadSopenharmony_ci        4           INT32            params[2]
48645bd8deadSopenharmony_ci        4           INT32            params[3]
48655bd8deadSopenharmony_ci
48665bd8deadSopenharmony_ci    ProgramLocalParameterI4uivNV
48675bd8deadSopenharmony_ci
48685bd8deadSopenharmony_ci        2           28               rendering command length
48695bd8deadSopenharmony_ci        2           4305             rendering command opcode
48705bd8deadSopenharmony_ci        4           ENUM             target
48715bd8deadSopenharmony_ci        4           CARD32           index
48725bd8deadSopenharmony_ci        4           CARD32           params[0]
48735bd8deadSopenharmony_ci        4           CARD32           params[1]
48745bd8deadSopenharmony_ci        4           CARD32           params[2]
48755bd8deadSopenharmony_ci        4           CARD32           params[3]
48765bd8deadSopenharmony_ci
48775bd8deadSopenharmony_ci    ProgramEnvParameterI4ivNV
48785bd8deadSopenharmony_ci
48795bd8deadSopenharmony_ci        2           28               rendering command length
48805bd8deadSopenharmony_ci        2           4307             rendering command opcode
48815bd8deadSopenharmony_ci        4           ENUM             target
48825bd8deadSopenharmony_ci        4           CARD32           index
48835bd8deadSopenharmony_ci        4           INT32            params[0]
48845bd8deadSopenharmony_ci        4           INT32            params[1]
48855bd8deadSopenharmony_ci        4           INT32            params[2]
48865bd8deadSopenharmony_ci        4           INT32            params[3]
48875bd8deadSopenharmony_ci
48885bd8deadSopenharmony_ci    ProgramEnvParameterI4uivNV
48895bd8deadSopenharmony_ci
48905bd8deadSopenharmony_ci        2           28               rendering command length
48915bd8deadSopenharmony_ci        2           4309             rendering command opcode
48925bd8deadSopenharmony_ci        4           ENUM             target
48935bd8deadSopenharmony_ci        4           CARD32           index
48945bd8deadSopenharmony_ci        4           CARD32           params[0]
48955bd8deadSopenharmony_ci        4           CARD32           params[1]
48965bd8deadSopenharmony_ci        4           CARD32           params[2]
48975bd8deadSopenharmony_ci        4           CARD32           params[3]
48985bd8deadSopenharmony_ci
48995bd8deadSopenharmony_ci    Following new rendering commands are added. These can be sent as a 
49005bd8deadSopenharmony_ci    glXRender or glXRenderLarge request.
49015bd8deadSopenharmony_ci
49025bd8deadSopenharmony_ci    ProgramLocalParametersI4ivNV
49035bd8deadSopenharmony_ci
49045bd8deadSopenharmony_ci        2           16+count*4*4     rendering command length
49055bd8deadSopenharmony_ci        2           4304             rendering command opcode
49065bd8deadSopenharmony_ci        4           ENUM             target
49075bd8deadSopenharmony_ci        4           CARD32           index
49085bd8deadSopenharmony_ci        4           CARD32           count
49095bd8deadSopenharmony_ci        4*count*4   LISTofINT32      params
49105bd8deadSopenharmony_ci
49115bd8deadSopenharmony_ci    If the command is encoded in a glXRenderLarge request, the
49125bd8deadSopenharmony_ci    command opcode and command length fields above are expanded to
49135bd8deadSopenharmony_ci    4 bytes each:
49145bd8deadSopenharmony_ci
49155bd8deadSopenharmony_ci        4           20+count*4*4     rendering command length
49165bd8deadSopenharmony_ci        4           4304             rendering command opcode
49175bd8deadSopenharmony_ci
49185bd8deadSopenharmony_ci    ProgramLocalParametersI4uivNV
49195bd8deadSopenharmony_ci
49205bd8deadSopenharmony_ci        2           16+count*4*4     rendering command length
49215bd8deadSopenharmony_ci        2           4306             rendering command opcode
49225bd8deadSopenharmony_ci        4           ENUM             target
49235bd8deadSopenharmony_ci        4           CARD32           index
49245bd8deadSopenharmony_ci        4           CARD32           count
49255bd8deadSopenharmony_ci        4*count*4   LISTofCARD32     params
49265bd8deadSopenharmony_ci
49275bd8deadSopenharmony_ci    If the command is encoded in a glXRenderLarge request, the
49285bd8deadSopenharmony_ci    command opcode and command length fields above are expanded to
49295bd8deadSopenharmony_ci    4 bytes each:
49305bd8deadSopenharmony_ci
49315bd8deadSopenharmony_ci        4           20+count*4*4     rendering command length
49325bd8deadSopenharmony_ci        4           4306             rendering command opcode
49335bd8deadSopenharmony_ci
49345bd8deadSopenharmony_ci    ProgramEnvParametersI4ivNV
49355bd8deadSopenharmony_ci
49365bd8deadSopenharmony_ci        2           16+count*4*4     rendering command length
49375bd8deadSopenharmony_ci        2           4308             rendering command opcode
49385bd8deadSopenharmony_ci        4           ENUM             target
49395bd8deadSopenharmony_ci        4           CARD32           index
49405bd8deadSopenharmony_ci        4           CARD32           count
49415bd8deadSopenharmony_ci        4*count*4   LISTofCARD32     params
49425bd8deadSopenharmony_ci
49435bd8deadSopenharmony_ci    If the command is encoded in a glXRenderLarge request, the
49445bd8deadSopenharmony_ci    command opcode and command length fields above are expanded to
49455bd8deadSopenharmony_ci    4 bytes each:
49465bd8deadSopenharmony_ci
49475bd8deadSopenharmony_ci        4           20+count*4*4     rendering command length
49485bd8deadSopenharmony_ci        4           4308             rendering command opcode
49495bd8deadSopenharmony_ci
49505bd8deadSopenharmony_ci    ProgramEnvParametersI4uivNV
49515bd8deadSopenharmony_ci
49525bd8deadSopenharmony_ci        2           16+count*4*4     rendering command length
49535bd8deadSopenharmony_ci        2           4310             rendering command opcode
49545bd8deadSopenharmony_ci        4           ENUM             target
49555bd8deadSopenharmony_ci        4           CARD32           index
49565bd8deadSopenharmony_ci        4           INT32            count
49575bd8deadSopenharmony_ci        4*count*4   LISTofCARD32     params
49585bd8deadSopenharmony_ci
49595bd8deadSopenharmony_ci    If the command is encoded in a glXRenderLarge request, the
49605bd8deadSopenharmony_ci    command opcode and command length fields above are expanded to
49615bd8deadSopenharmony_ci    4 bytes each:
49625bd8deadSopenharmony_ci
49635bd8deadSopenharmony_ci        4           20+count*4*4     rendering command length
49645bd8deadSopenharmony_ci        4           4310             rendering command opcode
49655bd8deadSopenharmony_ci
49665bd8deadSopenharmony_ci    The remaining commands are non-rendering commands.  These commands
49675bd8deadSopenharmony_ci    are sent separately (i.e., not as part of a glXRender or
49685bd8deadSopenharmony_ci    glXRenderLarge request), using the glXVendorPrivateWithReply
49695bd8deadSopenharmony_ci    request:
49705bd8deadSopenharmony_ci
49715bd8deadSopenharmony_ci    GetProgramLocalParameterIivNV
49725bd8deadSopenharmony_ci        1           CARD8            opcode (X assigned)
49735bd8deadSopenharmony_ci        1           17               GLX opcode (X_GLXVendorPrivateWithReply)
49745bd8deadSopenharmony_ci        2           5                request length
49755bd8deadSopenharmony_ci        4           1365             vendor specific opcode
49765bd8deadSopenharmony_ci        4           GLX_CONTEXT_TAG  context tag
49775bd8deadSopenharmony_ci        4           ENUM             target
49785bd8deadSopenharmony_ci        4           CARD32           index
49795bd8deadSopenharmony_ci      =>
49805bd8deadSopenharmony_ci        1           1                reply
49815bd8deadSopenharmony_ci        1           CARD8            unused
49825bd8deadSopenharmony_ci        2           CARD16           sequence number
49835bd8deadSopenharmony_ci        4           4                reply length
49845bd8deadSopenharmony_ci        24          CARD32           unused
49855bd8deadSopenharmony_ci        16          INT32            params
49865bd8deadSopenharmony_ci
49875bd8deadSopenharmony_ci    GetProgramLocalParameterIuivNV
49885bd8deadSopenharmony_ci        1           CARD8            opcode (X assigned)
49895bd8deadSopenharmony_ci        1           17               GLX opcode (X_GLXVendorPrivateWithReply)
49905bd8deadSopenharmony_ci        2           5                request length
49915bd8deadSopenharmony_ci        4           1366             vendor specific opcode
49925bd8deadSopenharmony_ci        4           GLX_CONTEXT_TAG  context tag
49935bd8deadSopenharmony_ci        4           ENUM             target
49945bd8deadSopenharmony_ci        4           CARD32           index
49955bd8deadSopenharmony_ci      =>
49965bd8deadSopenharmony_ci        1           1                reply
49975bd8deadSopenharmony_ci        1           CARD8            unused
49985bd8deadSopenharmony_ci        2           CARD16           sequence number
49995bd8deadSopenharmony_ci        4           4                reply length
50005bd8deadSopenharmony_ci        24          CARD32           unused
50015bd8deadSopenharmony_ci        16          CARD32           params
50025bd8deadSopenharmony_ci
50035bd8deadSopenharmony_ci    GetProgramEnvParameterIivNV
50045bd8deadSopenharmony_ci        1           CARD8            opcode (X assigned)
50055bd8deadSopenharmony_ci        1           17               GLX opcode (X_GLXVendorPrivateWithReply)
50065bd8deadSopenharmony_ci        2           5                request length
50075bd8deadSopenharmony_ci        4           1367             vendor specific opcode
50085bd8deadSopenharmony_ci        4           GLX_CONTEXT_TAG  context tag
50095bd8deadSopenharmony_ci        4           ENUM             target
50105bd8deadSopenharmony_ci        4           CARD32           index
50115bd8deadSopenharmony_ci      =>
50125bd8deadSopenharmony_ci        1           1                reply
50135bd8deadSopenharmony_ci        1           CARD8            unused
50145bd8deadSopenharmony_ci        2           CARD16           sequence number
50155bd8deadSopenharmony_ci        4           4                reply length
50165bd8deadSopenharmony_ci        24          CARD32           unused
50175bd8deadSopenharmony_ci        16          INT32            params
50185bd8deadSopenharmony_ci
50195bd8deadSopenharmony_ci    GetProgramEnvParameterIuivNV
50205bd8deadSopenharmony_ci        1           CARD8            opcode (X assigned)
50215bd8deadSopenharmony_ci        1           17               GLX opcode (X_GLXVendorPrivateWithReply)
50225bd8deadSopenharmony_ci        2           5                request length
50235bd8deadSopenharmony_ci        4           1368             vendor specific opcode
50245bd8deadSopenharmony_ci        4           GLX_CONTEXT_TAG  context tag
50255bd8deadSopenharmony_ci        4           ENUM             target
50265bd8deadSopenharmony_ci        4           CARD32           index
50275bd8deadSopenharmony_ci      =>
50285bd8deadSopenharmony_ci        1           1                reply
50295bd8deadSopenharmony_ci        1           CARD8            unused
50305bd8deadSopenharmony_ci        2           CARD16           sequence number
50315bd8deadSopenharmony_ci        4           4                reply length
50325bd8deadSopenharmony_ci        24          CARD32           unused
50335bd8deadSopenharmony_ci        16          CARD32           params
50345bd8deadSopenharmony_ci
50355bd8deadSopenharmony_ciErrors
50365bd8deadSopenharmony_ci
50375bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramLocalParameter4fARB,
50385bd8deadSopenharmony_ci    ProgramLocalParameter4fvARB, ProgramLocalParameter4dARB,
50395bd8deadSopenharmony_ci    ProgramLocalParameter4dvARB, ProgramLocalParameterI4iNV,
50405bd8deadSopenharmony_ci    ProgramLocalParameterI4ivNV, ProgramLocalParameterI4uiNV,
50415bd8deadSopenharmony_ci    ProgramLocalParameterI4uivNV, GetProgramLocalParameter4fvARB,
50425bd8deadSopenharmony_ci    GetProgramLocalParameter4dvARB, GetProgramLocalParameterI4ivNV, and
50435bd8deadSopenharmony_ci    GetProgramLocalParameterI4uivNV if <index> is greater than or equal to the
50445bd8deadSopenharmony_ci    number of program local parameters supported by <target>.
50455bd8deadSopenharmony_ci
50465bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramEnvParameter4fARB,
50475bd8deadSopenharmony_ci    ProgramEnvParameter4fvARB, ProgramEnvParameter4dARB,
50485bd8deadSopenharmony_ci    ProgramEnvParameter4dvARB, ProgramEnvParameterI4iNV,
50495bd8deadSopenharmony_ci    ProgramEnvParameterI4ivNV, ProgramEnvParameterI4uiNV,
50505bd8deadSopenharmony_ci    ProgramEnvParameterI4uivNV, GetProgramEnvParameter4fvARB,
50515bd8deadSopenharmony_ci    GetProgramEnvParameter4dvARB, GetProgramEnvParameterI4ivNV, and
50525bd8deadSopenharmony_ci    GetProgramEnvParameterI4uivNV if <index> is greater than or equal to the
50535bd8deadSopenharmony_ci    number of program environment parameters supported by <target>.
50545bd8deadSopenharmony_ci
50555bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramLocalParameters4fvNV,
50565bd8deadSopenharmony_ci    ProgramLocalParametersI4ivNV, and ProgramLocalParametersI4uivNV if the sum
50575bd8deadSopenharmony_ci    of <index> and <count> is greater than the number of program local
50585bd8deadSopenharmony_ci    parameters supported by <target>.
50595bd8deadSopenharmony_ci
50605bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by ProgramEnvParameters4fvNV,
50615bd8deadSopenharmony_ci    ProgramEnvParametersI4ivNV, and ProgramEnvParametersI4uivNV if the sum of
50625bd8deadSopenharmony_ci    <index> and <count> is greater than the number of program environment
50635bd8deadSopenharmony_ci    parameters supported by <target>.
50645bd8deadSopenharmony_ci
50655bd8deadSopenharmony_ci
50665bd8deadSopenharmony_ciDependencies on NV_parameter_buffer_object
50675bd8deadSopenharmony_ci
50685bd8deadSopenharmony_ci    If NV_parameter_buffer_object is not supported, references to program
50695bd8deadSopenharmony_ci    parameter buffer variables and bindings should be removed.
50705bd8deadSopenharmony_ci
50715bd8deadSopenharmony_ci
50725bd8deadSopenharmony_ciDependencies on ARB_texture_rectangle
50735bd8deadSopenharmony_ci
50745bd8deadSopenharmony_ci    If ARB_texture_rectangle is not supported, references to rectangle
50755bd8deadSopenharmony_ci    textures and the RECT and SHADOWRECT texture target identifiers should be
50765bd8deadSopenharmony_ci    removed.
50775bd8deadSopenharmony_ci
50785bd8deadSopenharmony_ci
50795bd8deadSopenharmony_ciDependencies on EXT_gpu_program_parameters
50805bd8deadSopenharmony_ci
50815bd8deadSopenharmony_ci    If EXT_gpu_program_parameters is not supported, references to the
50825bd8deadSopenharmony_ci    Program{Local,Env}Parameters4fvNV commands, which set multiple program
50835bd8deadSopenharmony_ci    local or environment parameters in a single call, should be removed.
50845bd8deadSopenharmony_ci    These prototypes were included in this spec for completeness only.
50855bd8deadSopenharmony_ci
50865bd8deadSopenharmony_ci
50875bd8deadSopenharmony_ciDependencies on EXT_texture_integer
50885bd8deadSopenharmony_ci
50895bd8deadSopenharmony_ci    If EXT_texture_integer is not supported, references to texture lookups
50905bd8deadSopenharmony_ci    returning integer values in Section 2.X.4.4 (Texture Access) should be
50915bd8deadSopenharmony_ci    removed, and all texture formats are considered to produce floating-point
50925bd8deadSopenharmony_ci    values.
50935bd8deadSopenharmony_ci
50945bd8deadSopenharmony_ci
50955bd8deadSopenharmony_ciDependencies on EXT_texture_array
50965bd8deadSopenharmony_ci
50975bd8deadSopenharmony_ci    If EXT_texture_array is not supported, references to array textures in
50985bd8deadSopenharmony_ci    Section 2.X.4.4 (Texture Access) and elsewhere should be removed, as
50995bd8deadSopenharmony_ci    should all references to the "ARRAY1D", "ARRAY2D", "SHADOWARRAY1D", and
51005bd8deadSopenharmony_ci    "SHADOWARRAY2D" tokens.
51015bd8deadSopenharmony_ci
51025bd8deadSopenharmony_ci
51035bd8deadSopenharmony_ciDependencies on EXT_texture_buffer_object
51045bd8deadSopenharmony_ci
51055bd8deadSopenharmony_ci    If EXT_texture_buffer_object is not supported, references to buffer
51065bd8deadSopenharmony_ci    textures in Section 2.X.4.4 (Texture Access) and elsewhere should be
51075bd8deadSopenharmony_ci    removed, as should all references to the "BUFFER" tokens.
51085bd8deadSopenharmony_ci
51095bd8deadSopenharmony_ci
51105bd8deadSopenharmony_ciDependencies on NV_primitive_restart
51115bd8deadSopenharmony_ci
51125bd8deadSopenharmony_ci    If NV_primitive_restart is supported, index values causing a primitive
51135bd8deadSopenharmony_ci    restart are not considered as specifying an End command, followed by
51145bd8deadSopenharmony_ci    another Begin.  Primitive restart is therefore not guaranteed to
51155bd8deadSopenharmony_ci    immediately update bindings for material properties changed inside a
51165bd8deadSopenharmony_ci    Begin/End.  The spec language says they "are not guaranteed to update
51175bd8deadSopenharmony_ci    program parameter bindings until the following End command."
51185bd8deadSopenharmony_ci
51195bd8deadSopenharmony_ci
51205bd8deadSopenharmony_ciNew State
51215bd8deadSopenharmony_ci
51225bd8deadSopenharmony_ci                                                         Initial
51235bd8deadSopenharmony_ci    Get Value                     Type  Get Command       Value  Description             Sec     Attrib
51245bd8deadSopenharmony_ci    ----------------------------  ----  ---------------  ------- ----------------------  ------  ------
51255bd8deadSopenharmony_ci    PROGRAM_ATTRIB_COMPONENTS_NV  Z+    GetProgramivARB     -    number of components    6.1.12   -
51265bd8deadSopenharmony_ci                                                                 used for attributes
51275bd8deadSopenharmony_ci    PROGRAM_RESULT_COMPONENTS_NV  Z+    GetProgramivARB     -    number of components    6.1.12   -
51285bd8deadSopenharmony_ci                                                                 used for results
51295bd8deadSopenharmony_ci
51305bd8deadSopenharmony_ci    Table X.20.  New Program Object State.  Program object queries return
51315bd8deadSopenharmony_ci    attributes of the program object currently bound to the program target
51325bd8deadSopenharmony_ci    <target>.
51335bd8deadSopenharmony_ci
51345bd8deadSopenharmony_ci
51355bd8deadSopenharmony_ciNew Implementation Dependent State
51365bd8deadSopenharmony_ci
51375bd8deadSopenharmony_ci                                                             Minimum
51385bd8deadSopenharmony_ci    Get Value                         Type  Get Command       Value   Description           Sec.   Attrib
51395bd8deadSopenharmony_ci    --------------------------------  ----  ---------------  -------  --------------------- ------ ------
51405bd8deadSopenharmony_ci    MIN_PROGRAM_TEXEL_OFFSET_EXT      Z     GetIntegerv        -8     minimum texel offset  2.x.4.4  -
51415bd8deadSopenharmony_ci                                                                      allowed in lookup
51425bd8deadSopenharmony_ci    MAX_PROGRAM_TEXEL_OFFSET_EXT      Z     GetIntegerv        +7     maximum texel offset  2.x.4.4  -
51435bd8deadSopenharmony_ci                                                                      allowed in lookup
51445bd8deadSopenharmony_ci    MAX_PROGRAM_ATTRIB_COMPONENTS_NV  Z+    GetProgramivARB    (*)    maximum number of     6.1.12   -
51455bd8deadSopenharmony_ci                                                                      components allowed
51465bd8deadSopenharmony_ci                                                                      for attributes
51475bd8deadSopenharmony_ci    MAX_PROGRAM_RESULT_COMPONENTS_NV  Z+    GetProgramivARB    (*)    maximum number of     6.1.12   -
51485bd8deadSopenharmony_ci                                                                      components allowed
51495bd8deadSopenharmony_ci                                                                      for results
51505bd8deadSopenharmony_ci    MAX_PROGRAM_GENERIC_ATTRIBS_NV    Z+    GetProgramivARB    (*)    number of generic     6.1.12   -
51515bd8deadSopenharmony_ci                                                                      attribute vectors
51525bd8deadSopenharmony_ci                                                                      supported
51535bd8deadSopenharmony_ci    MAX_PROGRAM_GENERIC_RESULTS_NV    Z+    GetProgramivARB    (*)    number of generic     6.1.12   -
51545bd8deadSopenharmony_ci                                                                      result vectors
51555bd8deadSopenharmony_ci                                                                      supported
51565bd8deadSopenharmony_ci    MAX_PROGRAM_CALL_DEPTH_NV         Z+    GetProgramivARB     4     maximum program       2.X.5    -
51575bd8deadSopenharmony_ci                                                                      call stack depth
51585bd8deadSopenharmony_ci    MAX_PROGRAM_IF_DEPTH_NV           Z+    GetProgramivARB     48    maximum program       2.X.5    -
51595bd8deadSopenharmony_ci                                                                      if nesting
51605bd8deadSopenharmony_ci    MAX_PROGRAM_LOOP_DEPTH_NV         Z+    GetProgramivARB     4     maximum program       2.X.5    -
51615bd8deadSopenharmony_ci                                                                      loop nesting
51625bd8deadSopenharmony_ci
51635bd8deadSopenharmony_ci    Table X.21:  New Implementation-Dependent Values Introduced by
51645bd8deadSopenharmony_ci    NV_gpu_program4.  (*) means that the required minimum is program
51655bd8deadSopenharmony_ci    type-specific.  There are separate limits for each program type.
51665bd8deadSopenharmony_ci
51675bd8deadSopenharmony_ci
51685bd8deadSopenharmony_ciIssues
51695bd8deadSopenharmony_ci
51705bd8deadSopenharmony_ci    (1) How does this extension differ from previous NV_vertex_program and
51715bd8deadSopenharmony_ci    NV_fragment_program extensions?
51725bd8deadSopenharmony_ci
51735bd8deadSopenharmony_ci      RESOLVED:
51745bd8deadSopenharmony_ci
51755bd8deadSopenharmony_ci        - This extension provides a uniform set of instructions and bindings.
51765bd8deadSopenharmony_ci          Unlike previous extensions, the set of instructions and bindings
51775bd8deadSopenharmony_ci          available is generally the same.  The only exceptions are a small
51785bd8deadSopenharmony_ci          number of instructions and bindings that make sense for one specific
51795bd8deadSopenharmony_ci          program type.
51805bd8deadSopenharmony_ci
51815bd8deadSopenharmony_ci        - This extension supports integer data types and provides a
51825bd8deadSopenharmony_ci          full-fledged integer instruction set.
51835bd8deadSopenharmony_ci
51845bd8deadSopenharmony_ci        - This extension supports array variables of all types, including
51855bd8deadSopenharmony_ci          temporaries.  Array variables can be accessed directly or indirectly
51865bd8deadSopenharmony_ci          (using integer temporaries as indices).
51875bd8deadSopenharmony_ci
51885bd8deadSopenharmony_ci        - This extension provides a uniform set of structured branching
51895bd8deadSopenharmony_ci          constructs (if tests, loops, subroutines) that fully support
51905bd8deadSopenharmony_ci          run-time condition testing.  Previous versions of NV_vertex_program
51915bd8deadSopenharmony_ci          provided unstructured branching.  Previous versions of
51925bd8deadSopenharmony_ci          NV_fragment_program provided structure branching constructs, but the
51935bd8deadSopenharmony_ci          support was more limited -- for example, looping constructs couldn't
51945bd8deadSopenharmony_ci          specify loop counts with values computed at run time.
51955bd8deadSopenharmony_ci
51965bd8deadSopenharmony_ci        - This extension supports geometry programs, which are described in
51975bd8deadSopenharmony_ci          more detail in the NV_geometry_program4 extension.
51985bd8deadSopenharmony_ci
51995bd8deadSopenharmony_ci        - This extension provides the ability to specify and use cubemap
52005bd8deadSopenharmony_ci          textures with a DEPTH_COMPONENT internal format.  Shadow mapping is
52015bd8deadSopenharmony_ci          supported; the Q texture coordinate is used as the reference value
52025bd8deadSopenharmony_ci          for comparisons.
52035bd8deadSopenharmony_ci
52045bd8deadSopenharmony_ci    (2) Is this extension backward-compatible with previous NV_vertex_program
52055bd8deadSopenharmony_ci    and NV_fragment_program extensions?  If not, what support has been
52065bd8deadSopenharmony_ci    removed?
52075bd8deadSopenharmony_ci
52085bd8deadSopenharmony_ci      RESOLVED:  This extension is largely, but not completely,
52095bd8deadSopenharmony_ci      backward-compatible.  Functionality removed includes:
52105bd8deadSopenharmony_ci
52115bd8deadSopenharmony_ci        - Unstructured branching:  NV_vertex_program2 included a general
52125bd8deadSopenharmony_ci          branch instruction "BRA" that could be used to jump to an arbitrary
52135bd8deadSopenharmony_ci          instruction.  The "CAL" instruction could "call" to an arbitrary
52145bd8deadSopenharmony_ci          instruction into code that was not necessarily structured as simple
52155bd8deadSopenharmony_ci          subroutine blocks.  Arbitrary unstructured branching can be
52165bd8deadSopenharmony_ci          difficult to implement efficiently on highly parallel GPU
52175bd8deadSopenharmony_ci          architectures, while basic structured branching is not nearly as
52185bd8deadSopenharmony_ci          difficult.
52195bd8deadSopenharmony_ci
52205bd8deadSopenharmony_ci          This extension retains the "CAL" instruction but treats each block
52215bd8deadSopenharmony_ci          of code between instruction labels as a separate subroutine.  The
52225bd8deadSopenharmony_ci          "BRA" instruction and arbitrary branching has been removed.  The
52235bd8deadSopenharmony_ci          structured branching constructs in this extension are sufficient to
52245bd8deadSopenharmony_ci          implement almost all of the looping/branching support in high-level
52255bd8deadSopenharmony_ci          languages ("goto" being the most obvious exception).
52265bd8deadSopenharmony_ci
52275bd8deadSopenharmony_ci        - Address registers:  NV_vertex_program added the notion of address
52285bd8deadSopenharmony_ci          registers, which were effectively under-powered integer temporaries.
52295bd8deadSopenharmony_ci          The set of instructions used to manipulate address registers was
52305bd8deadSopenharmony_ci          severely limited.  NV_vertex_program[23] extended the original
52315bd8deadSopenharmony_ci          scalars to vectors and added a few more instructions to manipulate
52325bd8deadSopenharmony_ci          address registers.  Fragment programs had no address registers until
52335bd8deadSopenharmony_ci          NV_fragment_program2 added the loop counter, which was very similar
52345bd8deadSopenharmony_ci          in functionality to vertex program address registers, but even more
52355bd8deadSopenharmony_ci          limited.  This extension adds true integer temporaries, which can
52365bd8deadSopenharmony_ci          accomplish everything old address registers could do, and much more.
52375bd8deadSopenharmony_ci          Address register support was removed to simplify the API.
52385bd8deadSopenharmony_ci
52395bd8deadSopenharmony_ci        - NV_fragment_program2 LOOP construct:  NV_fragment_program2 added a
52405bd8deadSopenharmony_ci          LOOP instruction, which let you repeat a block of code <N> times,
52415bd8deadSopenharmony_ci          with a parallel loop counter that started at <A> and stepped by <B>
52425bd8deadSopenharmony_ci          on each iteration.  This construct was signficantly limited in
52435bd8deadSopenharmony_ci          several ways -- the loop count had to be constant, and you could
52445bd8deadSopenharmony_ci          only access the innermost loop counter in a nested loop.  This
52455bd8deadSopenharmony_ci          extension discards the support and retains the simpler "REP"
52465bd8deadSopenharmony_ci          construct to implement loops.  If desired, a loop counter can be
52475bd8deadSopenharmony_ci          implemented by manipulating an integer temporary.  The "BRK"
52485bd8deadSopenharmony_ci          instruction (conditional break) is retained, and a "CONT"
52495bd8deadSopenharmony_ci          instruction (conditional continue) is added.  Additionally, the loop
52505bd8deadSopenharmony_ci          count need not be a constant.
52515bd8deadSopenharmony_ci
52525bd8deadSopenharmony_ci        - NV_vertex_program and ARB_vertex_program EXP and LOG instructions:
52535bd8deadSopenharmony_ci          NV_vertex_program provided EXP and LOG instructions that computed a
52545bd8deadSopenharmony_ci          rough approximation of 2^x or log_2(x) and provided some additional
52555bd8deadSopenharmony_ci          values that could help refine the approximation.  Those opcodes were
52565bd8deadSopenharmony_ci          carried forward into ARB_vertex_program.  Both ARB_vertex_program
52575bd8deadSopenharmony_ci          and NV_vertex_program2 provided EX2 and LG2 instructions that
52585bd8deadSopenharmony_ci          computed a better approximation.  All fragment program extensions
52595bd8deadSopenharmony_ci          also provided EX2 and LG2, but did not bother to include EXP and
52605bd8deadSopenharmony_ci          LOG.  On the hardware targeted by this extension, there is no
52615bd8deadSopenharmony_ci          advantage to using EXP and LOG, so these opcodes have been removed
52625bd8deadSopenharmony_ci          for simplicity.
52635bd8deadSopenharmony_ci
52645bd8deadSopenharmony_ci        - NV_vertex_program3 and NV_fragment_program2 provide the ability to
52655bd8deadSopenharmony_ci          do indirect addressing of inputs/outputs when using bindings in
52665bd8deadSopenharmony_ci          instructions -- for example:
52675bd8deadSopenharmony_ci
52685bd8deadSopenharmony_ci            MOV R0, vertex.attrib[A0.x+2];      # vertex
52695bd8deadSopenharmony_ci            MOV result.texcoord[A0.y], R1;      # vertex
52705bd8deadSopenharmony_ci            MOV R2, fragment.texcoord[A0.x];    # fragment
52715bd8deadSopenharmony_ci
52725bd8deadSopenharmony_ci          This extension provides indexing capability, but using named array
52735bd8deadSopenharmony_ci          variables instead.
52745bd8deadSopenharmony_ci
52755bd8deadSopenharmony_ci            ATTRIB attribs[] = { vertex.attrib[2..5] };
52765bd8deadSopenharmony_ci            MOV R0, attribs[A0.x];
52775bd8deadSopenharmony_ci            OUTPUT outcoords[] = { result.texcoord[0..3] };
52785bd8deadSopenharmony_ci            MOV outcoords[A0.y], R1;
52795bd8deadSopenharmony_ci            ATTRIB texcoords[] = { fragment.texcoord[0..2] };
52805bd8deadSopenharmony_ci            MOV R2, texcoords[A0.x];
52815bd8deadSopenharmony_ci
52825bd8deadSopenharmony_ci          This approach makes the set of attribute and result bindings more
52835bd8deadSopenharmony_ci          regular.  Additionally, it helps the assembler determine which
52845bd8deadSopenharmony_ci          vertex/fragment attributes are actually needed -- when the assembler
52855bd8deadSopenharmony_ci          sees constructs like "fragment.texcoord[A0.x]", it must treat *all*
52865bd8deadSopenharmony_ci          texture coordinates as live unless it can determine the range of
52875bd8deadSopenharmony_ci          values used for indexing.  The named array variable approach
52885bd8deadSopenharmony_ci          explicitly identifies which attributes are needed when indexing is
52895bd8deadSopenharmony_ci          used.
52905bd8deadSopenharmony_ci
52915bd8deadSopenharmony_ci      Functionality altered includes:
52925bd8deadSopenharmony_ci
52935bd8deadSopenharmony_ci        - The RSQ instruction in the original NV_vertex_program and
52945bd8deadSopenharmony_ci          ARB_vertex_program extensions implicitly took the absolute value of
52955bd8deadSopenharmony_ci          their operand.  Since the ARB extensions don't have numerics
52965bd8deadSopenharmony_ci          guarantees, computing the reciprocal square root of a negative value
52975bd8deadSopenharmony_ci          was not meaningful.  To allow for the possibility of taking the
52985bd8deadSopenharmony_ci          reciprocal square root of a negative value (which should yield NaN
52995bd8deadSopenharmony_ci          -- "not a number"), the RSQ instruction in this instruction no
53005bd8deadSopenharmony_ci          longer implicitly takes the absolute value of its operand.
53015bd8deadSopenharmony_ci          Equivalent functionality can be achieved using the explicit |abs|
53025bd8deadSopenharmony_ci          absolute value operator on the operand to RSQ.
53035bd8deadSopenharmony_ci
53045bd8deadSopenharmony_ci        - The results of texture lookups accessing inconsistent textures are
53055bd8deadSopenharmony_ci          now undefined, instead of producing a fixed constant vector.
53065bd8deadSopenharmony_ci
53075bd8deadSopenharmony_ci
53085bd8deadSopenharmony_ci    (3) What should this set of extensions be called?
53095bd8deadSopenharmony_ci
53105bd8deadSopenharmony_ci      RESOLVED:  NV_gpu_program4, NV_vertex_program4, NV_fragment_program4,
53115bd8deadSopenharmony_ci      and NV_geometry_program4.  Only NV_gpu_program4 will appear in the
53125bd8deadSopenharmony_ci      extension string; the other three specifications exist simply to define
53135bd8deadSopenharmony_ci      vertex, fragment, and geometry program-specific features.
53145bd8deadSopenharmony_ci
53155bd8deadSopenharmony_ci      The "gpu_program" name was chosen due to the common instruction set
53165bd8deadSopenharmony_ci      intended to run on GPUs.  On previous chip generations, the vertex and
53175bd8deadSopenharmony_ci      fragment instruction sets were similar, but there were enough
53185bd8deadSopenharmony_ci      differences to package them separately.
53195bd8deadSopenharmony_ci
53205bd8deadSopenharmony_ci      The choice of "4" indicates that this is the fourth generation of
53215bd8deadSopenharmony_ci      programmable hardware from NVIDIA.  The GeForce3 and GeForce4 series
53225bd8deadSopenharmony_ci      supported NV_vertex_program.  The GeForce FX series supported
53235bd8deadSopenharmony_ci      NV_vertex_program2 and added fragment programmability with
53245bd8deadSopenharmony_ci      NV_fragment_program.  Around this time, the OpenGL Architecture Review
53255bd8deadSopenharmony_ci      Board (ARB) approved ARB_vertex_program and ARB_fragment_program
53265bd8deadSopenharmony_ci      extensions, and NVIDIA added NV_vertex_program2_option and
53275bd8deadSopenharmony_ci      NV_fragment_program_option extensions exposing GeForce FX features using
53285bd8deadSopenharmony_ci      the ARB extensions' instruction set.  The GeForce6 and GeForce7 series
53295bd8deadSopenharmony_ci      brought the NV_vertex_program3 and NV_fragment_program2 extensions,
53305bd8deadSopenharmony_ci      which extend the ARB extensions further.  This extension adds geometry
53315bd8deadSopenharmony_ci      programs, and brings the "version number" for each of these extensions
53325bd8deadSopenharmony_ci      up to "4".
53335bd8deadSopenharmony_ci
53345bd8deadSopenharmony_ci
53355bd8deadSopenharmony_ci    (4) This instruction adds integer data type support in programmable
53365bd8deadSopenharmony_ci    shaders that were previously float-centric.  Should applications be able
53375bd8deadSopenharmony_ci    to pass integer values directly to the shaders, and if so, how does it
53385bd8deadSopenharmony_ci    work?
53395bd8deadSopenharmony_ci
53405bd8deadSopenharmony_ci      RESOLVED:  The diagram at the bottom of this issue depicts data flows in
53415bd8deadSopenharmony_ci      the GL, as extended by this and related extensions.
53425bd8deadSopenharmony_ci
53435bd8deadSopenharmony_ci      This extension generalizes some state to be "typeless", instead of being
53445bd8deadSopenharmony_ci      strongly typed (and almost invariably floating-point) as in the core
53455bd8deadSopenharmony_ci      specification.  We introduce a new set of functions to specify GL state
53465bd8deadSopenharmony_ci      as signed or unsigned integer values, instead of floating point values.
53475bd8deadSopenharmony_ci      These functions include:
53485bd8deadSopenharmony_ci
53495bd8deadSopenharmony_ci        * VertexAttribI*{i,ui}() -- Specify generic vertex attributes as
53505bd8deadSopenharmony_ci          integers.  This extension does not create "integer" versions for
53515bd8deadSopenharmony_ci          fixed-function attribute functions (e.g., glColor, glTexCoord),
53525bd8deadSopenharmony_ci          which remain fully floating-point.
53535bd8deadSopenharmony_ci
53545bd8deadSopenharmony_ci        * Program{Env,Local}ParameterI*{i,ui}() -- Specify environment and
53555bd8deadSopenharmony_ci          local parameters as integers.
53565bd8deadSopenharmony_ci
53575bd8deadSopenharmony_ci        * TexImage*() with EXT_texture_integer internal formats -- Specify
53585bd8deadSopenharmony_ci          texture images as containing integer data whose values are not
53595bd8deadSopenharmony_ci          converted to floating-point values.
53605bd8deadSopenharmony_ci
53615bd8deadSopenharmony_ci        * EXT_parameter_buffer_object functions -- Bind (typeless) buffer
53625bd8deadSopenharmony_ci          object data stores for use as program parameters.  These buffer
53635bd8deadSopenharmony_ci          objects can be loaded with either integer or floating-point data.
53645bd8deadSopenharmony_ci
53655bd8deadSopenharmony_ci        * EXT_texture_buffer_object functions -- Bind (typeless) buffer object
53665bd8deadSopenharmony_ci          data stores for use as textures.  These buffer objects can be loaded
53675bd8deadSopenharmony_ci          with either integer or floating-point data.
53685bd8deadSopenharmony_ci
53695bd8deadSopenharmony_ci      Each type of program (using NV_gpu_program4 and related extension) can
53705bd8deadSopenharmony_ci      read attributes using any data type (float, signed integer, unsigned
53715bd8deadSopenharmony_ci      integer) and write result values used by subsequent stages using any
53725bd8deadSopenharmony_ci      data type.
53735bd8deadSopenharmony_ci
53745bd8deadSopenharmony_ci      Finally, there are several new places where integer data can be
53755bd8deadSopenharmony_ci      consumed by the GL:
53765bd8deadSopenharmony_ci
53775bd8deadSopenharmony_ci        * NV_transform_feedback -- Stream transformed vertex attribute
53785bd8deadSopenharmony_ci          components to a (typeless) buffer object.  The transformed
53795bd8deadSopenharmony_ci          attributes can be written as signed or unsigned integers in vertex
53805bd8deadSopenharmony_ci          and geometry programs.
53815bd8deadSopenharmony_ci
53825bd8deadSopenharmony_ci        * EXT_texture_integer internal formats and framebuffer objects --
53835bd8deadSopenharmony_ci          Provide support for rendering to integer texture formats, where
53845bd8deadSopenharmony_ci          final fragment values are treated as signed or unsigned integers,
53855bd8deadSopenharmony_ci          rather than floating-point values.
53865bd8deadSopenharmony_ci
53875bd8deadSopenharmony_ci      The diagram below represents a substantial portion of the GL pipeline.
53885bd8deadSopenharmony_ci      Each line connecting blocks represents an interface where data is
53895bd8deadSopenharmony_ci      "produced" from the GL state or by fixed-function or programmable
53905bd8deadSopenharmony_ci      pipeline stages and "consumed" by another pipeline stage.  Each producer
53915bd8deadSopenharmony_ci      and consumer is labeled with a data type.  For producers, the
53925bd8deadSopenharmony_ci      "(typeless)" designation generally means that the state and/or output
53935bd8deadSopenharmony_ci      can be written as floating-point values or as signed or unsigned
53945bd8deadSopenharmony_ci      integers.  "(float)" means that the outputs are always written as
53955bd8deadSopenharmony_ci      floating-point.  The same distinction applies to consumers --
53965bd8deadSopenharmony_ci      "(typeless)" means that the consumer is capable of reading inputs using
53975bd8deadSopenharmony_ci      any data type, and "(float)" means that consumer always reads inputs as
53985bd8deadSopenharmony_ci      floating-point values.
53995bd8deadSopenharmony_ci
54005bd8deadSopenharmony_ci      To get sane results, applications must ensure that each value passed
54015bd8deadSopenharmony_ci      between pipeline stages is produced and consumed using the same data
54025bd8deadSopenharmony_ci      type.  If a value is written in one stage as a floating-point value; it
54035bd8deadSopenharmony_ci      must be read as a floating-point value as well.  If such a value is read
54045bd8deadSopenharmony_ci      as a signed or unsigned integer, its value is considered undefined.  In
54055bd8deadSopenharmony_ci      practice, the raw bits used to represent the floating-point (IEEE
54065bd8deadSopenharmony_ci      single-precision floating-point encoding in the initial implementation
54075bd8deadSopenharmony_ci      of this spec) will be treated as an integer.
54085bd8deadSopenharmony_ci
54095bd8deadSopenharmony_ci      Type matching between stages is not enforced by the GL, because the
54105bd8deadSopenharmony_ci      overhead of doing so would be substantial.  Such overhead would include:
54115bd8deadSopenharmony_ci
54125bd8deadSopenharmony_ci        * matching the inputs and outputs of each pipeline stage
54135bd8deadSopenharmony_ci          (fixed-function or programmable) every time the program
54145bd8deadSopenharmony_ci          configuration or fixed-function state changes,
54155bd8deadSopenharmony_ci
54165bd8deadSopenharmony_ci        * tracking the data type of each generic vertex attribute and checking
54175bd8deadSopenharmony_ci          it against the vertex program's inputs,
54185bd8deadSopenharmony_ci
54195bd8deadSopenharmony_ci        * tracking the data type of each program parameter and checking it
54205bd8deadSopenharmony_ci          against the manner the parameters were used in programs,
54215bd8deadSopenharmony_ci
54225bd8deadSopenharmony_ci        * matching color buffers against fragment program outputs.
54235bd8deadSopenharmony_ci
54245bd8deadSopenharmony_ci      Such error checking is certainly valuable, but the additional CPU
54255bd8deadSopenharmony_ci      overhead cost is substantial.  Given that current CPUs often have a hard
54265bd8deadSopenharmony_ci      time keeping up with high-end GPUs, adding more overhead is a step in
54275bd8deadSopenharmony_ci      the wrong direction.  We expect developer tools, such as instrumented
54285bd8deadSopenharmony_ci      drivers, to be able to provide type checking on most interfaces.  
54295bd8deadSopenharmony_ci
54305bd8deadSopenharmony_ci      The diagram below depicts assembly programmability.  Using vertex,
54315bd8deadSopenharmony_ci      geometry, and fragment shaders provided by the OpenGL Shading Language
54325bd8deadSopenharmony_ci      (GLSL) isn't substantially different from the assembly interface, except
54335bd8deadSopenharmony_ci      that the interfaces between programmable pipeline stages are more
54345bd8deadSopenharmony_ci      tightly coupled in GLSL (vertex, geometry, and fragment shaders are
54355bd8deadSopenharmony_ci      linked together into a single program object), and that shader variables
54365bd8deadSopenharmony_ci      are more strongly typed in GLSL than in the assembly interface.
54375bd8deadSopenharmony_ci
54385bd8deadSopenharmony_ci      In the figure below, the first programmable stage is vertex program
54395bd8deadSopenharmony_ci      execution.  For all inputs read by the vertex program, they must be
54405bd8deadSopenharmony_ci      specified in the GL vertex APIs (immediate mode or vertex arrays) using
54415bd8deadSopenharmony_ci      a data type matching the data type read by the shader.  Additionally,
54425bd8deadSopenharmony_ci      vertex programs (and all other program types) can read program
54435bd8deadSopenharmony_ci      parameters, parameter buffers, and textures.  In all cases the
54445bd8deadSopenharmony_ci      parameter, buffer, or texture data must be accessed in the shader using
54455bd8deadSopenharmony_ci      the same data type used to specify the data.  If vertex programs are
54465bd8deadSopenharmony_ci      disabled, fixed-function vertex processing is used.  Fixed-function
54475bd8deadSopenharmony_ci      vertex processing is fully floating-point, and all the conventional
54485bd8deadSopenharmony_ci      vertex attributes and state used by fixed-function are floating-point
54495bd8deadSopenharmony_ci      values.
54505bd8deadSopenharmony_ci
54515bd8deadSopenharmony_ci      After vertex processing, an optional geometry program can be executed,
54525bd8deadSopenharmony_ci      which reads attributes written by vertex programs (or fixed-functon) and
54535bd8deadSopenharmony_ci      writes out new vertex attributes.  The vertex attributes it reads must
54545bd8deadSopenharmony_ci      have been written by the vertex program (or fixed-function) using a
54555bd8deadSopenharmony_ci      matching data type.
54565bd8deadSopenharmony_ci
54575bd8deadSopenharmony_ci      After geometry program execution, vertex attributes can optionally be
54585bd8deadSopenharmony_ci      written out to buffer objects using the NV_transform_feedback extension.
54595bd8deadSopenharmony_ci      The vertex attributes are written by the GL to the buffer objects using
54605bd8deadSopenharmony_ci      the same data type used to write the attribute in the geometry program
54615bd8deadSopenharmony_ci      (or vertex program if geometry programs are disabled).
54625bd8deadSopenharmony_ci
54635bd8deadSopenharmony_ci      Then, rasterization generates fragments based on transformed vertices.
54645bd8deadSopenharmony_ci      Most attributes written by vertex or geometry programs can be read by
54655bd8deadSopenharmony_ci      fragment programs, after the rasterization hardware "interpolates" them.
54665bd8deadSopenharmony_ci      This extension allows fragment programs to control how each attribute is
54675bd8deadSopenharmony_ci      interpolated.  If an attribute is flat-shaded, it will be taken from the
54685bd8deadSopenharmony_ci      output attribute of the provoking vertex of the primitive using the same
54695bd8deadSopenharmony_ci      data type.  If an attribute is smooth-shaded, the per-vertex attributes
54705bd8deadSopenharmony_ci      will be interpreted as a floating-point value, and a floating-point
54715bd8deadSopenharmony_ci      result.  One necessary consequence of this is that any integer
54725bd8deadSopenharmony_ci      per-fragment attributes must be flat-shaded.  To prevent some
54735bd8deadSopenharmony_ci      interpolation type errors, assembly and GLSL fragment shaders will not
54745bd8deadSopenharmony_ci      compile if they declare an integer fragment attribute that is not flat
54755bd8deadSopenharmony_ci      shaded.  [NOTE:  While point primitives generally have constant
54765bd8deadSopenharmony_ci      attributes, any integer attributes must still be flat-shaded; point
54775bd8deadSopenharmony_ci      rasterization may perform (degenerate) floating-point interpolation.]
54785bd8deadSopenharmony_ci
54795bd8deadSopenharmony_ci      Fragment programs must read attributes using data types matching the
54805bd8deadSopenharmony_ci      outputs of the interpolation or flat-shading operations.  They may write
54815bd8deadSopenharmony_ci      one or more color outputs using any data type, but the data type used
54825bd8deadSopenharmony_ci      must match the corresponding framebuffer attachments.  Outputs directed
54835bd8deadSopenharmony_ci      at signed or unsigned integer textures (EXT_texture_integer) must be
54845bd8deadSopenharmony_ci      written using the appropriate integer data type; all other outputs must
54855bd8deadSopenharmony_ci      be written as floating-point values.  Note that some of the
54865bd8deadSopenharmony_ci      fixed-function per-fragment operations (e.g., blending, alpha test) are
54875bd8deadSopenharmony_ci      specified as floating-point operations and are skipped when directed at
54885bd8deadSopenharmony_ci      signed or unsigned integer color buffers.
54895bd8deadSopenharmony_ci
54905bd8deadSopenharmony_ci
54915bd8deadSopenharmony_ci
54925bd8deadSopenharmony_ci                                     generic               conventional
54935bd8deadSopenharmony_ci                                     vertex                  vertex
54945bd8deadSopenharmony_ci                                    attributes              attributes
54955bd8deadSopenharmony_ci                                       | (typeless)             | (float)
54965bd8deadSopenharmony_ci                                       |                        |
54975bd8deadSopenharmony_ci                                       |                        |
54985bd8deadSopenharmony_ci                                       | +----------------------+
54995bd8deadSopenharmony_ci         program                       | |                      |
55005bd8deadSopenharmony_ci        parameters ----+               | |                      |
55015bd8deadSopenharmony_ci        (typeless)     |               | | (typeless)           | (float)
55025bd8deadSopenharmony_ci                       |               V V                      V
55035bd8deadSopenharmony_ci         constant      +-+----------> vertex              fixed-function
55045bd8deadSopenharmony_ci         buffers   ----+ |(typeless)  program                 vertex
55055bd8deadSopenharmony_ci        (typeless)     | |              |                       |
55065bd8deadSopenharmony_ci                       | |              | (typeless)            | (float)
55075bd8deadSopenharmony_ci         textures  ----+ |              V                       |
55085bd8deadSopenharmony_ci        (typeless)       |              |<----------------------+
55095bd8deadSopenharmony_ci            |            |              |
55105bd8deadSopenharmony_ci            |            |              +---------------+
55115bd8deadSopenharmony_ci            |            |              |               |
55125bd8deadSopenharmony_ci            |            |              | (typeless)    |
55135bd8deadSopenharmony_ci            |            |              V               |
55145bd8deadSopenharmony_ci            |            +---------> geometry           |
55155bd8deadSopenharmony_ci            |            |(typeless) program            |
55165bd8deadSopenharmony_ci            |            |              |               |
55175bd8deadSopenharmony_ci            |            |              | (typeless)    |
55185bd8deadSopenharmony_ci            |            |              V               |
55195bd8deadSopenharmony_ci            |            |              |<--------------+
55205bd8deadSopenharmony_ci            |            |              |
55215bd8deadSopenharmony_ci            |            |              |
55225bd8deadSopenharmony_ci            |            |              +-----------------+
55235bd8deadSopenharmony_ci            |            |              |                 |(typeless)
55245bd8deadSopenharmony_ci            |            |              |                 v
55255bd8deadSopenharmony_ci            |            |              |             transform
55265bd8deadSopenharmony_ci            |            |              |             feedback
55275bd8deadSopenharmony_ci            |            |              |              buffers
55285bd8deadSopenharmony_ci            |            |              |
55295bd8deadSopenharmony_ci            |            |              |
55305bd8deadSopenharmony_ci            |            |              +-----------------------+
55315bd8deadSopenharmony_ci            |            |              |                       |
55325bd8deadSopenharmony_ci            |            |              | (float)               | (typeless)
55335bd8deadSopenharmony_ci            |            |              V                       V
55345bd8deadSopenharmony_ci            |            |         interpolated               flat
55355bd8deadSopenharmony_ci            |            |          attributes             attributes
55365bd8deadSopenharmony_ci            |            |              |                       |
55375bd8deadSopenharmony_ci            |            |              | (float)               | (typeless)
55385bd8deadSopenharmony_ci            |            |              V                       |
55395bd8deadSopenharmony_ci            |            |              |<----------------------+
55405bd8deadSopenharmony_ci            |            |              |
55415bd8deadSopenharmony_ci            |            |              +-----------------------+
55425bd8deadSopenharmony_ci            |            |              |                       |
55435bd8deadSopenharmony_ci            |            |              | (typeless)            | (float)
55445bd8deadSopenharmony_ci            |            |(typeless)    V                       V
55455bd8deadSopenharmony_ci            |            +---------> fragment     +------> fixed-function
55465bd8deadSopenharmony_ci            |                        program      |(float)   fragment
55475bd8deadSopenharmony_ci            |                           |         |             |
55485bd8deadSopenharmony_ci            +--------------------------/|/--------+             |
55495bd8deadSopenharmony_ci                                        |                       |
55505bd8deadSopenharmony_ci                                        | (typeless)            | (float)
55515bd8deadSopenharmony_ci                                        V                       |
55525bd8deadSopenharmony_ci                                        |<----------------------+
55535bd8deadSopenharmony_ci                                        |
55545bd8deadSopenharmony_ci                                        +-----------------------+------ ....
55555bd8deadSopenharmony_ci                                        |                       |
55565bd8deadSopenharmony_ci                                        | (typeless)            | (typeless)
55575bd8deadSopenharmony_ci                                        V                       V
55585bd8deadSopenharmony_ci                                      color                   color
55595bd8deadSopenharmony_ci                                    attachment              attachment
55605bd8deadSopenharmony_ci                                        0                       1
55615bd8deadSopenharmony_ci         
55625bd8deadSopenharmony_ci
55635bd8deadSopenharmony_ci    (5) Instructions can operate on signed integer, unsigned integer, and
55645bd8deadSopenharmony_ci    floating-point values.  Some operations make sense on all three data
55655bd8deadSopenharmony_ci    types?  How is this supported, and what type checking support is provided
55665bd8deadSopenharmony_ci    by the assembler?
55675bd8deadSopenharmony_ci
55685bd8deadSopenharmony_ci      RESOLVED:  One important property of the instruction set is that the
55695bd8deadSopenharmony_ci      data type for all operands and the result is fully specified by the
55705bd8deadSopenharmony_ci      instructions themselves.  For instructions (such as ADD) that make sense
55715bd8deadSopenharmony_ci      for both integer and floating-point values, an optional data type
55725bd8deadSopenharmony_ci      modifier is provided to indicate which type of operation should be
55735bd8deadSopenharmony_ci      performed.  For example, "ADD.S", "ADD.U", and "ADD.F", add signed
55745bd8deadSopenharmony_ci      integers, unsigned integers, or floating-point values, respectively.  If
55755bd8deadSopenharmony_ci      no data type modifier is provided, ".F" is assumed if the instruction
55765bd8deadSopenharmony_ci      can apply to floating-point values and ".S" is assumed otherwise.
55775bd8deadSopenharmony_ci
55785bd8deadSopenharmony_ci      To help identify errors where the wrong data type is used -- for
55795bd8deadSopenharmony_ci      example, adding integer values in an ADD instruction that omits a data
55805bd8deadSopenharmony_ci      type modifier and thus defaults to "ADD.F" -- variables may be declared
55815bd8deadSopenharmony_ci      with optional data type modifiers.  In the following code:
55825bd8deadSopenharmony_ci
55835bd8deadSopenharmony_ci        INT TEMP a;
55845bd8deadSopenharmony_ci        UINT TEMP b;
55855bd8deadSopenharmony_ci        FLOAT TEMP c;
55865bd8deadSopenharmony_ci        TEMP d;
55875bd8deadSopenharmony_ci
55885bd8deadSopenharmony_ci      "a", "b", "c", and "d" are declared as temporary variables holding
55895bd8deadSopenharmony_ci      signed integer, unsigned integer, floating-point, and typeless values.
55905bd8deadSopenharmony_ci      Since each instruction fully specifies the data type of each operand and
55915bd8deadSopenharmony_ci      its result, these data types can be checked against the data type
55925bd8deadSopenharmony_ci      assigned to the variables operated on.  If the types don't match, and
55935bd8deadSopenharmony_ci      the variable is not typeless, an error is reported.  The opcode modifier
55945bd8deadSopenharmony_ci      ".NTC" can be used to ignore such errors on a per-opcode basis, if
55955bd8deadSopenharmony_ci      required.
55965bd8deadSopenharmony_ci
55975bd8deadSopenharmony_ci      Note that when bindings are used directly in instructions, they are
55985bd8deadSopenharmony_ci      always considered typeless for simplicity.  Some fixed-function bindings
55995bd8deadSopenharmony_ci      have an obvious data type, but other bindings (e.g., program parameters)
56005bd8deadSopenharmony_ci      can hold either integer or floating-point values, depending on how they
56015bd8deadSopenharmony_ci      were specified.
56025bd8deadSopenharmony_ci
56035bd8deadSopenharmony_ci      Variable data types are optional.  Typeless variables are provided
56045bd8deadSopenharmony_ci      because some programs may want to reuse the same variable in several
56055bd8deadSopenharmony_ci      places with different data types.
56065bd8deadSopenharmony_ci
56075bd8deadSopenharmony_ci    (6) Should both signed (INT) and unsigned integer (UINT) data types be
56085bd8deadSopenharmony_ci    provided?
56095bd8deadSopenharmony_ci
56105bd8deadSopenharmony_ci      RESOLVED:  Yes.  Signed and unsigned integer operations are supported.
56115bd8deadSopenharmony_ci      Providing both "INT" and "UINT" variable modifiers distinguish between
56125bd8deadSopenharmony_ci      signed and unsigned values for type checking purposes, to ensure that
56135bd8deadSopenharmony_ci      unsigned values aren't read as signed values and vice versa.
56145bd8deadSopenharmony_ci
56155bd8deadSopenharmony_ci      This specification says if a value is read a signed integer, but was
56165bd8deadSopenharmony_ci      written as an unsigned integer, the value returned is undefined.
56175bd8deadSopenharmony_ci      However, signed and unsigned integers are interchangeable in practice,
56185bd8deadSopenharmony_ci      except for very large unsigned integers (which can't be represented as
56195bd8deadSopenharmony_ci      signed values of the equivalent size) or negative signed integers.
56205bd8deadSopenharmony_ci
56215bd8deadSopenharmony_ci      If programs know that they won't generate negative or very large values,
56225bd8deadSopenharmony_ci      signed and unsigned integers can be used interchangeably.  To avoid type
56235bd8deadSopenharmony_ci      errors in the assembler in this case, typeless variables can be used.
56245bd8deadSopenharmony_ci      Or the ".NTC" modifier can be used when appropriate.
56255bd8deadSopenharmony_ci
56265bd8deadSopenharmony_ci    (7) Integer and floating-point constants are supported in the instruction
56275bd8deadSopenharmony_ci    set.  Integer constants might be interpreted to mean either "real integer"
56285bd8deadSopenharmony_ci    values or floating-point values.  How are they supported?
56295bd8deadSopenharmony_ci
56305bd8deadSopenharmony_ci      RESOLVED:  When an obvious floating point constant is specified (e.g.,
56315bd8deadSopenharmony_ci      "3.0"), the developers' intent is clear.  If you try to use a
56325bd8deadSopenharmony_ci      floating-point value in an instruction that wants an integer operand, or
56335bd8deadSopenharmony_ci      a declaration of an integer parameter variable, the program will fail to
56345bd8deadSopenharmony_ci      load.  An integer constant used in an instruction isn't quite as clear.
56355bd8deadSopenharmony_ci      But its meaning can be easily inferred because the operand types of
56365bd8deadSopenharmony_ci      instructions are well-known at compile time.  An integer multiply
56375bd8deadSopenharmony_ci      involving the constant "2" will interpret the "2" as an integer.  A
56385bd8deadSopenharmony_ci      floating-point multiply involving the same constant "2" will interpret
56395bd8deadSopenharmony_ci      it as a floating-point value.
56405bd8deadSopenharmony_ci
56415bd8deadSopenharmony_ci      The only real problem is for a parameter declaration that is typeless.
56425bd8deadSopenharmony_ci      For typed variables, the intent is clear:
56435bd8deadSopenharmony_ci
56445bd8deadSopenharmony_ci        INT PARAM two = 2;               # use integer 2
56455bd8deadSopenharmony_ci        FLOAT PARAM twoPt0 = 2;          # use floating-point 2.0
56465bd8deadSopenharmony_ci
56475bd8deadSopenharmony_ci      For typeless variables, there's no context to go on:
56485bd8deadSopenharmony_ci
56495bd8deadSopenharmony_ci        PARAM two = 2;                   # 2?  2.0?
56505bd8deadSopenharmony_ci
56515bd8deadSopenharmony_ci      This extension is intended to be largely upward-compatible with
56525bd8deadSopenharmony_ci      ARB_vertex_program, ARB_fragment_program, and the other extensions built
56535bd8deadSopenharmony_ci      on top of them.  In all of these, the previous declaration is legal and
56545bd8deadSopenharmony_ci      means "2.0".  For compatibility, we choose to interpret integer
56555bd8deadSopenharmony_ci      constants in this case as floating-point values.  The assembler in the
56565bd8deadSopenharmony_ci      NVIDIA implementation will issue a warning if this case ever occurs.
56575bd8deadSopenharmony_ci
56585bd8deadSopenharmony_ci      This extension does not provide decoration of integer constant values --
56595bd8deadSopenharmony_ci      we considered adding suffixed integers such as "2U" to mean "2, and
56605bd8deadSopenharmony_ci      don't even think about converting me to a float!".  We expect that it
56615bd8deadSopenharmony_ci      will be sufficient to use the "INT" or "FLOAT" modifiers to disambiguate
56625bd8deadSopenharmony_ci      effectively.
56635bd8deadSopenharmony_ci
56645bd8deadSopenharmony_ci    (8) Should hexadecimal constants (e.g., 0x87A3 or 0xFFFFFFFF) be supported?
56655bd8deadSopenharmony_ci
56665bd8deadSopenharmony_ci      RESOLVED:  Yes.
56675bd8deadSopenharmony_ci
56685bd8deadSopenharmony_ci    (9) Should we provide data type modifiers with explicit component sizes?
56695bd8deadSopenharmony_ci    For example, "INT8", "FLOAT16", or "INT32".  If so, should we provide a
56705bd8deadSopenharmony_ci    mechanism to query the size (in bits) of a variable, or of different
56715bd8deadSopenharmony_ci    variable types/qualifiers?
56725bd8deadSopenharmony_ci
56735bd8deadSopenharmony_ci      RESOLVED:  No.
56745bd8deadSopenharmony_ci
56755bd8deadSopenharmony_ci    (10) Should this extension provide better support for array variables?
56765bd8deadSopenharmony_ci
56775bd8deadSopenharmony_ci      RESOLVED:  Yes; array variables of all types are allowed.
56785bd8deadSopenharmony_ci
56795bd8deadSopenharmony_ci      In ARB_vertex_program, program parameter (constant) variables could be
56805bd8deadSopenharmony_ci      addressed as arrays.  Temporary variables, vertex attributes, and vertex
56815bd8deadSopenharmony_ci      results could not be declared as arrays.
56825bd8deadSopenharmony_ci
56835bd8deadSopenharmony_ci      In NV_vertex_program3 and NV_fragment_program2, relative addressing was
56845bd8deadSopenharmony_ci      supported in program bindings:
56855bd8deadSopenharmony_ci
56865bd8deadSopenharmony_ci        MOV R0, vertex.attrib[A0.x];            # vertex
56875bd8deadSopenharmony_ci        MOV result.texcoord[A0.x], R0;          # vertex
56885bd8deadSopenharmony_ci        MOV R0, fragment.texcoord[A0.x];        # fragment -- inside LOOP
56895bd8deadSopenharmony_ci
56905bd8deadSopenharmony_ci      Explicitly declared attribute or result arrays were not supported, and
56915bd8deadSopenharmony_ci      temporaries could also not be arrays.
56925bd8deadSopenharmony_ci
56935bd8deadSopenharmony_ci      This extension allows users to declare attribute, result, and temporary
56945bd8deadSopenharmony_ci      arrays such as:
56955bd8deadSopenharmony_ci
56965bd8deadSopenharmony_ci        ATTRIB attribs[] = { vertex.attrib[7..11] };
56975bd8deadSopenharmony_ci        TEMP scratch[10];
56985bd8deadSopenharmony_ci        RESULT texcoords[] = { result.texcoord[0..3] };
56995bd8deadSopenharmony_ci
57005bd8deadSopenharmony_ci      Additionally, the relative addressing mechanisms provided by
57015bd8deadSopenharmony_ci      NV_vertex_program3 and NV_fragment_program2 are NOT supported in this
57025bd8deadSopenharmony_ci      extension -- instead, declared array variables are the only way to get
57035bd8deadSopenharmony_ci      relative addressing.  Using declared arrays allows the assembler to
57045bd8deadSopenharmony_ci      identify which attributes will actually be used.  An expression like
57055bd8deadSopenharmony_ci      "vertex.texcoord[A0.x]" doesn't identify which texture coordinates are
57065bd8deadSopenharmony_ci      referenced, and the assembler must be conservative in this case and
57075bd8deadSopenharmony_ci      assume that they all are.
57085bd8deadSopenharmony_ci
57095bd8deadSopenharmony_ci    (11) Is relative addressing of temporaries allowed?
57105bd8deadSopenharmony_ci
57115bd8deadSopenharmony_ci      RESOLVED:  Yes.  However, arrays of temporaries may end up being stored
57125bd8deadSopenharmony_ci      in off-chip memory, and may be slower to access than non-array
57135bd8deadSopenharmony_ci      temporaries.
57145bd8deadSopenharmony_ci
57155bd8deadSopenharmony_ci    (12) Should this extension add bindings to pass generic attributes between
57165bd8deadSopenharmony_ci    vertex, geometry, and fragment programs, or are texture coordinates
57175bd8deadSopenharmony_ci    sufficient?
57185bd8deadSopenharmony_ci
57195bd8deadSopenharmony_ci      RESOLVED:  While texture coordinates have been used in the past, generic
57205bd8deadSopenharmony_ci      attributes should be provided.  
57215bd8deadSopenharmony_ci
57225bd8deadSopenharmony_ci      The assembler provides a large set of bindings and automatically
57235bd8deadSopenharmony_ci      eliminates generic attributes or components that are unused.  At each
57245bd8deadSopenharmony_ci      interface between programs, there is an implementation-dependent limit
57255bd8deadSopenharmony_ci      on the number of attribute components that can be passed.
57265bd8deadSopenharmony_ci
57275bd8deadSopenharmony_ci      There are several reasons that this approach was chosen.  First, if the
57285bd8deadSopenharmony_ci      number of attributes that can be passed between program stages exceeds
57295bd8deadSopenharmony_ci      the number of existing texture coordinate sets supported when specifying
57305bd8deadSopenharmony_ci      vertex, a second implementation-dependent number of texture coordinates
57315bd8deadSopenharmony_ci      would need to be exposed to cover the number supported between stages.
57325bd8deadSopenharmony_ci      Second, the mechanisms described above reduce or eliminate the need to
57335bd8deadSopenharmony_ci      pack attributes into four component vectors.  Third, "texture
57345bd8deadSopenharmony_ci      coordinates" that have been historically used for texture lookups don't
57355bd8deadSopenharmony_ci      need to be used to pass values that aren't used this way.
57365bd8deadSopenharmony_ci
57375bd8deadSopenharmony_ci    (13) The structured branching support in NV_fragment_program2 provides a
57385bd8deadSopenharmony_ci    REP instruction that says to repeat a block of code <N> times, as well as
57395bd8deadSopenharmony_ci    a LOOP instruction that does the same, but also provides a special loop
57405bd8deadSopenharmony_ci    counter variable.  What sort of looping mechanism should we provide here?
57415bd8deadSopenharmony_ci
57425bd8deadSopenharmony_ci      RESOLVED:  Provide only the REP instruction.  The functionality provided
57435bd8deadSopenharmony_ci      by the LOOP instruction can be easily achieved by using an integer
57445bd8deadSopenharmony_ci      temporary as the loop index.  This avoids two annoyances of the old LOOP
57455bd8deadSopenharmony_ci      models:  (a) the loop index (A0.x) is a special variable name, while all
57465bd8deadSopenharmony_ci      other variables are declared normally and (b) instructions can only
57475bd8deadSopenharmony_ci      access the loop index of the innermost loop -- loop indices at higher
57485bd8deadSopenharmony_ci      nesting levels are not accessible.
57495bd8deadSopenharmony_ci
57505bd8deadSopenharmony_ci      One other option was a considered -- a "LOOPV" instruction (LOOP with a
57515bd8deadSopenharmony_ci      variable where the program specified a variable name and component to
57525bd8deadSopenharmony_ci      hold the loop index, instead of using the implicit variable name "A0.x".
57535bd8deadSopenharmony_ci      In the end, it was decided that using an integer temporary as a loop
57545bd8deadSopenharmony_ci      counter was sufficient.
57555bd8deadSopenharmony_ci
57565bd8deadSopenharmony_ci    (14) The structured branching support in NV_fragment_program2 provides a
57575bd8deadSopenharmony_ci    REP instruction that requires a loop count.  Some looping constructs may
57585bd8deadSopenharmony_ci    not have a definite loop count, such as a "while" statement in C.  Should
57595bd8deadSopenharmony_ci    this construct be supported, and if so, how?
57605bd8deadSopenharmony_ci
57615bd8deadSopenharmony_ci      RESOLVED:  The REP instruction is extended to make the loop count
57625bd8deadSopenharmony_ci      optional.  If no loop count is provided, the REP instruction specified a
57635bd8deadSopenharmony_ci      loop that can only be exited using the BRK (break) or RET instructions.
57645bd8deadSopenharmony_ci      To avoid obvious infinite loops, an error will be reported if a
57655bd8deadSopenharmony_ci      REP/ENDREP block contains no BRK instruction at the current nesting
57665bd8deadSopenharmony_ci      level and no RET instruction at any nesting level.
57675bd8deadSopenharmony_ci
57685bd8deadSopenharmony_ci      To implement a loop like "while (value < 7.0) ...", code such as the
57695bd8deadSopenharmony_ci      following can be used:
57705bd8deadSopenharmony_ci
57715bd8deadSopenharmony_ci        TEMP cc;                        # dummy variable
57725bd8deadSopenharmony_ci        REP;
57735bd8deadSopenharmony_ci          SLT.CC cc.x, value.x, 7.0;    # compare value.x to 7.0, set CC0
57745bd8deadSopenharmony_ci          BRK NE.x;                     # break out if not true
57755bd8deadSopenharmony_ci          ...
57765bd8deadSopenharmony_ci          ...                           # presumably update value!
57775bd8deadSopenharmony_ci          ...
57785bd8deadSopenharmony_ci        ENDREP;
57795bd8deadSopenharmony_ci
57805bd8deadSopenharmony_ci    (15) The structured branching support in NV_fragment_program2 provides a
57815bd8deadSopenharmony_ci    BRK instruction that operates like C's "break" statement.  Should we
57825bd8deadSopenharmony_ci    provide something similar to C's "continue" statement, which skips to the
57835bd8deadSopenharmony_ci    next iteration of the loop?
57845bd8deadSopenharmony_ci
57855bd8deadSopenharmony_ci      RESOLVED:  Yes, a new CONT opcode is provided for this purpose.
57865bd8deadSopenharmony_ci
57875bd8deadSopenharmony_ci    (16) Can the BRK or CONT instructions break out of multiple levels of
57885bd8deadSopenharmony_ci    nested loops at once?
57895bd8deadSopenharmony_ci
57905bd8deadSopenharmony_ci      RESOLVED:  No.  BRK and CONT only exit the current nesting level.  To
57915bd8deadSopenharmony_ci      break out of multiple levels of nested loops, multiple BRK/CONT
57925bd8deadSopenharmony_ci      instructions are required.
57935bd8deadSopenharmony_ci
57945bd8deadSopenharmony_ci    (17) For REP instructions, is the loop counter reloaded on each iteration
57955bd8deadSopenharmony_ci    of the loop?
57965bd8deadSopenharmony_ci
57975bd8deadSopenharmony_ci      RESOLVED:  No.  The loop counter is loaded once at the top of the loop,
57985bd8deadSopenharmony_ci      compared to zero at the top of the loop, and decremented when each loop
57995bd8deadSopenharmony_ci      iteration completes.  A program may overwrite the variable used to
58005bd8deadSopenharmony_ci      specify the initial value of the loop counter inside the loop without
58015bd8deadSopenharmony_ci      affecting the number of times the loop body is executed.
58025bd8deadSopenharmony_ci
58035bd8deadSopenharmony_ci    (18) How are floating-point values represented in this extension?  What
58045bd8deadSopenharmony_ci    about floating-point arithmetic operations?
58055bd8deadSopenharmony_ci
58065bd8deadSopenharmony_ci      RESOLVED:  In the initial hardware implementation of this extension,
58075bd8deadSopenharmony_ci      floating-point values are represented using the standard 32-bit IEEE
58085bd8deadSopenharmony_ci      single-precision encoding, consisting of a sign bit, 8 exponent bits,
58095bd8deadSopenharmony_ci      and 23 mantissa bits.  Special encodings for NaN (not a number), +/-INF
58105bd8deadSopenharmony_ci      (infinity), and positive and negative zero are supported.  Denorms
58115bd8deadSopenharmony_ci      (values less than 2^-126, which have an exponent encoding of "0" and no
58125bd8deadSopenharmony_ci      implied leading one) are supported, but may be flushed to zero,
58135bd8deadSopenharmony_ci      preserving the sign bit of the original value.  Arithmetic operations
58145bd8deadSopenharmony_ci      are carried out at single-precision using normal IEEE floating-point
58155bd8deadSopenharmony_ci      rules, including special rules for generating infinities, NaNs, and
58165bd8deadSopenharmony_ci      zeros of each sign.
58175bd8deadSopenharmony_ci
58185bd8deadSopenharmony_ci      Floating-point temporaries declared as "SHORT" may be, but are not
58195bd8deadSopenharmony_ci      necessarily, stored as 16-bit "fp16" values (sign bit, five exponent
58205bd8deadSopenharmony_ci      bits, ten mantissa bits), as specified in the NV_float_buffer and
58215bd8deadSopenharmony_ci      ARB_half_float_pixel extensions.
58225bd8deadSopenharmony_ci
58235bd8deadSopenharmony_ci    (19) Should we provide a method to declare how fragment attributes are
58245bd8deadSopenharmony_ci    interpolated?  It is possible to have flat-shaded attributes,
58255bd8deadSopenharmony_ci    perspective-corrected attributes, and centroid-sampled attributes.
58265bd8deadSopenharmony_ci
58275bd8deadSopenharmony_ci      RESOLVED:  Yes.  Fragment program attribute variable declarations may
58285bd8deadSopenharmony_ci      specify the "FLAT", "NOPERSPECTIVE", and "CENTROID" modifiers.  
58295bd8deadSopenharmony_ci
58305bd8deadSopenharmony_ci      These modifiers are documented in detail in the NV_fragment_program4
58315bd8deadSopenharmony_ci      specification.
58325bd8deadSopenharmony_ci      
58335bd8deadSopenharmony_ci    (20) Should vertex and primitive identifiers be supported?  If so, how?
58345bd8deadSopenharmony_ci
58355bd8deadSopenharmony_ci      RESOLVED:  A vertex identifier is available as "vertex.id" in a vertex
58365bd8deadSopenharmony_ci      program.  The vertex ID is equal to value effectively passed to
58375bd8deadSopenharmony_ci      ArrayElement when the vertex is specified, and is defined only if vertex
58385bd8deadSopenharmony_ci      arrays are used with buffer objects (VBOs).
58395bd8deadSopenharmony_ci
58405bd8deadSopenharmony_ci      A primitive identifier is available as "primitive.id" in a geometry or
58415bd8deadSopenharmony_ci      fragment program.  The primitive ID is equal to the number of primitives
58425bd8deadSopenharmony_ci      processed since the last implicit or explicit call to glBegin().
58435bd8deadSopenharmony_ci
58445bd8deadSopenharmony_ci      See the NV_vertex_program4 spec for more information on vertex IDs, and
58455bd8deadSopenharmony_ci      the NV_geometry_program4 or NV_fragment_program4 specs for more
58465bd8deadSopenharmony_ci      information on primitive IDs.
58475bd8deadSopenharmony_ci
58485bd8deadSopenharmony_ci    (21) For integer opcodes, should a bitwise inversion operator "~" be
58495bd8deadSopenharmony_ci    provided, analogous to existing negation operator?
58505bd8deadSopenharmony_ci
58515bd8deadSopenharmony_ci      RESOLVED:  No.  If this operator were provided, it might allow a program
58525bd8deadSopenharmony_ci      to evaluate the expression "a&(~b)" using a single instruction:
58535bd8deadSopenharmony_ci
58545bd8deadSopenharmony_ci        AND.U a, a, ~b;
58555bd8deadSopenharmony_ci
58565bd8deadSopenharmony_ci      Instead, it is necessary to instead do something like:
58575bd8deadSopenharmony_ci
58585bd8deadSopenharmony_ci        UINT TEMP t;
58595bd8deadSopenharmony_ci        NOT.U t, b;
58605bd8deadSopenharmony_ci        AND.U a, a, t;
58615bd8deadSopenharmony_ci
58625bd8deadSopenharmony_ci      If necessary, this functionality could be added in a subsequent
58635bd8deadSopenharmony_ci      extension.
58645bd8deadSopenharmony_ci
58655bd8deadSopenharmony_ci    (22) What happens if you negate or take the absolute value of the
58665bd8deadSopenharmony_ci    biggest-magnitude negative integer?
58675bd8deadSopenharmony_ci
58685bd8deadSopenharmony_ci      RESOLVED:  Signed integers are represented using two's complement
58695bd8deadSopenharmony_ci      representation.  For 32-bit integers, the largest possible value is
58705bd8deadSopenharmony_ci      2^31-1; the smallest possible value is -2^31.  There is no way to
58715bd8deadSopenharmony_ci      represent 2^31, which is what these operators "should" return.  The
58725bd8deadSopenharmony_ci      value returned in this case is the original value of -2^31.
58735bd8deadSopenharmony_ci
58745bd8deadSopenharmony_ci    (23) How do condition codes work?  How are they different from those
58755bd8deadSopenharmony_ci    provided in previous NVIDIA extensions?
58765bd8deadSopenharmony_ci
58775bd8deadSopenharmony_ci      RESOLVED:  There are two condition codes -- CC0 and CC1 -- each of which
58785bd8deadSopenharmony_ci      is a four-component vector.  The condition codes are set based on the
58795bd8deadSopenharmony_ci      result of an instruction that specifies a condition code update
58805bd8deadSopenharmony_ci      modifier.  Examples include:
58815bd8deadSopenharmony_ci
58825bd8deadSopenharmony_ci        ADD.S.CC  R0, R1, R2;       # add signed integers R1 and R2, update
58835bd8deadSopenharmony_ci                                    #   CC0 based on the result, write the 
58845bd8deadSopenharmony_ci                                    #   final value to R0
58855bd8deadSopenharmony_ci        ADD.F.CC1 R3, R4, R5;       # add floats R4 and R5, update CC1 based
58865bd8deadSopenharmony_ci                                    #   on the result, write the final value
58875bd8deadSopenharmony_ci                                    #   to R3
58885bd8deadSopenharmony_ci        ADD.U.CC0 R6.xy, R7, R8;    # add unsigned integers R7 and R8, update
58895bd8deadSopenharmony_ci                                    #   CC0 (x and y components) based on the
58905bd8deadSopenharmony_ci                                    #   result, write the final value to R6
58915bd8deadSopenharmony_ci                                    #   (x and y components)
58925bd8deadSopenharmony_ci
58935bd8deadSopenharmony_ci      Condition codes can be used for conditional writes, conditional
58945bd8deadSopenharmony_ci      branches, or other operations.  The condition codes aren't used
58955bd8deadSopenharmony_ci      directly, but are instead used with a condition code test such as "LT"
58965bd8deadSopenharmony_ci      (less than) or "EQ" (equal to).  Examples include:
58975bd8deadSopenharmony_ci
58985bd8deadSopenharmony_ci        MOV R0 (GT.x), R1;          # move R1 to R0 only if the x component of
58995bd8deadSopenharmony_ci                                    #   CC0 indicates a result of ">0"
59005bd8deadSopenharmony_ci        MOV R2 (NE1), R3;           # component-wise move of R3 to R2 if the
59015bd8deadSopenharmony_ci                                    #   corresponding component of CC1 
59025bd8deadSopenharmony_ci                                    #   indicates a result of "!=0"
59035bd8deadSopenharmony_ci        IF LE0.xyxy;                # execute the block of code if the x or
59045bd8deadSopenharmony_ci          ...                       #   y components of CC0 indicate a result
59055bd8deadSopenharmony_ci        ENDIF;                      #   of "<=0"
59065bd8deadSopenharmony_ci        REP;                        
59075bd8deadSopenharmony_ci          ...
59085bd8deadSopenharmony_ci          BRK EQ1.xyzx;             # break out of loop if the x, y, or z
59095bd8deadSopenharmony_ci        ENDREP;                     #   components of CC1 indicate a result of
59105bd8deadSopenharmony_ci                                    #   "==0".
59115bd8deadSopenharmony_ci
59125bd8deadSopenharmony_ci      Previous NVIDIA extensions provide eight tests, which are still
59135bd8deadSopenharmony_ci      supported here.  The tests "EQ" (equal), "GE" (greater/equal), "GT"
59145bd8deadSopenharmony_ci      (greater than), "LE" (less/equal), "LT" (less than), and "NE" (not
59155bd8deadSopenharmony_ci      equal) can be used to determine the relation of the result used to set
59165bd8deadSopenharmony_ci      the condition code with zero.  The tests "TR" (true) and "FL" (false),
59175bd8deadSopenharmony_ci      are special tests that always evaluate to true or false respectively.
59185bd8deadSopenharmony_ci
59195bd8deadSopenharmony_ci      For floating-point results, a NaN (not a number) encoding causes the
59205bd8deadSopenharmony_ci      "NE" condition to evaluate to TRUE and all other conditions to evaluate
59215bd8deadSopenharmony_ci      to FALSE.  IEEE encodings for "negative" and "positive" zero are both
59225bd8deadSopenharmony_ci      treated as equal to zero.
59235bd8deadSopenharmony_ci
59245bd8deadSopenharmony_ci      Condition codes are implemented as a set of flags, which are set
59255bd8deadSopenharmony_ci      depending on the type of operation, as described in the spec.  
59265bd8deadSopenharmony_ci
59275bd8deadSopenharmony_ci      For instructions that return floating-point or signed integer values,
59285bd8deadSopenharmony_ci      the normal condition code tests reliably indicate the relationship of
59295bd8deadSopenharmony_ci      the result to zero.  For instructions that return unsigned values, the
59305bd8deadSopenharmony_ci      condition codes are a bit more complicated.  For example, the sign flag
59315bd8deadSopenharmony_ci      is set if the most significant bit of the result written is set.  As a
59325bd8deadSopenharmony_ci      result, very large unsigned integer values (e.g., 0x80000000 -
59335bd8deadSopenharmony_ci      0xFFFFFFFF) are effectively treated as negative values.  Condition code
59345bd8deadSopenharmony_ci      tests should be used with care with unsigned results -- to test if an
59355bd8deadSopenharmony_ci      unsigned integer is ">0", use a sequence like:
59365bd8deadSopenharmony_ci
59375bd8deadSopenharmony_ci        MOV.U.CC R0, R1;            # move R1 to R0, set condition code
59385bd8deadSopenharmony_ci        IF NE;                      # test if the result is "!=0", a very 
59395bd8deadSopenharmony_ci          ...                       #   large value might fail "GT"!
59405bd8deadSopenharmony_ci        ENDIF;
59415bd8deadSopenharmony_ci
59425bd8deadSopenharmony_ci      This extension provides a number of additional condition code tests
59435bd8deadSopenharmony_ci      useful for different floating-point or integer operations:
59445bd8deadSopenharmony_ci
59455bd8deadSopenharmony_ci        * NAN (not a number) is true if a floating-point result is a NaN.  LEG
59465bd8deadSopenharmony_ci          (less, equal to, or greater) is the opposite of NAN.
59475bd8deadSopenharmony_ci
59485bd8deadSopenharmony_ci        * CF (carry flag) is true if an unsigned add overflows, or if an
59495bd8deadSopenharmony_ci          unsigned subtract produces a non-negative value.  NCF (no carry
59505bd8deadSopenharmony_ci          flag) is the opposite of CF.
59515bd8deadSopenharmony_ci
59525bd8deadSopenharmony_ci        * OF (overflow flag) is true if a signed add or subtract overflows.
59535bd8deadSopenharmony_ci          NOF (no overflow flag) is the opposite of OF.
59545bd8deadSopenharmony_ci
59555bd8deadSopenharmony_ci        * SF (sign flag) is true if the sign flag is set.  NSF (no sign flag)
59565bd8deadSopenharmony_ci          is the opposite of SF.
59575bd8deadSopenharmony_ci
59585bd8deadSopenharmony_ci        * AB (above) is true if an unsigned subtract produces a positive
59595bd8deadSopenharmony_ci          result.  BLE (below or equal) is the opposite of AB, and is true if
59605bd8deadSopenharmony_ci          an unsigned subtract produces a negative result or zero.  Note that
59615bd8deadSopenharmony_ci          CF can be used to test if the result is greater than or equal to
59625bd8deadSopenharmony_ci          zero, and NCF can be used to test if the result is less than zero.
59635bd8deadSopenharmony_ci
59645bd8deadSopenharmony_ci    (24) How do the "set on" instructions (SEQ, SGE, SGT, SLE, SLT, SNE) work
59655bd8deadSopenharmony_ci    with integer values and/or condition codes?
59665bd8deadSopenharmony_ci
59675bd8deadSopenharmony_ci      RESOLVED:  "Set on" instructions comparing signed and unsigned values
59685bd8deadSopenharmony_ci      return zero if the condition is false, and an integer with all bits set
59695bd8deadSopenharmony_ci      if the condition is true.  If the result is signed, it is interpreted as
59705bd8deadSopenharmony_ci      -1.  If the result is unsigned, it is interpreted the largest unsigned
59715bd8deadSopenharmony_ci      value (0xFFFFFFFF for 32-bit integers).  This is different from the
59725bd8deadSopenharmony_ci      floating-point "set on", which is defined to return 1.0.
59735bd8deadSopenharmony_ci
59745bd8deadSopenharmony_ci      This specific result encoding was chosen so that bitwise operators (NOT,
59755bd8deadSopenharmony_ci      AND, OR, XOR) can be used to evaluate boolean expressions.
59765bd8deadSopenharmony_ci
59775bd8deadSopenharmony_ci      When performing condition code tests on the results of an integer "set
59785bd8deadSopenharmony_ci      on" instruction, keep in mind that a TRUE result has the most
59795bd8deadSopenharmony_ci      significant bit set and will be interpreted as a negative value.  To
59805bd8deadSopenharmony_ci      test if a condition is true, use "NE" (!=0).  A condition code test of
59815bd8deadSopenharmony_ci      "GT" will always fail if the condition code was written by an integer
59825bd8deadSopenharmony_ci      "set on" instruction.
59835bd8deadSopenharmony_ci
59845bd8deadSopenharmony_ci    (25) What new texture functionality is provided?
59855bd8deadSopenharmony_ci
59865bd8deadSopenharmony_ci      RESOLVED:  Several new features are provided.
59875bd8deadSopenharmony_ci
59885bd8deadSopenharmony_ci      First, the TXF (texel fetch) instruction allows programs to access a
59895bd8deadSopenharmony_ci      texture map like a normal array.  Integer coordinates identifying an
59905bd8deadSopenharmony_ci      individual texel and LOD are provided, and the corresponding texture
59915bd8deadSopenharmony_ci      data is returned without filtering of any type.
59925bd8deadSopenharmony_ci
59935bd8deadSopenharmony_ci      Second, the TXQ (texture size query) instruction allows programs to
59945bd8deadSopenharmony_ci      query the size of a specified level of detail of a texture.  This
59955bd8deadSopenharmony_ci      feature allows programs to perform computations dependent on the size of
59965bd8deadSopenharmony_ci      the texture without having to pass the size as a program parameter or
59975bd8deadSopenharmony_ci      via some other mechanism.
59985bd8deadSopenharmony_ci
59995bd8deadSopenharmony_ci      Third, applications may specify a constant texel offset in a texture
60005bd8deadSopenharmony_ci      instruction that moves the texture sample point by the specified number
60015bd8deadSopenharmony_ci      of texels.  This offset can be used to perform custom texture filtering,
60025bd8deadSopenharmony_ci      and is also independent of the size of the texture LOD -- the same
60035bd8deadSopenharmony_ci      offsets are applied, regardless of the mipmap level.
60045bd8deadSopenharmony_ci
60055bd8deadSopenharmony_ci      Fourth, shadow mapping is supported for cube map textures.  The first
60065bd8deadSopenharmony_ci      three coordinates are the normal (s,t,r) coordinates for a cube map
60075bd8deadSopenharmony_ci      texture lookup, and the fourth component is a depth reference value that
60085bd8deadSopenharmony_ci      can be compared to the depth value stored in the texture.
60095bd8deadSopenharmony_ci
60105bd8deadSopenharmony_ci    (26) What "consistency" requirements are in effect for textures accessed
60115bd8deadSopenharmony_ci    via the TXF (texel fetch) instruction?
60125bd8deadSopenharmony_ci
60135bd8deadSopenharmony_ci      UNRESOLVED:  The texture must be usable for regular texture mapping
60145bd8deadSopenharmony_ci      operations -- if texture sizes or formats are inconsistent and a
60155bd8deadSopenharmony_ci      mipmapped min filter is used, the results are undefined.
60165bd8deadSopenharmony_ci
60175bd8deadSopenharmony_ci    (27) How does the TXF instruction work with bordered textures?
60185bd8deadSopenharmony_ci
60195bd8deadSopenharmony_ci      RESOLVED:  The entire image can be accessed, including the border
60205bd8deadSopenharmony_ci      texels.  For a 64x64 2D texture plus border (66x66 overall), the lower
60215bd8deadSopenharmony_ci      left border texel is accessed using the coordinates (-1,-1); the upper
60225bd8deadSopenharmony_ci      right border texel is accessed using the coordinates (64,64).
60235bd8deadSopenharmony_ci
60245bd8deadSopenharmony_ci    (28) What should TXQ (texture size query) return for "irrelevant" texture
60255bd8deadSopenharmony_ci    sizes (e.g., height of a 1D texture)?  Should it return any other
60265bd8deadSopenharmony_ci    information at the same time?
60275bd8deadSopenharmony_ci
60285bd8deadSopenharmony_ci      RESOLVED:  This specification leaves all "extra" components undefined.
60295bd8deadSopenharmony_ci
60305bd8deadSopenharmony_ci    (29) How do texture offsets interact with cubemap textures?
60315bd8deadSopenharmony_ci
60325bd8deadSopenharmony_ci      RESOLVED:  They are not supported in this extension.
60335bd8deadSopenharmony_ci
60345bd8deadSopenharmony_ci    (30) How do texture offsets interact with mipmapped textures?
60355bd8deadSopenharmony_ci
60365bd8deadSopenharmony_ci      RESOLVED:  The texture offsets are added after the (s,t,r) coordinates
60375bd8deadSopenharmony_ci      have been divided by q (if applicable) and converted to (u,v,w)
60385bd8deadSopenharmony_ci      coordinates by multiplying by the size of the selected texture level.
60395bd8deadSopenharmony_ci      The offsets are added to the (u,v,w) coordinates, and always move the
60405bd8deadSopenharmony_ci      sample point by an integral number of texel coordinates.  If multiple
60415bd8deadSopenharmony_ci      mipmaps are accessed, the sample point in each mipmap level is moved by
60425bd8deadSopenharmony_ci      an identical offset.  The applied offsets are independent of the
60435bd8deadSopenharmony_ci      selected mipmap level.
60445bd8deadSopenharmony_ci
60455bd8deadSopenharmony_ci    (31) How do shadow cube maps work?
60465bd8deadSopenharmony_ci
60475bd8deadSopenharmony_ci      UNRESOLVED:  An application can define a cube map texture with a
60485bd8deadSopenharmony_ci      DEPTH_COMPONENT internal format, and then render a scene using the cube
60495bd8deadSopenharmony_ci      map faces as the depth buffer(s).  When rendering the projection should
60505bd8deadSopenharmony_ci      be set up using the "center" of the cubemap as the eye, and using a
60515bd8deadSopenharmony_ci      normal projection matrix.  When applying the shadow map, the fragment
60525bd8deadSopenharmony_ci      program read the (x,y,z) eye coordinates, compute the length of the
60535bd8deadSopenharmony_ci      major axis (MAX(|x|,|y|,|z|) and then transform this coordinate to [0,1]
60545bd8deadSopenharmony_ci      space using the same parameters used to derive Z in the projection
60555bd8deadSopenharmony_ci      matrix.  A 4-component vector consisting of x, y, z, and this computed
60565bd8deadSopenharmony_ci      depth value should be passed to the texture lookup, and normal shadow
60575bd8deadSopenharmony_ci      mapping operations will be performed.
60585bd8deadSopenharmony_ci
60595bd8deadSopenharmony_ci      This issue should include the math needed to do this computation and
60605bd8deadSopenharmony_ci      sample code.
60615bd8deadSopenharmony_ci
60625bd8deadSopenharmony_ci    (32) Integer multiplies can overflow by a lot.  Should there be some way
60635bd8deadSopenharmony_ci    to return the high part of both unsigned and signed integer multiplies?
60645bd8deadSopenharmony_ci
60655bd8deadSopenharmony_ci      RESOLVED:  Yes.  The ".HI" multipler is provided to do a return the 32
60665bd8deadSopenharmony_ci      MSBs of a 32x32 integer multiply.  The instruction sequence:
60675bd8deadSopenharmony_ci
60685bd8deadSopenharmony_ci        INT TEMP R0, R1, R2, R3;
60695bd8deadSopenharmony_ci        MUL.S    R0, R2, R3;
60705bd8deadSopenharmony_ci        MUL.S.HI R1, R2, R3;
60715bd8deadSopenharmony_ci
60725bd8deadSopenharmony_ci     will do a 32x32 signed integer multiply of R2 and R3, with the 32 LSBs of
60735bd8deadSopenharmony_ci     the 64-bit result in R0 and the 32 MSBs in R1.
60745bd8deadSopenharmony_ci
60755bd8deadSopenharmony_ci    (33) Should there be any other special multiplication modifiers?
60765bd8deadSopenharmony_ci
60775bd8deadSopenharmony_ci      RESOLVED:  Yes.  The ".S24" and ".U24" modifiers allow for signed and
60785bd8deadSopenharmony_ci      unsigned integer multiplies where both operands are guaranteed to fit in
60795bd8deadSopenharmony_ci      the least significant 24 bits.  On some architectures supporting this
60805bd8deadSopenharmony_ci      extension, ".S24" and ".U24" integer multiplies may be faster than
60815bd8deadSopenharmony_ci      general-purpose ".S" and ".U" multiplies.  If either value doesn't fit
60825bd8deadSopenharmony_ci      in 24 bits, the results of the operation are undefined --
60835bd8deadSopenharmony_ci      implementations may, but are not required to, ignore the MSBs of the
60845bd8deadSopenharmony_ci      operands if ".S24" or ".U24" is specified.
60855bd8deadSopenharmony_ci
60865bd8deadSopenharmony_ci    (34) This extension provides subroutines, but doesn't provide a stack to
60875bd8deadSopenharmony_ci    push and pop parameters.  How do we deal with this?  NV_vertex_program3
60885bd8deadSopenharmony_ci    supported PUSHA/POPA instructions to push and pop address registers.
60895bd8deadSopenharmony_ci
60905bd8deadSopenharmony_ci      RESOLVED:  No explicit stack is required.  A program can implement a
60915bd8deadSopenharmony_ci      stack by allocating a temporary array plus a single integer temporary to
60925bd8deadSopenharmony_ci      use as the stack "pointer".  For example:
60935bd8deadSopenharmony_ci
60945bd8deadSopenharmony_ci        TEMP stack[256];                # 256 4-component vectors
60955bd8deadSopenharmony_ci        INT TEMP sp;                    # sp.x == stack pointer
60965bd8deadSopenharmony_ci        INT TEMP cc;                    # condition code results
60975bd8deadSopenharmony_ci        
60985bd8deadSopenharmony_ci        function:
60995bd8deadSopenharmony_ci          SGE.S.CC cc.x, sp.x, 256;     # compute stackPointer >= 256
61005bd8deadSopenharmony_ci          RET NE.x;                     # return if TRUE
61015bd8deadSopenharmony_ci          MOV stack[sp], R0;            # push R0 onto the stack
61025bd8deadSopenharmony_ci          ADD.S sp.x, sp.x, 1;
61035bd8deadSopenharmony_ci          ...
61045bd8deadSopenharmony_ci          SUB.S sp.x, sp.x, 1;          # pop R0 off the stack
61055bd8deadSopenharmony_ci          MOV R0, stack[sp];
61065bd8deadSopenharmony_ci          RET
61075bd8deadSopenharmony_ci
61085bd8deadSopenharmony_ci    (35) Should we provide new vector semantics for previously-defined opcodes
61095bd8deadSopenharmony_ci    (e.g., LG2 computes a component-wise logarithm)?
61105bd8deadSopenharmony_ci
61115bd8deadSopenharmony_ci      RESOLVED:  Not in this extension.  The instructions we define here are
61125bd8deadSopenharmony_ci      compatible with the vector or scalar nature of previously defined
61135bd8deadSopenharmony_ci      opcodes.  This simplifies the implementation of an assembler that needs
61145bd8deadSopenharmony_ci      to support both old and new instruction sets.
61155bd8deadSopenharmony_ci
61165bd8deadSopenharmony_ci    (36) Should it really be undefined to read from a register storing data of
61175bd8deadSopenharmony_ci    one type with an instruction of the other type (e.g., to read the bits of
61185bd8deadSopenharmony_ci    a floating-point number as an unsigned integer)?
61195bd8deadSopenharmony_ci
61205bd8deadSopenharmony_ci      RESOLVED:  The spec describes undefined results for simplicity.  In
61215bd8deadSopenharmony_ci      practice, mixing data types can be done, where signed integers are
61225bd8deadSopenharmony_ci      represented as two's complement integers and floating-point numbers are
61235bd8deadSopenharmony_ci      represented using IEEE single-precision representation.  For example:
61245bd8deadSopenharmony_ci
61255bd8deadSopenharmony_ci        TEMP R0, R1;                    # typeless
61265bd8deadSopenharmony_ci        MOV.U R0, 0x3F800000;           # R0 = 1.0
61275bd8deadSopenharmony_ci        MOV.U R1, 0xBF800000;           # R1 = -1.0
61285bd8deadSopenharmony_ci        MUL.F R0, R0, R1;               # R0 = -1 * 1 = -1 (0xBF800000)
61295bd8deadSopenharmony_ci        XOR.U R0, R0, R1;               # R0 = 0xBF800000 ^ 0xBF800000 = 0
61305bd8deadSopenharmony_ci        NOT.U R0, R0;                   # R0 = 0xFFFFFFFF
61315bd8deadSopenharmony_ci        I2F.S R0, R0;                   # R0 = -1.0 (0xFFFFFFFF = -1 signed)
61325bd8deadSopenharmony_ci        SEQ.F R0, R0, R1;               # R0 = 1.0 (-1.0 == -1.0)
61335bd8deadSopenharmony_ci
61345bd8deadSopenharmony_ci    (37) Buffer objects can be sourced as program parameters using the
61355bd8deadSopenharmony_ci    NV_parameter_buffer_object extension.  How are they accessed in a program?
61365bd8deadSopenharmony_ci
61375bd8deadSopenharmony_ci      RESOLVED:  The instruction set and existing program environment and
61385bd8deadSopenharmony_ci      local parameter bindings operate largely on four-component vectors.
61395bd8deadSopenharmony_ci      However, NV_parameter_buffer_object exposes the ability to reach into
61405bd8deadSopenharmony_ci      buffers consisting of user-generated data or data written to the buffer
61415bd8deadSopenharmony_ci      object by the GPU.  Such data sets may not consist entirely
61425bd8deadSopenharmony_ci      four-component floating-point vectors, so a four-component vector API
61435bd8deadSopenharmony_ci      may be unnatural.  An application might need to reformat its data set to
61445bd8deadSopenharmony_ci      deal with this issue.  Or it might generate odd code to compensate for
61455bd8deadSopenharmony_ci      mis-alignment -- for example, reading an array of 3-component vectors by
61465bd8deadSopenharmony_ci      doing two four-component vector accesses and then rotating based on
61475bd8deadSopenharmony_ci      alignment.  Neither approach is particularly satisfying.
61485bd8deadSopenharmony_ci
61495bd8deadSopenharmony_ci      Instead, this extension takes the approach of treating parameter buffers
61505bd8deadSopenharmony_ci      as array of scalar words.  When an individual buffer element is read,
61515bd8deadSopenharmony_ci      the single word is replicated to produce a four-component vector.  To
61525bd8deadSopenharmony_ci      access an array of 3-component vectors, code like the following can be
61535bd8deadSopenharmony_ci      used:
61545bd8deadSopenharmony_ci
61555bd8deadSopenharmony_ci        PARAM buffer[] = { program.buffer[0] };
61565bd8deadSopenharmony_ci        INT TEMP index;
61575bd8deadSopenharmony_ci        TEMP R0;
61585bd8deadSopenharmony_ci        ...
61595bd8deadSopenharmony_ci        MUL.S index, index, 3;          # to read "vec3" #X, compute 3*X
61605bd8deadSopenharmony_ci        MOV R0.x, buffer[index+0];
61615bd8deadSopenharmony_ci        MOV R0.y, buffer[index+1];
61625bd8deadSopenharmony_ci        MOV R0.z, buffer[index+2];
61635bd8deadSopenharmony_ci
61645bd8deadSopenharmony_ci    (38) Should recursion be allowed?  If so, how is the total amount of
61655bd8deadSopenharmony_ci    recursion limited?
61665bd8deadSopenharmony_ci
61675bd8deadSopenharmony_ci      RESOLVED:  Recursion is allowed, and a call stack is provided by the
61685bd8deadSopenharmony_ci      implementation.  The size of the call stack is limited to the
61695bd8deadSopenharmony_ci      implementation-dependent constant MAX_PROGRAM_CALL_DEPTH, and when a the
61705bd8deadSopenharmony_ci      call stack is full, the results of further CAL instructions is
61715bd8deadSopenharmony_ci      undefined.  In the initial implementation of this extension, such
61725bd8deadSopenharmony_ci      instructions will have no effect.  
61735bd8deadSopenharmony_ci
61745bd8deadSopenharmony_ci      Note that no stack is provided to hold local registers; a program may
61755bd8deadSopenharmony_ci      implement its own via a temporary array and integer stack "pointer".
61765bd8deadSopenharmony_ci
61775bd8deadSopenharmony_ci    (39) Variables are all four-component vectors in previous extensions.
61785bd8deadSopenharmony_ci    Should scalar or small-vector variables be provided?
61795bd8deadSopenharmony_ci
61805bd8deadSopenharmony_ci      RESOLVED:  It would be a useful feature, but it was left out for
61815bd8deadSopenharmony_ci      simplicity.  In practice, a variable where only the X component is used
61825bd8deadSopenharmony_ci      will be equivalent to a scalar.
61835bd8deadSopenharmony_ci
61845bd8deadSopenharmony_ci    (40) The PK* (pack) and UP* (unpack) instructions allow packing multiple
61855bd8deadSopenharmony_ci    components of data into a single component.  The bit packing is
61865bd8deadSopenharmony_ci    well-defined.  Should we require specific data types (e.g., unsigned
61875bd8deadSopenharmony_ci    integer) to hold packed values?
61885bd8deadSopenharmony_ci
61895bd8deadSopenharmony_ci      RESOLVED:  No.  Previous instruction sets only allowed programs to write
61905bd8deadSopenharmony_ci      packed values to a floating-point variable (the only data type
61915bd8deadSopenharmony_ci      provided).  We will allow packed results to be written to a variable of
61925bd8deadSopenharmony_ci      any data type.  Integer instructions can be used to manipulate bits of
61935bd8deadSopenharmony_ci      packed data in place.
61945bd8deadSopenharmony_ci
61955bd8deadSopenharmony_ci    (41) What happens when converting integers to floats or vice versa if
61965bd8deadSopenharmony_ci    there is insufficient precision or range to represent the result?
61975bd8deadSopenharmony_ci
61985bd8deadSopenharmony_ci      RESOLVED:  For integer-to-float conversions, the nearest representable
61995bd8deadSopenharmony_ci      floating-point value is used, and the least significant bits of the
62005bd8deadSopenharmony_ci      original integer value are lost.  For float-to-integer conversions,
62015bd8deadSopenharmony_ci      out-of-range values are clamped to the nearest representable integer.
62025bd8deadSopenharmony_ci
62035bd8deadSopenharmony_ci    (42) Why are some of the grammar rules so bizarre (e.g., attribUseD,
62045bd8deadSopenharmony_ci    attribUseV, attribUseS, attribUseVNS)?
62055bd8deadSopenharmony_ci
62065bd8deadSopenharmony_ci      RESOLVED:  This grammar is based upon the original ARB_vertex_program
62075bd8deadSopenharmony_ci      grammar, which has a number of "interesting" characteristics.  For
62085bd8deadSopenharmony_ci      example, some of the bindings provided by ARB_vertex_program naturally
62095bd8deadSopenharmony_ci      require some amount of lookahead.  For example, a vertex program can
62105bd8deadSopenharmony_ci      write an output color using any of the following:
62115bd8deadSopenharmony_ci
62125bd8deadSopenharmony_ci        MOV result.color, 0;            # primary color
62135bd8deadSopenharmony_ci        MOV result.color.primary, 0;    # primary color again
62145bd8deadSopenharmony_ci        MOV result.color.secondary, 0;  # secondary color this time
62155bd8deadSopenharmony_ci
62165bd8deadSopenharmony_ci      The pieces of the color binding are separated by "." tokens.  However,
62175bd8deadSopenharmony_ci      writemasks are also supported, which also use "." before the write
62185bd8deadSopenharmony_ci      mask.  So, we could also have something like:
62195bd8deadSopenharmony_ci
62205bd8deadSopenharmony_ci        MOV result.color.xyz, 0;        # primary color with W masked off
62215bd8deadSopenharmony_ci
62225bd8deadSopenharmony_ci      In this form, a parser needs to look at both the "." and the "xyz" to
62235bd8deadSopenharmony_ci      determine that the binding being used is "result.color" (and not
62245bd8deadSopenharmony_ci      "result.color.secondary").
62255bd8deadSopenharmony_ci
62265bd8deadSopenharmony_ci      Additionally, some checks that should probably be semantic errors (e.g.,
62275bd8deadSopenharmony_ci      allowing different swizzle or scalar operand selectors per instruction,
62285bd8deadSopenharmony_ci      or disallowing both in the case of SWZ) we specified in the original
62295bd8deadSopenharmony_ci      grammar.
62305bd8deadSopenharmony_ci
62315bd8deadSopenharmony_ci      ARB_fragment_program and subsequent NVIDIA instructions built upon this,
62325bd8deadSopenharmony_ci      and the grammar for this extension was rewritten in the current form so
62335bd8deadSopenharmony_ci      it could be validated more easily.
62345bd8deadSopenharmony_ci
62355bd8deadSopenharmony_ci    (43) This is an NV extension (NV_gpu_program4).  Why does the
62365bd8deadSopenharmony_ci     MAX_PROGRAM_TEXEL_OFFSET_EXT token has an "EXT" suffix?
62375bd8deadSopenharmony_ci
62385bd8deadSopenharmony_ci      RESOLVED:  This token is shared between this extension and the
62395bd8deadSopenharmony_ci      comparable high-level GLSL programmability extension (EXT_gpu_shader4).
62405bd8deadSopenharmony_ci      Rather than provide a duplicate set of token names, we simply use the
62415bd8deadSopenharmony_ci      EXT version here.
62425bd8deadSopenharmony_ci
62435bd8deadSopenharmony_ci    (44) For the purposes of determining the number of attribute and result
62445bd8deadSopenharmony_ci         components, how are "scalar" attributes counted.  For example, only
62455bd8deadSopenharmony_ci         the x component of the "pointsize" per-vertex output is actually
62465bd8deadSopenharmony_ci         relevant.
62475bd8deadSopenharmony_ci
62485bd8deadSopenharmony_ci      RESOLVED:  Implementations are allowed to count all inputs and outputs
62495bd8deadSopenharmony_ci      as full four-component vectors.  To avoid this, apply appropriate write
62505bd8deadSopenharmony_ci      masks or swizzles.
62515bd8deadSopenharmony_ci
62525bd8deadSopenharmony_ci      For example, writing to "result.pointsize" may count as four components.
62535bd8deadSopenharmony_ci      Consistently writing to "result.pointsize.x" may only count as one.
62545bd8deadSopenharmony_ci      Similarly, reading a fragment's fog coordinate as "fragment.fogcoord"
62555bd8deadSopenharmony_ci      may count as four components; "fragment.fogcoord.x" will only count as
62565bd8deadSopenharmony_ci      one.
62575bd8deadSopenharmony_ci
62585bd8deadSopenharmony_ciRevision History
62595bd8deadSopenharmony_ci
62605bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
62615bd8deadSopenharmony_ci    ----  --------  --------  --------------------------------------------
62625bd8deadSopenharmony_ci    11    09/11/14  pbrown    Fix cut-and-paste error in PK2US section.
62635bd8deadSopenharmony_ci
62645bd8deadSopenharmony_ci    10    12/14/09  mgodse    Added GLX protocol.
62655bd8deadSopenharmony_ci
62665bd8deadSopenharmony_ci     9    10/29/09  pbrown    Add language for previously undocumented errors
62675bd8deadSopenharmony_ci                              when using "SHORT" and "LONG" modifiers on
62685bd8deadSopenharmony_ci                              variable declarations.  They're allowed only on
62695bd8deadSopenharmony_ci                              "TEMP" statements, except that "SHORT" is 
62705bd8deadSopenharmony_ci                              allowed for "OUTPUT" as well.
62715bd8deadSopenharmony_ci
62725bd8deadSopenharmony_ci     8    08/11/08  jbreton   Clarified that when a MOD instruction is 
62735bd8deadSopenharmony_ci                              performed on negative operands the result is 
62745bd8deadSopenharmony_ci                              undefined.
62755bd8deadSopenharmony_ci                               
62765bd8deadSopenharmony_ci     7    07/29/08  pbrown    Discovered additional issues with texture wrap 
62775bd8deadSopenharmony_ci                              handling, replaced with logic that applies wrap
62785bd8deadSopenharmony_ci                              modes per sample.  Add a few instruction
62795bd8deadSopenharmony_ci                              pseudo-code lines explicitly identifying
62805bd8deadSopenharmony_ci                              undefined components.
62815bd8deadSopenharmony_ci
62825bd8deadSopenharmony_ci     6    05/02/08  pbrown    Fix the prototype for the internal TexelFetch()
62835bd8deadSopenharmony_ci                              function used in the spec language; texel
62845bd8deadSopenharmony_ci                              coordinates are signed integers.
62855bd8deadSopenharmony_ci                              
62865bd8deadSopenharmony_ci     5    02/22/08  pbrown    Clarified that when counting attribute/result
62875bd8deadSopenharmony_ci                              components, irrelevant/undefined components
62885bd8deadSopenharmony_ci                              can still count against the limits.
62895bd8deadSopenharmony_ci
62905bd8deadSopenharmony_ci     4    02/04/08  pbrown    Fix errors in texture wrap mode handling.
62915bd8deadSopenharmony_ci                              Added a missing clamp to avoid sampling border
62925bd8deadSopenharmony_ci                              in REPEAT mode.  Fixed incorrectly specified
62935bd8deadSopenharmony_ci                              weights for LINEAR filtering.
62945bd8deadSopenharmony_ci
62955bd8deadSopenharmony_ci     3    02/09/07  pbrown    Updated status section (now released).
62965bd8deadSopenharmony_ci
62975bd8deadSopenharmony_ci     2    10/19/06  pbrown    Change the token suffix for maximum texel offset
62985bd8deadSopenharmony_ci                              values from NV to EXT, since it is shared with
62995bd8deadSopenharmony_ci                              EXT_gpu_shader4.  Clarify what happens on a
63005bd8deadSopenharmony_ci                              negate of an unsigned value.  Fix typo in data
63015bd8deadSopenharmony_ci                              type modifier description.  Add missing
63025bd8deadSopenharmony_ci                              description of the "BUFFER4" declaration 
63035bd8deadSopenharmony_ci                              keyword.
63045bd8deadSopenharmony_ci
63055bd8deadSopenharmony_ci     1              pbrown    Internal spec development.
6306