15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    APPLE_texture_packed_float
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_APPLE_texture_packed_float
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Alexander Rogoyski, Apple Inc
125bd8deadSopenharmony_ci    Serge Metral, Apple Inc
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContact
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Alexander Rogoyski, Apple Inc (rogoyski 'at' apple.com)
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci    
205bd8deadSopenharmony_ci    Complete
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Last Modified Date: February 13, 2014
255bd8deadSopenharmony_ci    Version:            1.0
265bd8deadSopenharmony_ci    
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci    
295bd8deadSopenharmony_ci    OpenGL ES Extension #195
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ciDependencies
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    Requires OpenGL ES 2.0.
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    Written against the OpenGL ES 2.0.25 (Nov. 2010) Specification.
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OES_texture_half_float affects the definition of this specification.
385bd8deadSopenharmony_ci    
395bd8deadSopenharmony_ci    EXT_texture_storage affects the definition of this specification.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciOverview
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    This extension adds two new 3-component floating-point texture formats
445bd8deadSopenharmony_ci    that fit within a single 32-bit word called R11F_G11F_B10F and RGB9_E5 
455bd8deadSopenharmony_ci    
465bd8deadSopenharmony_ci    The first RGB format, R11F_G11F_B10F, stores 5 bits of biased exponent 
475bd8deadSopenharmony_ci    per component in the same manner as 16-bit floating-point formats, but 
485bd8deadSopenharmony_ci    rather than 10 mantissa bits, the red, green, and blue components have 
495bd8deadSopenharmony_ci    6, 6, and 5 bits respectively. Each mantissa is assumed to have an 
505bd8deadSopenharmony_ci    implied leading one except in the denorm exponent case.  There is no 
515bd8deadSopenharmony_ci    sign bit so only non-negative values can be represented.  Positive 
525bd8deadSopenharmony_ci    infinity, positivedenorms, and positive NaN values are representable.  
535bd8deadSopenharmony_ci    The value of the fourth component returned by a texture fetch is always
545bd8deadSopenharmony_ci    1.0.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    The second RGB format, RGB9_E5, stores a single 5-bit exponent (biased 
575bd8deadSopenharmony_ci    up by 15) and three 9-bit mantissas for each respective component.  
585bd8deadSopenharmony_ci    There is no sign bit so all three components must be non-negative.  
595bd8deadSopenharmony_ci    The fractional mantissas are stored without an implied 1 to the left 
605bd8deadSopenharmony_ci    of the decimal point. Neither infinity nor not-a-number (NaN) are 
615bd8deadSopenharmony_ci    representable in this shared exponent format.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ciNew Procedures and Functions
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    None
665bd8deadSopenharmony_ci        
675bd8deadSopenharmony_ciNew Tokens
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    Accepted by the <type> parameter of TexImage2D and TexSubImage2D:
705bd8deadSopenharmony_ci    
715bd8deadSopenharmony_ci        UNSIGNED_INT_10F_11F_11F_REV_APPLE           0x8C3B
725bd8deadSopenharmony_ci        UNSIGNED_INT_5_9_9_9_REV_APPLE               0x8C3E
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of TexStorage2DEXT:
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci        R11F_G11F_B10F_APPLE                         0x8C3A
785bd8deadSopenharmony_ci        RGB9_E5_APPLE                                0x8C3D
795bd8deadSopenharmony_ci        
805bd8deadSopenharmony_ciChanges to Chapter 2 of the OpenGL ES 2.0.25 Specification
815bd8deadSopenharmony_ci(OpenGL Operation)
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    Add two new sections after Section "Floating-Point Computation":
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci        "Unsigned 11-Bit Floating-Point Numbers"
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci        An unsigned 11-bit floating-point number has no sign bit, a 5-bit
885bd8deadSopenharmony_ci        exponent (E), and a 6-bit mantissa (M).  The value of an unsigned
895bd8deadSopenharmony_ci        11-bit floating-point number (represented as an 11-bit unsigned
905bd8deadSopenharmony_ci        integer N) is determined by the following: 
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci            0.0,                      if E == 0 and M == 0,
935bd8deadSopenharmony_ci            2^-14 * (M / 64),         if E == 0 and M != 0,
945bd8deadSopenharmony_ci            2^(E-15) * (1 + M/64),    if 0 < E < 31,
955bd8deadSopenharmony_ci            INF,                      if E == 31 and M == 0, or
965bd8deadSopenharmony_ci            NaN,                      if E == 31 and M != 0,
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci        where
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci            E = floor(N / 64), and
1015bd8deadSopenharmony_ci            M = N mod 64.
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci        Implementations are also allowed to use any of the following
1045bd8deadSopenharmony_ci        alternative encodings:
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci            0.0,                      if E == 0 and M != 0
1075bd8deadSopenharmony_ci            2^(E-15) * (1 + M/64)     if E == 31 and M == 0
1085bd8deadSopenharmony_ci            2^(E-15) * (1 + M/64)     if E == 31 and M != 0
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci        When a floating-point value is converted to an unsigned 11-bit
1115bd8deadSopenharmony_ci        floating-point representation, finite values are rounded to the 
1125bd8deadSopenharmony_ci        closest representable finite value.  While less accurate, 
1135bd8deadSopenharmony_ci        implementations are allowed to always round in the direction of 
1145bd8deadSopenharmony_ci        zero.  This means negative values are converted to zero.  
1155bd8deadSopenharmony_ci        Likewise, finite positive values greater than 65024 (the maximum 
1165bd8deadSopenharmony_ci        finite representable unsigned 11-bit floating-point value) are 
1175bd8deadSopenharmony_ci        converted to 65024.  Additionally: negative infinity is converted 
1185bd8deadSopenharmony_ci        to zero; positive infinity is converted to positive infinity; and 
1195bd8deadSopenharmony_ci        both positive and negative NaN are converted to positive NaN.
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci        Any representable unsigned 11-bit floating-point value is legal
1225bd8deadSopenharmony_ci        as input to a GL command that accepts 11-bit floating-point data.
1235bd8deadSopenharmony_ci        The result of providing a value that is not a floating-point 
1245bd8deadSopenharmony_ci        number (such as infinity or NaN) to such a command is unspecified,
1255bd8deadSopenharmony_ci        but must not lead to GL interruption or termination.  Providing a
1265bd8deadSopenharmony_ci        denormalized number or negative zero to GL must yield predictable 
1275bd8deadSopenharmony_ci        results.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci        "Unsigned 10-Bit Floating-Point Numbers"
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci        An unsigned 10-bit floating-point number has no sign bit, a 5-bit
1325bd8deadSopenharmony_ci        exponent (E), and a 5-bit mantissa (M).  The value of an unsigned
1335bd8deadSopenharmony_ci        10-bit floating-point number (represented as an 10-bit unsigned
1345bd8deadSopenharmony_ci        integer N) is determined by the following: 
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci            0.0,                      if E == 0 and M == 0,
1375bd8deadSopenharmony_ci            2^-14 * (M / 32),         if E == 0 and M != 0,
1385bd8deadSopenharmony_ci            2^(E-15) * (1 + M/32),    if 0 < E < 31,
1395bd8deadSopenharmony_ci            INF,                      if E == 31 and M == 0, or
1405bd8deadSopenharmony_ci            NaN,                      if E == 31 and M != 0,
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci        where
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci            E = floor(N / 32), and
1455bd8deadSopenharmony_ci            M = N mod 32.
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci        When a floating-point value is converted to an unsigned 10-bit
1485bd8deadSopenharmony_ci        floating-point representation, finite values are rounded to the 
1495bd8deadSopenharmony_ci        closet representable finite value.  While less accurate, 
1505bd8deadSopenharmony_ci        implementations are allowed to always round in the direction of 
1515bd8deadSopenharmony_ci        zero.  This means negative values are converted to zero.  
1525bd8deadSopenharmony_ci        Likewise, finite positive values greater than 64512 (the maximum 
1535bd8deadSopenharmony_ci        finite representable unsigned 10-bit floating-point value) are 
1545bd8deadSopenharmony_ci        converted to 64512.  Additionally: negative infinity is converted 
1555bd8deadSopenharmony_ci        to zero; positive infinity is converted to positive infinity; and 
1565bd8deadSopenharmony_ci        both positive and negative NaN are converted to positive NaN.
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci        Any representable unsigned 10-bit floating-point value is legal
1595bd8deadSopenharmony_ci        as input to a GL command that accepts 10-bit floating-point data.
1605bd8deadSopenharmony_ci        The result of providing a value that is not a floating-point 
1615bd8deadSopenharmony_ci        number (such as infinity or NaN) to such a command is 
1625bd8deadSopenharmony_ci        unspecified, but must not lead to GL interruption or termination.
1635bd8deadSopenharmony_ci        Providing a denormalized number or negative zero to GL must yield 
1645bd8deadSopenharmony_ci        predictable results.
1655bd8deadSopenharmony_ci        
1665bd8deadSopenharmony_ciChanges to Chapter 3 of the OpenGL ES 2.0.25 Specification (Rasterization)
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    Add to Table 3.2, p. 62:
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci        type Parameter                            Corresponding  Special
1715bd8deadSopenharmony_ci        Token Name                                GL Data Type   Interpretation
1725bd8deadSopenharmony_ci        ----------------------------------------  -------------  --------------
1735bd8deadSopenharmony_ci        UNSIGNED_INT_10F_11F_11F_REV_APPLE        uint           Yes
1745bd8deadSopenharmony_ci        UNSIGNED_INT_5_9_9_9_REV_APPLE            uint           Yes
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    Add to Table 3.4, p. 63:
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci        Format            Type                                  Bytes per Pixel
1795bd8deadSopenharmony_ci        ----------------  ------------------------------------  ---------------
1805bd8deadSopenharmony_ci        RGB               UNSIGNED_INT_10F_11F_11F_REV_APPLE    4
1815bd8deadSopenharmony_ci        RGB               UNSIGNED_INT_5_9_9_9_REV_APPLE        4
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ci  Add to Table 3.5, p. 64:
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci        type Parameter                       GL Data  Number of   Matching  
1865bd8deadSopenharmony_ci        Token Name                           Type     Components  Pixel Formats
1875bd8deadSopenharmony_ci        ----------------------------------   -------  ----------  -------------
1885bd8deadSopenharmony_ci        UNSIGNED_INT_10F_11F_11F_REV_APPLE   uint     3           RGB
1895bd8deadSopenharmony_ci        UNSIGNED_INT_5_9_9_9_REV_APPLE       uint     3           RGB
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci  Add the following to section 3.6.2 Transfer of Pixel Rectangles,
1925bd8deadSopenharmony_ci  subsection Unpacking
1935bd8deadSopenharmony_ci    
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci        UNSIGNED_INT_10F_11F_11F_REV_APPLE:
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci         31 30 ... 23 22 21 20 ... 12 11 10  9 ...  1  0
1985bd8deadSopenharmony_ci        +---------------+---------------+---------------+
1995bd8deadSopenharmony_ci        |      3rd      |      2nd      |      1st      |
2005bd8deadSopenharmony_ci        +---------------+---------------+---------------+
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci        UNSIGNED_INT_5_9_9_9_REV_APPLE:
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci         31 30 ... 27 26 25 24 ... 18 17 16 15 ...  9 8 7 6 5 4 ... 0
2065bd8deadSopenharmony_ci        +------------+---------------+---------------+---------------+
2075bd8deadSopenharmony_ci        |     4th    |      3rd      |      2nd      |      1st      |
2085bd8deadSopenharmony_ci        +------------+---------------+---------------+---------------+
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci  Add Section 3.7.14, Shared Exponent Texture Color Conversion
2115bd8deadSopenharmony_ci  
2125bd8deadSopenharmony_ci        If the currently bound texture's <format> is RGB and <type> is
2135bd8deadSopenharmony_ci        UNSIGNED_INT_5_9_9_9_REV_APPLE, the red, green, blue, and shared 
2145bd8deadSopenharmony_ci        bits are converted to color components (prior to filtering) using 
2155bd8deadSopenharmony_ci        shared exponent decoding.  The 1st, 2nd, 3rd, and 4th components 
2165bd8deadSopenharmony_ci        are called p_red, p_green, p_blue, and p_exp respectively and are 
2175bd8deadSopenharmony_ci        treated as unsigned integers. They are converted to floating-point
2185bd8deadSopenharmony_ci        red, green, and blue as follows:
2195bd8deadSopenharmony_ci        
2205bd8deadSopenharmony_ci            red   = p_red   * 2^(p_exp - B - N)
2215bd8deadSopenharmony_ci            green = p_green * 2^(p_exp - B - N)
2225bd8deadSopenharmony_ci            blue  = p_blue  * 2^(p_exp - B - N)
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci        where B is 15 (the exponent bias) and N is 9 (the number of mantissa
2255bd8deadSopenharmony_ci        bits)."
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ciErrors
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    Relaxation of INVALID_ENUM errors
2305bd8deadSopenharmony_ci    ---------------------------------
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci    TexImage2D, and TexSubImage2D accept  the new 
2335bd8deadSopenharmony_ci    UNSIGNED_INT_10F_11F_11F_REV_APPLE and 
2345bd8deadSopenharmony_ci    UNSIGNED_INT_5_9_9_9_REV_APPLE token for <type>.
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    TexStorage2DEXT accepts the new R11F_G11F_B10F_APPLE and 
2375bd8deadSopenharmony_ci    RGB9_E5_APPLE token for <internalformat>.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    New errors
2415bd8deadSopenharmony_ci    ----------
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    INVALID_OPERATION is generated by TexImage2D and TexSubImage2D
2445bd8deadSopenharmony_ci    if <type> is UNSIGNED_INT_10F_11F_11F_REV_APPLE or 
2455bd8deadSopenharmony_ci    UNSIGNED_INT_5_9_9_9_REV_APPLE and <format> is not RGB.
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    UNSIGNED_INT_10F_11F_11F_REV_APPLE is implied as the <type> when 
2485bd8deadSopenharmony_ci    TexStorage2DEXT is called with <internalformat> 
2495bd8deadSopenharmony_ci    R11F_G11F_B10F_APPLE. Thus, INVALID_OPERATION is generated by TexSubImage2D
2505bd8deadSopenharmony_ci    if <type> is not UNSIGNED_INT_10F_11F_11F_REV_APPLE.
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    UNSIGNED_INT_5_9_9_9_REV_APPLE is implied as the <type> when 
2535bd8deadSopenharmony_ci    TexStorage2DEXT is called with <internalformat> 
2545bd8deadSopenharmony_ci    RGB9_E5_APPLE. Thus, INVALID_OPERATION is generated by TexSubImage2D
2555bd8deadSopenharmony_ci    if <type> is not UNSIGNED_INT_5_9_9_9_REV_APPLE.
2565bd8deadSopenharmony_ci    
2575bd8deadSopenharmony_ciDependencies on OES_texture_half_float
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci    If OES_texture_half_float is not supported, modify fifth paragraph
2605bd8deadSopenharmony_ci    of 3.7.1 Texture Image Specification, p. 67:
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    "The selected groups are processed as described in section 3.6.2, stopping
2635bd8deadSopenharmony_ci    after final expansion to RGBA. If the internal format of the texture is
2645bd8deadSopenharmony_ci    fixed-point, components are clamped to [0,1]. Otherwise, values are not
2655bd8deadSopenharmony_ci    modified."
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    Modify first sentence of "Unpacking", p. 62:
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    "Data are taken from client memory as a sequence of one of the GL data
2705bd8deadSopenharmony_ci    types listed in Table 3.2. These elements are..."
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    Additionally, ignore all references to RGBA16F_EXT, RGB16F_EXT,
2735bd8deadSopenharmony_ci    RG16F_EXT, R16F_EXT, HALF_FLOAT_OES and half.
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ciDependencies on EXT_texture_storage
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    If EXT_texture_storage is not supported, remove all references to
2785bd8deadSopenharmony_ci    TexStorage2DEXT.     
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ciNew Implementation Dependent State
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    None
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ciRevision History
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    1.0  2014/02/13  rogoyski    Initial version
2875bd8deadSopenharmony_ci        
288