15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ATI_fragment_shader
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ATI_fragment_shader
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Dan Ginsburg
125bd8deadSopenharmony_ci    Evan Hart
135bd8deadSopenharmony_ci    Jason Mitchell
145bd8deadSopenharmony_ci    
155bd8deadSopenharmony_ciContact
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    Benj Lipchak, AMD (benj.lipchak 'at' amd.com)
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciStatus
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Shipping (version 1.0)
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciVersion
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Last Modified Date: November 4, 2006
265bd8deadSopenharmony_ci    Author Revision: 1.8
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciNumber
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    245
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciDependencies
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    ARB_multitexture is required by this extension.
355bd8deadSopenharmony_ci    ARB_shadow interacts with this extension.
365bd8deadSopenharmony_ci    The extension is written against the OpenGL 1.2.1 Specification.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ciOverview
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    This extension exposes a powerful fragment shading model which
415bd8deadSopenharmony_ci    provides a very general means of expressing fragment color blending
425bd8deadSopenharmony_ci    and dependent texture address modification.  The programming is
435bd8deadSopenharmony_ci    a register-based model in which there is a fixed number of 
445bd8deadSopenharmony_ci    instructions, texture lookups, read/write registers, and constants.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    The fragment shader extension provides a unified instruction set
475bd8deadSopenharmony_ci    for operating on address or color data and eliminates the 
485bd8deadSopenharmony_ci    distinction between the two.  This extension provides all the 
495bd8deadSopenharmony_ci    interfaces necessary to fully expose this programmable fragment 
505bd8deadSopenharmony_ci    shader in GL.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    Although conceived as a device-independent extension which would 
535bd8deadSopenharmony_ci    expose the capabilities of future generations of hardware, changing 
545bd8deadSopenharmony_ci    trends in programmable hardware have affected the lifespan of this 
555bd8deadSopenharmony_ci    extension.  For this reason you will now find a fixed set of 
565bd8deadSopenharmony_ci    features and resources exposed, and the queries to determine this 
575bd8deadSopenharmony_ci    set have been deprecated.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ciIssues
605bd8deadSopenharmony_ci    
615bd8deadSopenharmony_ci    None
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciNew Procedures and Functions
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    uint GenFragmentShadersATI (uint range);
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci    void BindFragmentShaderATI (uint id);
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    void DeleteFragmentShaderATI (uint id);
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    void BeginFragmentShaderATI (void);
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    void EndFragmentShaderATI (void);
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    void PassTexCoordATI (uint dst, uint coord, enum swizzle);
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    void SampleMapATI (uint dst, uint interp, enum swizzle);
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    void ColorFragmentOp1ATI (enum op, uint dst, uint dstMask, 
815bd8deadSopenharmony_ci                              uint dstMod, uint arg1, uint arg1Rep, 
825bd8deadSopenharmony_ci                              uint arg1Mod);
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    void ColorFragmentOp2ATI (enum op, uint dst, uint dstMask, 
855bd8deadSopenharmony_ci                              uint dstMod, uint arg1, uint arg1Rep, 
865bd8deadSopenharmony_ci                              uint arg1Mod, uint arg2, uint arg2Rep, 
875bd8deadSopenharmony_ci                              uint arg2Mod);
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    void ColorFragmentOp3ATI (enum op, uint dst, uint dstMask, 
905bd8deadSopenharmony_ci                              uint dstMod, uint arg1, uint arg1Rep, 
915bd8deadSopenharmony_ci                              uint arg1Mod, uint arg2, uint arg2Rep, 
925bd8deadSopenharmony_ci                              uint arg2Mod, uint arg3, uint arg3Rep, 
935bd8deadSopenharmony_ci                              uint arg3Mod);
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    void AlphaFragmentOp1ATI (enum op, uint dst, uint dstMod, 
965bd8deadSopenharmony_ci                              uint arg1, uint arg1Rep, uint arg1Mod);
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    void AlphaFragmentOp2ATI (enum op, uint dst, uint dstMod, 
995bd8deadSopenharmony_ci                              uint arg1, uint arg1Rep, uint arg1Mod, 
1005bd8deadSopenharmony_ci                              uint arg2, uint arg2Rep, uint arg2Mod);
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    void AlphaFragmentOp3ATI (enum op, uint dst, uint dstMod, 
1035bd8deadSopenharmony_ci                              uint arg1, uint arg1Rep, uint arg1Mod,
1045bd8deadSopenharmony_ci                              uint arg2, uint arg2Rep, uint arg2Mod,
1055bd8deadSopenharmony_ci                              uint arg3, uint arg3Rep, uint arg3Mod);
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    void SetFragmentShaderConstantATI (uint dst, const float *value);
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ciNew Tokens
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
1135bd8deadSopenharmony_ci    and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
1145bd8deadSopenharmony_ci    and GetDoublev:
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci        FRAGMENT_SHADER_ATI                   0x8920
1175bd8deadSopenharmony_ci    
1185bd8deadSopenharmony_ci    Accepted by the <dst> and <argN> parameters of 
1195bd8deadSopenharmony_ci    ColorFragmentOp[1..3]ATI and AlphaFragmentOp[1..3]ATI, and by the 
1205bd8deadSopenharmony_ci    <dst> and <coord> parameters of PassTexCoordATI, and by the <dst> 
1215bd8deadSopenharmony_ci    and <interp> parameters of SampleMapATI:
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci        REG_0_ATI                             0x8921
1245bd8deadSopenharmony_ci        REG_1_ATI                             0x8922
1255bd8deadSopenharmony_ci        REG_2_ATI                             0x8923
1265bd8deadSopenharmony_ci        REG_3_ATI                             0x8924
1275bd8deadSopenharmony_ci        REG_4_ATI                             0x8925
1285bd8deadSopenharmony_ci        REG_5_ATI                             0x8926
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci    Accepted by the <dst> parameter of SetFragmentShaderConstantATI and 
1315bd8deadSopenharmony_ci    the <argN> parameter of ColorFragmentOp[1..3]ATI and 
1325bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI:
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci        CON_0_ATI                             0x8941
1355bd8deadSopenharmony_ci        CON_1_ATI                             0x8942
1365bd8deadSopenharmony_ci        CON_2_ATI                             0x8943
1375bd8deadSopenharmony_ci        CON_3_ATI                             0x8944
1385bd8deadSopenharmony_ci        CON_4_ATI                             0x8945
1395bd8deadSopenharmony_ci        CON_5_ATI                             0x8946
1405bd8deadSopenharmony_ci        CON_6_ATI                             0x8947
1415bd8deadSopenharmony_ci        CON_7_ATI                             0x8948
1425bd8deadSopenharmony_ci    
1435bd8deadSopenharmony_ci    Accepted by the <op> parameter of ColorFragmentOp1ATI and 
1445bd8deadSopenharmony_ci    AlphaFragmentOp1ATI:
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci        MOV_ATI                               0x8961
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    Accepted by the <op> parameter of ColorFragmentOp2ATI and 
1495bd8deadSopenharmony_ci    AlphaFragmentOp2ATI:
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci        ADD_ATI                               0x8963
1525bd8deadSopenharmony_ci        MUL_ATI                               0x8964
1535bd8deadSopenharmony_ci        SUB_ATI                               0x8965
1545bd8deadSopenharmony_ci        DOT3_ATI                              0x8966
1555bd8deadSopenharmony_ci        DOT4_ATI                              0x8967
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci    Accepted by the <op> parameter of ColorFragmentOp3ATI and 
1585bd8deadSopenharmony_ci    AlphaFragmentOp3ATI:
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci        MAD_ATI                               0x8968
1615bd8deadSopenharmony_ci        LERP_ATI                              0x8969
1625bd8deadSopenharmony_ci        CND_ATI                               0x896A
1635bd8deadSopenharmony_ci        CND0_ATI                              0x896B
1645bd8deadSopenharmony_ci        DOT2_ADD_ATI                          0x896C
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    Accepted by the <argN> parameter of ColorFragmentOp[1..3]ATI and 
1675bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI:
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci        ZERO
1705bd8deadSopenharmony_ci        ONE
1715bd8deadSopenharmony_ci        PRIMARY_COLOR_ARB
1725bd8deadSopenharmony_ci        SECONDARY_INTERPOLATOR_ATI            0x896D
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Accepted by the <interp> parameter of SampleMapATI and the <coord> 
1755bd8deadSopenharmony_ci    parameter of PassTexCoordATI:
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci        TEXTURE0_ARB
1785bd8deadSopenharmony_ci        TEXTURE1_ARB
1795bd8deadSopenharmony_ci        TEXTURE2_ARB
1805bd8deadSopenharmony_ci        TEXTURE3_ARB
1815bd8deadSopenharmony_ci        TEXTURE4_ARB
1825bd8deadSopenharmony_ci        TEXTURE5_ARB
1835bd8deadSopenharmony_ci        TEXTURE6_ARB
1845bd8deadSopenharmony_ci        TEXTURE7_ARB
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci    Accepted by the <swizzle> parameter of SampleMapATI and 
1875bd8deadSopenharmony_ci    PassTexCoordATI:
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci        SWIZZLE_STR_ATI                       0x8976
1905bd8deadSopenharmony_ci        SWIZZLE_STQ_ATI                       0x8977
1915bd8deadSopenharmony_ci        SWIZZLE_STR_DR_ATI                    0x8978
1925bd8deadSopenharmony_ci        SWIZZLE_STQ_DQ_ATI                    0x8979
1935bd8deadSopenharmony_ci    
1945bd8deadSopenharmony_ci    Accepted by the <dstMask> parameter of ColorFragmentOp[1..3]ATI:
1955bd8deadSopenharmony_ci    
1965bd8deadSopenharmony_ci        NONE
1975bd8deadSopenharmony_ci        RED_BIT_ATI                           0x00000001
1985bd8deadSopenharmony_ci        GREEN_BIT_ATI                         0x00000002
1995bd8deadSopenharmony_ci        BLUE_BIT_ATI                          0x00000004           
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    Accepted by the <argNRep> parameter of ColorFragmentOp[1..3]ATI and 
2025bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI:
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci        NONE
2055bd8deadSopenharmony_ci        RED
2065bd8deadSopenharmony_ci        GREEN
2075bd8deadSopenharmony_ci        BLUE
2085bd8deadSopenharmony_ci        ALPHA
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Accepted by the <dstMod> parameter of ColorFragmentOp[1..3]ATI and
2115bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI:
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci        NONE
2145bd8deadSopenharmony_ci        2X_BIT_ATI                            0x00000001
2155bd8deadSopenharmony_ci        4X_BIT_ATI                            0x00000002
2165bd8deadSopenharmony_ci        8X_BIT_ATI                            0x00000004
2175bd8deadSopenharmony_ci        HALF_BIT_ATI                          0x00000008
2185bd8deadSopenharmony_ci        QUARTER_BIT_ATI                       0x00000010
2195bd8deadSopenharmony_ci        EIGHTH_BIT_ATI                        0x00000020
2205bd8deadSopenharmony_ci        SATURATE_BIT_ATI                      0x00000040
2215bd8deadSopenharmony_ci    
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    Accepted by the <argNMod> parameter of ColorFragmentOp[1..3]ATI and 
2245bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI:
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci        2X_BIT_ATI                            0x00000001
2275bd8deadSopenharmony_ci        COMP_BIT_ATI                          0x00000002
2285bd8deadSopenharmony_ci        NEGATE_BIT_ATI                        0x00000004
2295bd8deadSopenharmony_ci        BIAS_BIT_ATI                          0x00000008    
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL 
2335bd8deadSopenharmony_ciOperation)
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    None
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    Add New Subsection after 3.8.10, (p. 138)
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    3.8.11  Fragment Shaders
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    By default, the current texture environment is used to determine
2455bd8deadSopenharmony_ci    how textures are combined for rasterization.  However, by enabling
2465bd8deadSopenharmony_ci    FRAGMENT_SHADER_ATI, the currently bound fragment shader is used to 
2475bd8deadSopenharmony_ci    determine how textures are combined.  The fragment shader replaces 
2485bd8deadSopenharmony_ci    the traditional texture environment by exposing a fragment shading 
2495bd8deadSopenharmony_ci    model which provides a very general means of expressing fragment 
2505bd8deadSopenharmony_ci    color blending and dependent texture address modification.  The 
2515bd8deadSopenharmony_ci    distinction between texture address and color data becomes 
2525bd8deadSopenharmony_ci    irrelevant in the fragment shader as the two can be used 
2535bd8deadSopenharmony_ci    interchangeably.
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci    A shader is defined between a BeginFragmentShaderATI and 
2565bd8deadSopenharmony_ci    EndFragmentShaderATI block.  These commands are defined as follows:
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci      void BeginFragmentShaderATI(void);
2595bd8deadSopenharmony_ci      void EndFragmentShaderATI(void);
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    Although there is no restriction as to which GL operations may be
2625bd8deadSopenharmony_ci    specified between BeginFragmentShaderATI and EndFragmentShaderATI,
2635bd8deadSopenharmony_ci    only the following operations will be compiled into a shader: 
2645bd8deadSopenharmony_ci    PassTexCoordATI, SampleMapATI, ColorFragmentOp[1..3]ATI, 
2655bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI, and SetFragmentShaderContantATI.
2665bd8deadSopenharmony_ci     
2675bd8deadSopenharmony_ci    In addition to a default fragment shader, named shaders can be 
2685bd8deadSopenharmony_ci    created.  The namespace for shaders is unsigned integers with zero 
2695bd8deadSopenharmony_ci    reserved by the GL.  A shader is created by binding an unused name 
2705bd8deadSopenharmony_ci    using:
2715bd8deadSopenharmony_ci      
2725bd8deadSopenharmony_ci      void BindFragmentShaderATI(uint id);
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    where <id> is the unused name.  Once a shader has been created it
2755bd8deadSopenharmony_ci    can be rebound as the active shader by calling 
2765bd8deadSopenharmony_ci    BindFragmentShaderATI.  A shader can be deleted, freeing the name, 
2775bd8deadSopenharmony_ci    by calling:
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci      void DeleteFragmentShaderATI(uint id);
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    where <id> is the name to be deleted.  Unique names can be generated
2825bd8deadSopenharmony_ci    using:
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ci      uint GenFragmentShadersATI(uint range);
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    where <range> is the number of contiguous ids that should be 
2875bd8deadSopenharmony_ci    created.  It returns an integer n such that <range> contiguous empty 
2885bd8deadSopenharmony_ci    shader ids, with values n, n+1, ..., n+<range>-1, are created.  If 
2895bd8deadSopenharmony_ci    <range> is 0, if there is no group of <range> contiguous names
2905bd8deadSopenharmony_ci    available, or if any error is generated, no shaders are generated,
2915bd8deadSopenharmony_ci    and 0 is returned.
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    If FRAGMENT_SHADER_ATI is enabled, but the currently bound shader is
2945bd8deadSopenharmony_ci    invalid, the results of drawing commands are undefined.  A shader 
2955bd8deadSopenharmony_ci    may be invalid because it is currently being specified (i.e., a 
2965bd8deadSopenharmony_ci    drawing command within a Begin/EndFragmentShader pair), or due to 
2975bd8deadSopenharmony_ci    some error during the specification of a shader.
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    There are three types of data that can be in a fragment shader:
3005bd8deadSopenharmony_ci    registers, constants, and interpolators.  The 6 REG_x_ATI registers 
3015bd8deadSopenharmony_ci    can be used as source or destination in any color or alpha 
3025bd8deadSopenharmony_ci    instruction.  The final result of the shader is whatever value is in 
3035bd8deadSopenharmony_ci    REG_0_ATI.  This value will be the final color of the output 
3045bd8deadSopenharmony_ci    fragment passed.
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci    There are 8 constant registers available, CON_0_ATI through 
3075bd8deadSopenharmony_ci    CON_7_ATI.  CON_x_ATI constants can be used as source in any color 
3085bd8deadSopenharmony_ci    or alpha instruction, but at most 2 different constants may be used 
3095bd8deadSopenharmony_ci    as source arguments in each instruction.
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    Additionally, the primary and secondary color interpolators are 
3125bd8deadSopenharmony_ci    available as source in any color or alpha instruction, but only in 
3135bd8deadSopenharmony_ci    the last pass of the shader (i.e., the only pass of a one-pass 
3145bd8deadSopenharmony_ci    shader or the second pass of a two-pass shader).
3155bd8deadSopenharmony_ci
3165bd8deadSopenharmony_ci    Either one or two passes may be specified in a shader.  Each pass 
3175bd8deadSopenharmony_ci    may use up to 8 pairs of instructions for a total of at most 16 
3185bd8deadSopenharmony_ci    pairs in the shader.  A pair consists of one color instruction and 
3195bd8deadSopenharmony_ci    one alpha instruction.
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci    The first instructions specified in each pass of a shader are "free" 
3225bd8deadSopenharmony_ci    instructions in that they don't count against the 8 instructions 
3235bd8deadSopenharmony_ci    available in each pass.  They are routing instructions which specify 
3245bd8deadSopenharmony_ci    from where the contents of the registers come.  The first occurance 
3255bd8deadSopenharmony_ci    of one of these free instructions marks the beginning of a pass in 
3265bd8deadSopenharmony_ci    the shader.  They are specified with SampleMapATI and 
3275bd8deadSopenharmony_ci    PassTexCoordATI.
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    The entry point:
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci      void PassTexCoordATI (uint dst, uint coord, enum swizzle);
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci    specifies that the value present in <coord> is passed directly into 
3345bd8deadSopenharmony_ci    the contents of <dst> (one of the registers REG_x_ATI).  This value 
3355bd8deadSopenharmony_ci    is then available for use as a source argument to subsequent color 
3365bd8deadSopenharmony_ci    and alpha instructions following in the same pass.  <coord> may 
3375bd8deadSopenharmony_ci    either be the texture coordinates on a texture unit (TEXTUREx_ARB), 
3385bd8deadSopenharmony_ci    or in the case of a two-pass shader's second pass, it may be the 
3395bd8deadSopenharmony_ci    value of a register set in the first pass (REG_x_ATI).
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci    Note that in order to preserve the contents of a register from the 
3425bd8deadSopenharmony_ci    first pass to the second, there must be a PassTexCoordATI 
3435bd8deadSopenharmony_ci    instruction in the setup for the second pass that assigns that 
3445bd8deadSopenharmony_ci    register to itself.  For example: 
3455bd8deadSopenharmony_ci
3465bd8deadSopenharmony_ci      PassTexCoordATI(REG_1_ATI, REG_1_ATI, SWIZZLE_STR_ATI); 
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci    will preserve the first 3 components of REG_1_ATI for use in the 
3495bd8deadSopenharmony_ci    second pass.
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci    The entry point:
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci      void SampleMapATI (uint dst, uint interp, enum swizzle);
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    specifies that the value present in the texture data bound on the 
3565bd8deadSopenharmony_ci    unit associated with <dst> will be written to that register.  A 
3575bd8deadSopenharmony_ci    value for <dst> of REG_x_ATI means that TEXTUREx_ARB will be 
3585bd8deadSopenharmony_ci    sampled, and the result written to REG_x_ATI.  The <interp> 
3595bd8deadSopenharmony_ci    parameter specifies which texture coordinate interpolator is used to 
3605bd8deadSopenharmony_ci    sample the map.  A value of REG_x_ATI for <interp> in the second 
3615bd8deadSopenharmony_ci    pass of a two-pass shader will do dependent texture read sampling 
3625bd8deadSopenharmony_ci    using the value in register x.  Otherwise, specifying TEXTUREx_ARB 
3635bd8deadSopenharmony_ci    will sample the map using the texture coordinates on unit x.
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    Only the first 3 components of <coord> or <interp> are used in 
3665bd8deadSopenharmony_ci    PassTexCoordATI and SampleMapATI, respectively.  The swizzle 
3675bd8deadSopenharmony_ci    parameter is used to select which of the 4 original components of 
3685bd8deadSopenharmony_ci    the source register or texture coordinates will be mapped to the 3 
3695bd8deadSopenharmony_ci    available positions, and whether or not a projection will occur.  
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    Table 3.20 shows the <swizzle> modes:
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci                           Coordinates Used for 1D or      Coordinates Used for
3755bd8deadSopenharmony_ci      Swizzle              2D SampleMap and PassTexCoord   3D or cubemap SampleMap
3765bd8deadSopenharmony_ci      -------              -----------------------------   -----------------------
3775bd8deadSopenharmony_ci      SWIZZLE_STR_ATI      (s, t, r, undefined)            (s, t, r, undefined)
3785bd8deadSopenharmony_ci      SWIZZLE_STQ_ATI      (s, t, q, undefined)            (s, t, q, undefined)
3795bd8deadSopenharmony_ci      SWIZZLE_STR_DR_ATI   (s/r, t/r, 1/r, undefined)      (undefined)
3805bd8deadSopenharmony_ci      SWIZZLE_STQ_DQ_ATI   (s/q, t/q, 1/q, undefined)      (undefined)
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci         Table 3.20 Coordinate swizzles
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    Each texture coordinate source (TEXTUREx_ARB) used as a <coord> 
3865bd8deadSopenharmony_ci    and/or <interp> can only draw upon STR or STQ components throughout 
3875bd8deadSopenharmony_ci    the shader.  For example, if TEXTURE2_ARB is used in a SampleMapATI 
3885bd8deadSopenharmony_ci    with <swizzle> SWIZZLE_STR_ATI, it cannot be used again later with a 
3895bd8deadSopenharmony_ci    <swizzle> of SWIZZLE_STQ_ATI.  The projection, however, may vary.  
3905bd8deadSopenharmony_ci    It would be okay to later use TEXTURE2_ARB with a <swizzle> of 
3915bd8deadSopenharmony_ci    SWIZZLE_STR_DR_ATI.
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    Additionally, when the <coord> or <interp> is a register (in the 
3945bd8deadSopenharmony_ci    second pass of a two-pass shader), only SWIZZLE_STR_ATI and 
3955bd8deadSopenharmony_ci    SWIZZLE_STR_DR_ATI are allowed.  Note that if this is a 
3965bd8deadSopenharmony_ci    PassTexCoord, the fourth component (alpha channel if the register 
3975bd8deadSopenharmony_ci    contains RGBA) is not passed along and the fourth component of <dst> 
3985bd8deadSopenharmony_ci    becomes undefined.
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci    The color and alpha instructions performed in the shader are 
4015bd8deadSopenharmony_ci    specified with the following entry points:
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci      void ColorFragmentOp1ATI (enum op, uint dst, uint dstMask, uint dstMod, 
4045bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod);
4055bd8deadSopenharmony_ci      void ColorFragmentOp2ATI (enum op, uint dst, uint dstMask, uint dstMod, 
4065bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod,
4075bd8deadSopenharmony_ci                                uint arg2, uint arg2Rep, uint arg2Mod);
4085bd8deadSopenharmony_ci      void ColorFragmentOp3ATI (enum op, uint dst, uint dstMask, uint dstMod,
4095bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod,
4105bd8deadSopenharmony_ci                                uint arg2, uint arg2Rep, uint arg2Mod,
4115bd8deadSopenharmony_ci                                uint arg3, uint arg3Rep, uint arg3Mod);
4125bd8deadSopenharmony_ci      void AlphaFragmentOp1ATI (enum op, uint dst, uint dstMod, 
4135bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod);
4145bd8deadSopenharmony_ci      void AlphaFragmentOp2ATI (enum op, uint dst, uint dstMod, 
4155bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod, 
4165bd8deadSopenharmony_ci                                uint arg2, uint arg2Rep, uint arg2Mod);
4175bd8deadSopenharmony_ci      void AlphaFragmentOp3ATI (enum op, uint dst, uint dstMod, 
4185bd8deadSopenharmony_ci                                uint arg1, uint arg1Rep, uint arg1Mod,
4195bd8deadSopenharmony_ci                                uint arg2, uint arg2Rep, uint arg2Mod,
4205bd8deadSopenharmony_ci                                uint arg3, uint arg3Rep, uint arg3Mod);
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    A ColorFragmentOp[1..3]ATI followed by an AlphaFragmentOp[1..3]ATI 
4235bd8deadSopenharmony_ci    is considered to be an instruction pair, and 8 such pairs may be
4245bd8deadSopenharmony_ci    specified per pass.  The color and alpha instructions of a pair are 
4255bd8deadSopenharmony_ci    executed in parallel: the result of the color instruction cannot 
4265bd8deadSopenharmony_ci    affect the source arguments of the alpha instruction.  Both a color 
4275bd8deadSopenharmony_ci    and an alpha instruction need not be specified for every pair; the
4285bd8deadSopenharmony_ci    necessary color or alpha no-op is automatically inserted by the GL
4295bd8deadSopenharmony_ci    to complete each instruction pair.
4305bd8deadSopenharmony_ci
4315bd8deadSopenharmony_ci    The <op> parameter specifies the instruction to perform on the 
4325bd8deadSopenharmony_ci    sources.   
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    Table 3.21 shows the effect of each <op>.  R(d), G(d), and B(d) are 
4355bd8deadSopenharmony_ci    the destination values when using the instruction on color and A(d) 
4365bd8deadSopenharmony_ci    is the destination value when using the instruction on alpha.
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci      Op                    Result
4405bd8deadSopenharmony_ci      --                    ------
4415bd8deadSopenharmony_ci      ADD_ATI               R(d) = R(a1) + R(a2)
4425bd8deadSopenharmony_ci                            G(d) = G(a1) + G(a2)
4435bd8deadSopenharmony_ci                            B(d) = B(a1) + B(a2)
4445bd8deadSopenharmony_ci                            A(d) = A(a1) + A(a2)
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ci      SUB_ATI               R(d) = R(a1) - R(a2)
4475bd8deadSopenharmony_ci                            G(d) = G(a1) - G(a2)
4485bd8deadSopenharmony_ci                            B(d) = B(a1) - B(a2)
4495bd8deadSopenharmony_ci                            A(d) = A(a1) - A(a2)
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci      MUL_ATI               R(d) = R(a1) * R(a2)
4525bd8deadSopenharmony_ci                            G(d) = G(a1) * G(a2)
4535bd8deadSopenharmony_ci                            B(d) = B(a1) * B(a2)
4545bd8deadSopenharmony_ci                            A(d) = A(a1) * A(a2)
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci      MAD_ATI               R(d) = R(a1) * R(a2) + R(a3)
4575bd8deadSopenharmony_ci                            G(d) = G(a1) * G(a2) + G(a3)
4585bd8deadSopenharmony_ci                            B(d) = B(a1) * B(a2) + B(a3)
4595bd8deadSopenharmony_ci                            A(d) = A(a1) * A(a2) + A(a3)
4605bd8deadSopenharmony_ci
4615bd8deadSopenharmony_ci      LERP_ATI***           R(d) = R(a1) * R(a2) + (1 - R(a1)) * R(a3)
4625bd8deadSopenharmony_ci                            G(d) = G(a1) * G(a2) + (1 - G(a1)) * G(a3)
4635bd8deadSopenharmony_ci                            B(d) = B(a1) * B(a2) + (1 - B(a1)) * B(a3)
4645bd8deadSopenharmony_ci                            A(d) = A(a1) * A(a2) + (1 - A(a1)) * A(a3)
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci      MOV_ATI               R(d) = R(a1)
4675bd8deadSopenharmony_ci                            G(d) = G(a1)
4685bd8deadSopenharmony_ci                            B(d) = B(a1)
4695bd8deadSopenharmony_ci                            A(d) = A(a1)
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ci      CND_ATI               R(d) = (R(a3) > 0.5) ? R(a1) : R(a2)
4725bd8deadSopenharmony_ci                            G(d) = (G(a3) > 0.5) ? G(a1) : G(a2)
4735bd8deadSopenharmony_ci                            B(d) = (B(a3) > 0.5) ? B(a1) : B(a2)
4745bd8deadSopenharmony_ci                            A(d) = (A(a3) > 0.5) ? A(a1) : A(a2)
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci      CND0_ATI              R(d) = (R(a3) >= 0) ? R(a1) : R(a2)
4775bd8deadSopenharmony_ci                            G(d) = (G(a3) >= 0) ? G(a1) : G(a2)
4785bd8deadSopenharmony_ci                            B(d) = (B(a3) >= 0) ? B(a1) : B(a2)
4795bd8deadSopenharmony_ci                            A(d) = (A(a3) >= 0) ? A(a1) : A(a2)
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ci      DOT2_ADD_ATI*         R(d) = G(d) = B(d) = A(d) = R(a1) * R(a2) + 
4825bd8deadSopenharmony_ci                                                        G(a1) * G(a2) + 
4835bd8deadSopenharmony_ci                                                        B(a3)                  
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci      DOT3_ATI*             R(d) = G(d) = B(d) = A(d) = R(a1) * R(a2) +
4865bd8deadSopenharmony_ci                                                        G(a1) * G(a2) +
4875bd8deadSopenharmony_ci                                                        B(a1) * B(a2)
4885bd8deadSopenharmony_ci
4895bd8deadSopenharmony_ci      DOT4_ATI* **          R(d) = G(d) = B(d) = A(d) = R(a1) * R(a2) +
4905bd8deadSopenharmony_ci                                                        G(a1) * G(a2) +
4915bd8deadSopenharmony_ci                                                        B(a1) * B(a2) +
4925bd8deadSopenharmony_ci                                                        A(a1) * A(a2)
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci         Table 3.21 Color and Alpha Fragment Shader Instructions
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci         Special Notes:
4975bd8deadSopenharmony_ci           *   - DOT2_ADD_ATI/DOT3_ATI/DOT4_ATI can only be specified as
4985bd8deadSopenharmony_ci                 an alpha instruction directly after being specified as
4995bd8deadSopenharmony_ci                 a color instruction.  When specified as an alpha 
5005bd8deadSopenharmony_ci                 instruction, the parameters are ignored, although they 
5015bd8deadSopenharmony_ci                 should be valid enumerants in order to compile.  The 
5025bd8deadSopenharmony_ci                 result of the color instruction will simply be placed
5035bd8deadSopenharmony_ci                 in the alpha <dst>.
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci           **  - After a DOT4_ATI color instruction is specified, the
5065bd8deadSopenharmony_ci                 only alpha instruction that can immediately follow is a 
5075bd8deadSopenharmony_ci                 DOT4_ATI.  This is because the DOT4 color instruction 
5085bd8deadSopenharmony_ci                 implicitely uses an alpha instruction to calculate the 
5095bd8deadSopenharmony_ci                 result.  If another type of alpha instruction is 
5105bd8deadSopenharmony_ci                 desired after a DOT4_ATI color instruction is issued, 
5115bd8deadSopenharmony_ci                 there are two choices: either issue another color 
5125bd8deadSopenharmony_ci                 instruction first, or issue the DOT4_ATI alpha 
5135bd8deadSopenharmony_ci                 instruction followed by the desired alpha instruction.
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci           *** - The blend factor (a1) of LERP_ATI must be in the range
5165bd8deadSopenharmony_ci                 [0,1] or the results are undefined.
5175bd8deadSopenharmony_ci
5185bd8deadSopenharmony_ci    The <dst> parameter specifies to which register (REG_x_ATI) the 
5195bd8deadSopenharmony_ci    result of the instruction is written.
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci    The <dstMask> parameter specifies which of the color components in 
5225bd8deadSopenharmony_ci    <dst> will be written (ColorFragmentOp[1..3]ATI only).  This can 
5235bd8deadSopenharmony_ci    either be NONE, in which case there is no mask and everything is 
5245bd8deadSopenharmony_ci    written, or the bitwise-or of RED_BIT_ATI, GREEN_BIT_ATI, and 
5255bd8deadSopenharmony_ci    BLUE_BIT_ATI.
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ci    The <dstMod> parameter specifies which modifications are performed
5285bd8deadSopenharmony_ci    on each component of the destination.  The result can be modulated
5295bd8deadSopenharmony_ci    by specifying either 2X_BIT_ATI, 4X_BIT_ATI, 8X_BIT_ATI, 
5305bd8deadSopenharmony_ci    HALF_BIT_ATI, QUARTER_BIT_ATI, or EIGHTH_BIT_ATI.  These are all 
5315bd8deadSopenharmony_ci    mutually exclusive, and can optionally be bitwise-or'd with 
5325bd8deadSopenharmony_ci    SATURATE_BIT_ATI, which clamps the result after any modulation 
5335bd8deadSopenharmony_ci    occurs.  
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    Table 3.22 shows the result of each <dstMod> modification.
5365bd8deadSopenharmony_ci
5375bd8deadSopenharmony_ci
5385bd8deadSopenharmony_ci      Modifier                Result
5395bd8deadSopenharmony_ci      --------                ------
5405bd8deadSopenharmony_ci      NONE                    d = d
5415bd8deadSopenharmony_ci      2X_BIT_ATI              d = 2 * d
5425bd8deadSopenharmony_ci      4X_BIT_ATI              d = 4 * d
5435bd8deadSopenharmony_ci      8X_BIT_ATI              d = 8 * d
5445bd8deadSopenharmony_ci      HALF_BIT_ATI            d = d / 2
5455bd8deadSopenharmony_ci      QUARTER_BIT_ATI         d = d / 4
5465bd8deadSopenharmony_ci      EIGHTH_BIT_ATI          d = d / 8
5475bd8deadSopenharmony_ci      SATURATE_BIT_ATI        d = clamp(d) to range [0, 1]
5485bd8deadSopenharmony_ci         
5495bd8deadSopenharmony_ci         Table 3.22 Result of destination modification     
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci    Note that the internal precision of the fragment shader allows 
5535bd8deadSopenharmony_ci    values in the range [-8, 8].  
5545bd8deadSopenharmony_ci     
5555bd8deadSopenharmony_ci    The <argN> parameter specifies the source argument.  The source can 
5565bd8deadSopenharmony_ci    come from REG_x_ATI, CON_x_ATI, ZERO, ONE, PRIMARY_COLOR_ARB, or 
5575bd8deadSopenharmony_ci    SECONDARY_INTERPOLATOR_ATI.  Note that in a two-pass shader, 
5585bd8deadSopenharmony_ci    PRIMARY_COLOR_ARB and SECONDARY_INTERPOLATOR_ATI cannot be used in 
5595bd8deadSopenharmony_ci    the first pass of the shader.
5605bd8deadSopenharmony_ci
5615bd8deadSopenharmony_ci    Each argument has an <argNRep> parameter which specifies the 
5625bd8deadSopenharmony_ci    replication of each component.  
5635bd8deadSopenharmony_ci
5645bd8deadSopenharmony_ci    Table 3.23 shows the result of each <argNRep> source replication.
5655bd8deadSopenharmony_ci
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci      Replication             Result
5685bd8deadSopenharmony_ci      -----------             -----                 
5695bd8deadSopenharmony_ci      NONE                    R(s) = R(s)
5705bd8deadSopenharmony_ci                              G(s) = G(s)
5715bd8deadSopenharmony_ci                              B(s) = B(s)
5725bd8deadSopenharmony_ci                              A(s) = A(s)
5735bd8deadSopenharmony_ci
5745bd8deadSopenharmony_ci      RED                     R(s) = R(s)
5755bd8deadSopenharmony_ci                              G(s) = R(s)
5765bd8deadSopenharmony_ci                              B(s) = R(s)
5775bd8deadSopenharmony_ci                              A(s) = R(s)
5785bd8deadSopenharmony_ci
5795bd8deadSopenharmony_ci      GREEN                   R(s) = G(s)
5805bd8deadSopenharmony_ci                              G(s) = G(s)
5815bd8deadSopenharmony_ci                              B(s) = G(s)
5825bd8deadSopenharmony_ci                              A(s) = G(s)
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci      BLUE                    R(s) = B(s)
5855bd8deadSopenharmony_ci                              G(s) = B(s)
5865bd8deadSopenharmony_ci                              B(s) = B(s)
5875bd8deadSopenharmony_ci                              A(s) = B(s)
5885bd8deadSopenharmony_ci
5895bd8deadSopenharmony_ci      ALPHA                   R(s) = A(s)
5905bd8deadSopenharmony_ci                              G(s) = A(s)
5915bd8deadSopenharmony_ci                              B(s) = A(s)
5925bd8deadSopenharmony_ci                              A(s) = A(s)
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci         Table 3.23 Result of source replication
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ci    Each argument also has an <argNMod> parameter which specifies 
5985bd8deadSopenharmony_ci    modifiers to each component.  A value of NONE specifies that no 
5995bd8deadSopenharmony_ci    modifiers are present.  Otherwise, the bitwise-or of NEGATE_BIT_ATI, 
6005bd8deadSopenharmony_ci    BIAS_BIT_ATI, and 2X_BIT_ATI can be specified as modifiers.  
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci    Table 3.24 shows the result of each <argNMod> source modifier.
6035bd8deadSopenharmony_ci
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci      Modifier                Result
6065bd8deadSopenharmony_ci      --------                ------
6075bd8deadSopenharmony_ci      NONE                    s = s
6085bd8deadSopenharmony_ci      NEGATE_BIT_ATI          s = -s
6095bd8deadSopenharmony_ci      COMP_BIT_ATI            s = 1 - s
6105bd8deadSopenharmony_ci      BIAS_BIT_ATI            s = s - 0.5
6115bd8deadSopenharmony_ci      2X_BIT_ATI              s = 2 * s
6125bd8deadSopenharmony_ci           
6135bd8deadSopenharmony_ci         Table 3.24 Result of source modification
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci    If multiple source modifiers are applied, the order of operations is
6175bd8deadSopenharmony_ci    COMP, BIAS, SCALE, then NEGATE.  The following equation shows the 
6185bd8deadSopenharmony_ci    order of operations if all modifiers were to be applied:
6195bd8deadSopenharmony_ci	  
6205bd8deadSopenharmony_ci         s = -(2 * ((1.0 - s) - 0.5))
6215bd8deadSopenharmony_ci     
6225bd8deadSopenharmony_ci    In order to set the constants that can be used by shader 
6235bd8deadSopenharmony_ci    instructions, the entry point:
6245bd8deadSopenharmony_ci
6255bd8deadSopenharmony_ci      void SetFragmentShaderConstantATI (uint dst, const float *value);
6265bd8deadSopenharmony_ci
6275bd8deadSopenharmony_ci    is used.  The <dst> parameter specifies which of the constants 
6285bd8deadSopenharmony_ci    (CON_x_ATI) to set.  The <value> pointer must contain four floating 
6295bd8deadSopenharmony_ci    point values in the range [0, 1] to set the components of the 
6305bd8deadSopenharmony_ci    constant.  Constant registers loaded with floating point values 
6315bd8deadSopenharmony_ci    outside of this range will have undefined values.  Calls to this 
6325bd8deadSopenharmony_ci    function which occur inside a shader definition are automatically 
6335bd8deadSopenharmony_ci    bound when the shader is bound.  This means that shader constants 
6345bd8deadSopenharmony_ci    have scope: if SetFragmentShaderConstantATI is called outside a 
6355bd8deadSopenharmony_ci    shader definition, it is bound globally.  However, if that same 
6365bd8deadSopenharmony_ci    shader constant is set inside the shader, it overrides the global 
6375bd8deadSopenharmony_ci    definition when bound.
6385bd8deadSopenharmony_ci
6395bd8deadSopenharmony_ci
6405bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
6415bd8deadSopenharmony_ciOperations and the Framebuffer)
6425bd8deadSopenharmony_ci
6435bd8deadSopenharmony_ci    None
6445bd8deadSopenharmony_ci
6455bd8deadSopenharmony_ci
6465bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special 
6475bd8deadSopenharmony_ciFunctions)
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ci    Modify Section 5.4, Display Lists (p. 175)
6505bd8deadSopenharmony_ci
6515bd8deadSopenharmony_ci    (modify last paragraph, p. 178) ... These are: IsList, GenLists,
6525bd8deadSopenharmony_ci    ..., GenFragmentShadersATI, DeleteFragmentShadersATI, 
6535bd8deadSopenharmony_ci    BeginFragmentShaderATI, EndFragmentShaderATI, PassTexCoordATI,
6545bd8deadSopenharmony_ci    SampleMapATI, ColorFragmentOp[1..3]ATI, AlphaFragmentOp[1..3]ATI, 
6555bd8deadSopenharmony_ci    as well as IsEnabled and all of the Get commands (see Chapter 6).
6565bd8deadSopenharmony_ci
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
6595bd8deadSopenharmony_ciState Requests)
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    None
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci
6645bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
6655bd8deadSopenharmony_ci
6665bd8deadSopenharmony_ci    None
6675bd8deadSopenharmony_ci
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
6705bd8deadSopenharmony_ci
6715bd8deadSopenharmony_ci    None
6725bd8deadSopenharmony_ci
6735bd8deadSopenharmony_ci
6745bd8deadSopenharmony_ciInteractions with ARB_shadow
6755bd8deadSopenharmony_ci
6765bd8deadSopenharmony_ci    The texture comparison introduced by ARB_shadow can be expressed in 
6775bd8deadSopenharmony_ci    terms of a fragment shader, and in fact use the same internal 
6785bd8deadSopenharmony_ci    resources on some implementations.  Therefore, if fragment shader 
6795bd8deadSopenharmony_ci    mode is enabled, the GL behaves as if TEXTURE_COMPARE_MODE_ARB is 
6805bd8deadSopenharmony_ci    NONE.
6815bd8deadSopenharmony_ci
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ciErrors
6845bd8deadSopenharmony_ci  
6855bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if GenFragmentShadersATI is
6865bd8deadSopenharmony_ci    called where <range> is zero.
6875bd8deadSopenharmony_ci
6885bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if GenFragmentShadersATI, 
6895bd8deadSopenharmony_ci    BindFragmentShaderATI, DeleteFragmentShaderATI, or 
6905bd8deadSopenharmony_ci    BeginFragmentShaderATI are specified inside a 
6915bd8deadSopenharmony_ci    Begin/EndFragmentShaderATI pair.
6925bd8deadSopenharmony_ci
6935bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if EndFragmentShaderATI, 
6945bd8deadSopenharmony_ci    PassTexCoordATI, SampleMapATI, ColorFragmentOp[1..3]ATI, or 
6955bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI is specified outside a 
6965bd8deadSopenharmony_ci    Begin/EndFragmentShaderATI pair.
6975bd8deadSopenharmony_ci   
6985bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by EndFragmentShaderATI if 
6995bd8deadSopenharmony_ci    <argN> passed to ColorFragmentOp[1..3]ATI or 
7005bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI is PRIMARY_COLOR_ARB or 
7015bd8deadSopenharmony_ci    SECONDARY_INTERPOLATOR_ATI on the first pass of a two-pass shader, 
7025bd8deadSopenharmony_ci    or if the shader cannot be compiled due to some other 
7035bd8deadSopenharmony_ci    implementation-dependent limitation.  EndFragmentShaderATI will 
7045bd8deadSopenharmony_ci    still have a side-effect if this error is encountered: the 
7055bd8deadSopenharmony_ci    Begin/EndFragmentShaderATI pair will be closed, and the current 
7065bd8deadSopenharmony_ci    shader will be undefined.
7075bd8deadSopenharmony_ci
7085bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by PassTexCoordATI or 
7095bd8deadSopenharmony_ci    SampleMapATI if two shader passes have already been specified, or if 
7105bd8deadSopenharmony_ci    the same <dst> register is specified twice in the same pass.
7115bd8deadSopenharmony_ci
7125bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by PassTexCoordATI or 
7135bd8deadSopenharmony_ci    SampleMapATI if <coord> passed to PassTexCoordATI or <interp> passed 
7145bd8deadSopenharmony_ci    to SampleMapATI is a register in the first pass, or a register with 
7155bd8deadSopenharmony_ci    SWIZZLE_STQ_ATI or SWIZZLE_STQ_DQ_ATI <swizzle> in the second pass, 
7165bd8deadSopenharmony_ci    or if different <swizzle> parameters are specified for the same 
7175bd8deadSopenharmony_ci    <coord> or <interp> in the same pass.
7185bd8deadSopenharmony_ci
7195bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by ColorFragmentOp[1..3]ATI 
7205bd8deadSopenharmony_ci    or AlphaFragmentOp[1..3]ATI if more than 8 instructions have been 
7215bd8deadSopenharmony_ci    specified for a shader pass.
7225bd8deadSopenharmony_ci
7235bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by ColorFragmentOp[1..3]ATI 
7245bd8deadSopenharmony_ci    if <argN> is SECONDARY_INTERPOLATOR_ATI and <argNRep> is ALPHA, or 
7255bd8deadSopenharmony_ci    by AlphaFragmentOp[1..3]ATI if <argN> is SECONDARY_INTERPOLATOR_ATI
7265bd8deadSopenharmony_ci    and <argNRep> is ALPHA or NONE, or by ColorFragmentOp2ATI if <op> is
7275bd8deadSopenharmony_ci    DOT4_ATI and <argN> is SECONDARY_INTERPOLATOR_ATI and <argNRep> is
7285bd8deadSopenharmony_ci    ALPHA or NONE.
7295bd8deadSopenharmony_ci
7305bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by ColorFragmentOp3ATI or 
7315bd8deadSopenharmony_ci    AlphaFragmentOp3ATI if all three <argN> parameters are constants, 
7325bd8deadSopenharmony_ci    and all three are different.
7335bd8deadSopenharmony_ci
7345bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by AlphaFragmentOp[2..3]ATI 
7355bd8deadSopenharmony_ci    if <op> is DOT3_ATI, DOT4_ATI, or DOT2_ADD_ATI and there was no 
7365bd8deadSopenharmony_ci    matching ColorFragmentOp[2..3]ATI immediately preceding, or if <op> 
7375bd8deadSopenharmony_ci    is not DOT4_ATI and the immediately preceding ColorFragmentOp2ATI 
7385bd8deadSopenharmony_ci    specifies an <op> of DOT4_ATI.
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if <dst> passed to 
7415bd8deadSopenharmony_ci    PassTexCoordATI, SampleMapATI, ColorFragmentOp[1..3]ATI, or 
7425bd8deadSopenharmony_ci    AlphaFragmentOp[1..3]ATI is not a valid register or is greater than 
7435bd8deadSopenharmony_ci    the number of texture units available on the implementation.
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if <coord> passed to 
7465bd8deadSopenharmony_ci    PassTexCoordATI or <interp> passed to SampleMapATI is not a valid 
7475bd8deadSopenharmony_ci    register or texture unit, or the register or texture unit is greater 
7485bd8deadSopenharmony_ci    than the number of texture units available on the implementation.
7495bd8deadSopenharmony_ci
7505bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if <argN> passed to 
7515bd8deadSopenharmony_ci    ColorFragmentOp[1..3]ATI or AlphaFragmentOp[1..3]ATI is not a valid 
7525bd8deadSopenharmony_ci    constant, interpolator, or register.
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if <dstMod> passed to 
7555bd8deadSopenharmony_ci    ColorFragmentOp[1..3]ATI or AlphaFragmentOp[1..3]ATI contains 
7565bd8deadSopenharmony_ci    multiple mutually exclusive modifier bits, not counting 
7575bd8deadSopenharmony_ci    SATURATE_BIT_ATI.
7585bd8deadSopenharmony_ci
7595bd8deadSopenharmony_ci
7605bd8deadSopenharmony_ciNew State
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci                                            Initial
7635bd8deadSopenharmony_ci    Get Value            Type  Get Command  Value    Description             Sec.    Attribute
7645bd8deadSopenharmony_ci    ---------            ----  -----------  -------  -----------             ------  ---------
7655bd8deadSopenharmony_ci    FRAGMENT_SHADER_ATI   B    IsEnabled    False    Fragment shader enable  3.8.11  enable
7665bd8deadSopenharmony_ci
7675bd8deadSopenharmony_ci    Table X.6.  New Accessible State Introduced by ATI_fragment_shader.
7685bd8deadSopenharmony_ci
7695bd8deadSopenharmony_ci
7705bd8deadSopenharmony_ci    Get Value    Type    Get Command   Initial Value  Description          Sec     Attribute
7715bd8deadSopenharmony_ci    ---------    ------  -----------   -------------  -------------------  ------  ---------
7725bd8deadSopenharmony_ci    -            6xR4    -             undefined      temporary registers  3.8.11  -
7735bd8deadSopenharmony_ci
7745bd8deadSopenharmony_ci    Table X.9.  Fragment Shader Per-fragment Execution State.  All per-fragment
7755bd8deadSopenharmony_ci    execution state registers are uninitialized at the beginning of program
7765bd8deadSopenharmony_ci    execution.
7775bd8deadSopenharmony_ci
7785bd8deadSopenharmony_ci
7795bd8deadSopenharmony_ciNew Implementation Dependent State
7805bd8deadSopenharmony_ci
7815bd8deadSopenharmony_ci    None
7825bd8deadSopenharmony_ci
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ciDeprecated Functionality
7855bd8deadSopenharmony_ci
7865bd8deadSopenharmony_ci    The following queryable implementation-dependent constants are 
7875bd8deadSopenharmony_ci    described here for backward-compatibility.  They are now specified 
7885bd8deadSopenharmony_ci    to always return fixed values on all implementations, and are thus 
7895bd8deadSopenharmony_ci    obsolete.
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci    The number of available registers can be queried by doing a glGet on 
7925bd8deadSopenharmony_ci    NUM_FRAGMENT_REGISTERS_ATI.  This refers to the number of 
7935bd8deadSopenharmony_ci    REG_x_ATI's, and is now fixed at 6.
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci    The number of available constants can be queried by doing a glGet on 
7965bd8deadSopenharmony_ci    NUM_FRAGMENT_CONSTANTS.  This refers to the number of CON_x_ATI's, 
7975bd8deadSopenharmony_ci    and is now fixed at 8.
7985bd8deadSopenharmony_ci
7995bd8deadSopenharmony_ci    The number of passes, instructions per pass, and total instructions
8005bd8deadSopenharmony_ci    available to a shader can be queried using glGet.  Querying for 
8015bd8deadSopenharmony_ci    NUM_PASSES_ATI returns the maximum number of passes that the shader 
8025bd8deadSopenharmony_ci    can perform, now fixed at 2.  Querying for 
8035bd8deadSopenharmony_ci    NUM_INSTRUCTIONS_PER_PASS_ATI returns the maximum number of 
8045bd8deadSopenharmony_ci    instructions available on a given pass, now fixed at 8.  Finally, 
8055bd8deadSopenharmony_ci    NUM_INSTRUCTIONS_TOTAL_ATI returns the maximum number of total 
8065bd8deadSopenharmony_ci    instructions available to a shader, now fixed at 16 (2 per pass).  
8075bd8deadSopenharmony_ci
8085bd8deadSopenharmony_ci    COLOR_ALPHA_PAIRING_ATI can be queried by glGet to determine if each
8095bd8deadSopenharmony_ci    ColorFragmentOp[1..3]ATI/AlphaFragmentOp[1..3]ATI pair counts as one 
8105bd8deadSopenharmony_ci    instruction against the limit, or if each color and alpha 
8115bd8deadSopenharmony_ci    instruction is counted individually (i.e., each pair counts as two 
8125bd8deadSopenharmony_ci    instructions).  This query now always returns TRUE: each pair counts 
8135bd8deadSopenharmony_ci    as one instruction against the 8 instructions allowed per pass.
8145bd8deadSopenharmony_ci
8155bd8deadSopenharmony_ci    The number of components available in a coordinate interpolator, 
8165bd8deadSopenharmony_ci    passed in as <interp> to SampleMapATI or <coord> to PassTexCoord, 
8175bd8deadSopenharmony_ci    can be queried using NUM_INTERPOLATOR_COMPONENTS_ATI.  This query 
8185bd8deadSopenharmony_ci    now always returns 3, meaning the fourth component is ignored.
8195bd8deadSopenharmony_ci
8205bd8deadSopenharmony_ci    The number of components passed in the registers via PassTexCoord 
8215bd8deadSopenharmony_ci    from the first pass to the second can be queried using 
8225bd8deadSopenharmony_ci    NUM_LOOPBACK_COMPONENTS_ATI.  This query now always returns 3, 
8235bd8deadSopenharmony_ci    meaning the fourth component of <dst> is undefined.
8245bd8deadSopenharmony_ci
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ciSample Usage
8275bd8deadSopenharmony_ci
8285bd8deadSopenharmony_ci    The following is an example that simulates a chrome surface:
8295bd8deadSopenharmony_ci
8305bd8deadSopenharmony_ci      shadername = glGenFragmentShadersATI(1);
8315bd8deadSopenharmony_ci      glBindFragmentShaderATI(shadername);
8325bd8deadSopenharmony_ci      glBeginFragmentShaderATI();
8335bd8deadSopenharmony_ci
8345bd8deadSopenharmony_ci      // Pass 1
8355bd8deadSopenharmony_ci      glPassTexCoordATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI); // N
8365bd8deadSopenharmony_ci      glPassTexCoordATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI); // light to vertex vector in light space
8375bd8deadSopenharmony_ci      glPassTexCoordATI(GL_REG_3_ATI, GL_TEXTURE3_ARB, GL_SWIZZLE_STR_ATI); // H
8385bd8deadSopenharmony_ci      glSampleMapATI(GL_REG_4_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI);    // L (sample cubemap normalizer)
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci      // reg4 = N.L
8415bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_DOT3_ATI, GL_REG_4_ATI, GL_NONE, GL_NONE,
8425bd8deadSopenharmony_ci                            GL_REG_1_ATI, GL_NONE, GL_NONE,
8435bd8deadSopenharmony_ci                            GL_REG_4_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI);
8445bd8deadSopenharmony_ci
8455bd8deadSopenharmony_ci      // reg1 = N.H
8465bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_DOT3_ATI, GL_REG_1_ATI, GL_NONE, GL_NONE,
8475bd8deadSopenharmony_ci                            GL_REG_1_ATI, GL_NONE, GL_NONE,
8485bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE);
8495bd8deadSopenharmony_ci
8505bd8deadSopenharmony_ci      // reg1(green) = H.H (aka |H|^2)
8515bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_DOT3_ATI, GL_REG_1_ATI, GL_GREEN_BIT_ATI, GL_NONE,
8525bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE,
8535bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE);
8545bd8deadSopenharmony_ci
8555bd8deadSopenharmony_ci      // reg2 = |light to vertex|^2
8565bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_DOT3_ATI, GL_REG_2_ATI, GL_NONE, GL_NONE,
8575bd8deadSopenharmony_ci                            GL_REG_2_ATI, GL_NONE, GL_NONE,
8585bd8deadSopenharmony_ci                            GL_REG_2_ATI, GL_NONE, GL_NONE);
8595bd8deadSopenharmony_ci
8605bd8deadSopenharmony_ci      // Pass 2
8615bd8deadSopenharmony_ci      glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE5_ARB, GL_SWIZZLE_STR_ATI); // sample enviroment map using eye vector
8625bd8deadSopenharmony_ci      glSampleMapATI(GL_REG_2_ATI, GL_REG_2_ATI, GL_SWIZZLE_STR_ATI);    // sample attenuation map
8635bd8deadSopenharmony_ci      glSampleMapATI(GL_REG_3_ATI, GL_REG_1_ATI, GL_SWIZZLE_STR_ATI);    // sample specular NHHH map = (N.H)^256
8645bd8deadSopenharmony_ci      glPassTexCoordATI(GL_REG_4_ATI, GL_REG_4_ATI, GL_SWIZZLE_STR_ATI); // pass N.L through
8655bd8deadSopenharmony_ci
8665bd8deadSopenharmony_ci      // reg3 = (N.H)^256 * (N.L) 
8675bd8deadSopenharmony_ci      // this ensures a pixel is only lit if facing the light (since the specular exponent
8685bd8deadSopenharmony_ci      // makes negative N.H positive we must do this)
8695bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_3_ATI, GL_NONE, GL_NONE,
8705bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE,
8715bd8deadSopenharmony_ci                            GL_REG_4_ATI, GL_NONE, GL_NONE);
8725bd8deadSopenharmony_ci
8735bd8deadSopenharmony_ci      // reg3 = specular * environment map
8745bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_3_ATI, GL_NONE, GL_NONE,
8755bd8deadSopenharmony_ci                            GL_REG_0_ATI, GL_NONE, GL_NONE,
8765bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE);
8775bd8deadSopenharmony_ci
8785bd8deadSopenharmony_ci      // reg4 = diffuse * environment map
8795bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_4_ATI, GL_NONE, GL_NONE,
8805bd8deadSopenharmony_ci                            GL_REG_0_ATI, GL_NONE, GL_NONE,
8815bd8deadSopenharmony_ci                            GL_REG_4_ATI, GL_NONE, GL_NONE);
8825bd8deadSopenharmony_ci
8835bd8deadSopenharmony_ci      // reg0 = (specular * environment map) + (diffuse * environment map)
8845bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
8855bd8deadSopenharmony_ci                            GL_REG_3_ATI, GL_NONE, GL_NONE,
8865bd8deadSopenharmony_ci                            GL_REG_4_ATI, GL_NONE, GL_NONE);
8875bd8deadSopenharmony_ci
8885bd8deadSopenharmony_ci      // apply point light attenuation
8895bd8deadSopenharmony_ci      glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
8905bd8deadSopenharmony_ci                            GL_REG_0_ATI, GL_NONE, GL_NONE,
8915bd8deadSopenharmony_ci                            GL_REG_2_ATI, GL_RED, GL_NONE);
8925bd8deadSopenharmony_ci      glEndFragmentShaderATI();
8935bd8deadSopenharmony_ci
8945bd8deadSopenharmony_ci
8955bd8deadSopenharmony_ciRevision History
8965bd8deadSopenharmony_ci
8975bd8deadSopenharmony_ci    Date: 11/4/2006
8985bd8deadSopenharmony_ci    Revision: 1.8
8995bd8deadSopenharmony_ci      - Updated contact info after ATI/AMD merger.
9005bd8deadSopenharmony_ci
9015bd8deadSopenharmony_ci    Date: 8/21/2002
9025bd8deadSopenharmony_ci    Revision: 1.7
9035bd8deadSopenharmony_ci      - Fixed lack of comma typo in glAlphaFragmentOp2ATI prototypes.
9045bd8deadSopenharmony_ci
9055bd8deadSopenharmony_ci    Date: 8/1/2002
9065bd8deadSopenharmony_ci    Revision: 1.6
9075bd8deadSopenharmony_ci      - Changed DeleteFragmentShaderATI behavior to silently ignore the 
9085bd8deadSopenharmony_ci        deletion of non-existent or default shaders.
9095bd8deadSopenharmony_ci
9105bd8deadSopenharmony_ci    Date: 6/5/2002
9115bd8deadSopenharmony_ci    Revision: 1.5
9125bd8deadSopenharmony_ci      - Added interaction with ARB_shadow.
9135bd8deadSopenharmony_ci
9145bd8deadSopenharmony_ci    Date: 5/30/2002
9155bd8deadSopenharmony_ci    Revision: 1.4
9165bd8deadSopenharmony_ci      - Specified that LERP's blend factor must be in the range [0,1].
9175bd8deadSopenharmony_ci      - Added error condition when trying to use secondary color in DOT4
9185bd8deadSopenharmony_ci        color instruction when replication is GL_NONE or GL_ALPHA.
9195bd8deadSopenharmony_ci
9205bd8deadSopenharmony_ci    Date: 5/21/2002
9215bd8deadSopenharmony_ci    Revision: 1.3
9225bd8deadSopenharmony_ci      - Made number of registers (REG_x_ATI) explicit: 6.
9235bd8deadSopenharmony_ci      - Changed CND0_ATI definition from >0 to >=0.
9245bd8deadSopenharmony_ci      - Added wording to emphasize [0,1] range for constants.
9255bd8deadSopenharmony_ci      - Added wording to reflect that EndFragmentShaderATI will close
9265bd8deadSopenharmony_ci        Begin/End pair even if error is encountered.
9275bd8deadSopenharmony_ci      - Added wording to reflect parallelism of color/alpha pairs.
9285bd8deadSopenharmony_ci      - Added error condition when trying to use secondary color alpha.
9295bd8deadSopenharmony_ci      - Added error condition when generating shader IDs with <range> 0.
9305bd8deadSopenharmony_ci      - Added display list exclusion for everything except 
9315bd8deadSopenharmony_ci        BindFragmentShaderATI and SetFragmentShaderConstantATI.
9325bd8deadSopenharmony_ci      - Cleaned up, fixed typos, and reformatted.
9335bd8deadSopenharmony_ci      - Added New State section.
9345bd8deadSopenharmony_ci      - Replaced sample code.
9355bd8deadSopenharmony_ci
9365bd8deadSopenharmony_ci    Date: 4/19/2002
9375bd8deadSopenharmony_ci    Revision: 1.2
9385bd8deadSopenharmony_ci      - Updated swizzle table to indicate that projected texcoords are
9395bd8deadSopenharmony_ci        undefined when used in conjunction with cubemaps or 3D textures.
9405bd8deadSopenharmony_ci
9415bd8deadSopenharmony_ci    Date: 3/20/2002
9425bd8deadSopenharmony_ci    Revision: 1.1
9435bd8deadSopenharmony_ci      - Made resource availability explicit.
9445bd8deadSopenharmony_ci      - Deprecated implementation-dependent constant queries.
9455bd8deadSopenharmony_ci      - Added various error conditions described in prose of spec.
9465bd8deadSopenharmony_ci      - Changed PRIMARY_COLOR_EXT to PRIMARY_COLOR_ARB.
9475bd8deadSopenharmony_ci      - Cleaned up and fixed typos throughout.
9485bd8deadSopenharmony_ci
9495bd8deadSopenharmony_ci    Date: 1/2/2002
9505bd8deadSopenharmony_ci    Revision: 1.02
9515bd8deadSopenharmony_ci      - Added note that PRIMARY_COLOR_EXT and SECONDARY_INTERPOLATOR_ATI can not
9525bd8deadSopenharmony_ci        be used on the first pass of a two pass shader.  Also added error
9535bd8deadSopenharmony_ci        for this case to Errors section.
9545bd8deadSopenharmony_ci      - Added note that in order to save the contents of a register from the 
9555bd8deadSopenharmony_ci        first pass to the second, there has to be a PassTexCoordATI() on that
9565bd8deadSopenharmony_ci        register to itself on the next pass.
9575bd8deadSopenharmony_ci      - Changed PRIMARY_COLOR to PRIMARY_COLOR_EXT.
9585bd8deadSopenharmony_ci
9595bd8deadSopenharmony_ci    Date: 10/15/2001
9605bd8deadSopenharmony_ci    Revision: 1.01
9615bd8deadSopenharmony_ci      - Fixed typos in example program.
9625bd8deadSopenharmony_ci      - Added language about the shader result being placed in REG_0_ATI.
9635bd8deadSopenharmony_ci      - Specify range supported [-8..8].
9645bd8deadSopenharmony_ci      - Added notes on how to specify whether DOT4/DOT3/DOT2_ADD result 
9655bd8deadSopenharmony_ci        goes to alpha channel.
9665bd8deadSopenharmony_ci
9675bd8deadSopenharmony_ci    Date: 8/21/2001
9685bd8deadSopenharmony_ci    Revision: 1.0
9695bd8deadSopenharmony_ci      - Added equation for source modifiers.
9705bd8deadSopenharmony_ci
9715bd8deadSopenharmony_ci    Date: 8/6/2001
9725bd8deadSopenharmony_ci    Revision: 0.6
9735bd8deadSopenharmony_ci      - Added restraint that only SWIZZLE_STR_ATI and SWIZZLE_STR_DR_ATI
9745bd8deadSopenharmony_ci        can be used on the second pass when the source is a register.
9755bd8deadSopenharmony_ci
9765bd8deadSopenharmony_ci    Date: 6/29/2001
9775bd8deadSopenharmony_ci    Revision: 0.5
9785bd8deadSopenharmony_ci      - Removed glTexProjectATI and change glSampleMapATI/glPassTexCoordATI to
9795bd8deadSopenharmony_ci        take a <swizzle> parameter instead of <project>.
9805bd8deadSopenharmony_ci      - Changed MAD_ATI from (a + b * c) to (a * b + c).
9815bd8deadSopenharmony_ci
9825bd8deadSopenharmony_ci    Date: 6/11/2001
9835bd8deadSopenharmony_ci    Revision: 0.4
9845bd8deadSopenharmony_ci      - Removed FRAC_ATI.
9855bd8deadSopenharmony_ci      - Added <project> parameter to SampleMapATI and PassTexCoordATI to
9865bd8deadSopenharmony_ci        match current implementation.
9875bd8deadSopenharmony_ci
9885bd8deadSopenharmony_ci    Date: 5/01/2001
9895bd8deadSopenharmony_ci    Revision: 0.3
9905bd8deadSopenharmony_ci      - Added COLOR_ALPHA_PAIRING_ATI.
9915bd8deadSopenharmony_ci      - Attempted to clarify definition of SampleMapATI in the documentation
9925bd8deadSopenharmony_ci        section.  Changed <map> to <interp>.
9935bd8deadSopenharmony_ci      - Added TexProjectATI and documented texture projection modes to allow
9945bd8deadSopenharmony_ci        implementations that only support 3-tuples to select between (s, t, r)
9955bd8deadSopenharmony_ci        and (s, t, q) coordinates.
9965bd8deadSopenharmony_ci
9975bd8deadSopenharmony_ci    Date: 4/19/2001
9985bd8deadSopenharmony_ci    Revision: 0.2
9995bd8deadSopenharmony_ci      - Removed <dstRot> from ColorFragmentOp[1..3]ATI.
10005bd8deadSopenharmony_ci      - Changed SHADER_ATI to FRAGMENT_SHADER_ATI.
10015bd8deadSopenharmony_ci      - Fixed the <op>'s in the New Tokens section to go to the proper
10025bd8deadSopenharmony_ci        Color/AlphaOp functions.
10035bd8deadSopenharmony_ci      - Added ZERO and ONE constants.
10045bd8deadSopenharmony_ci      - Made number of passes queryable: removed NUM_PASSn_INSTRUCTIONS_ATI, 
10055bd8deadSopenharmony_ci        replaced with NUM_PASSES_ATI, NUM_INSTRUCTIONS_PER_PASS_ATI, and
10065bd8deadSopenharmony_ci        NUM_INSTRUCTIONS_TOTAL_ATI.
10075bd8deadSopenharmony_ci      - Documented when new pass starts (SampleMapATI/PassCoordATI).
10085bd8deadSopenharmony_ci      - Added NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI/NUM_LOOPBACK_COMPONENTS_ATI.
10095bd8deadSopenharmony_ci      - Fixed sample usage to not do a dependent read on the base map.
10105bd8deadSopenharmony_ci
10115bd8deadSopenharmony_ci    Date: 4/16/2001
10125bd8deadSopenharmony_ci    Revision: 0.1
10135bd8deadSopenharmony_ci      - First draft
1014