15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_texture_compression_latc
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_texture_compression_latc
85bd8deadSopenharmony_ci    GL_NV_texture_compression_latc (legacy)
95bd8deadSopenharmony_ci
105bd8deadSopenharmony_ciContributors
115bd8deadSopenharmony_ci
125bd8deadSopenharmony_ci    Mark J. Kilgard, NVIDIA
135bd8deadSopenharmony_ci    Pat Brown, NVIDIA
145bd8deadSopenharmony_ci    Yanjun Zhang, S3
155bd8deadSopenharmony_ci    Attila Barsi, Holografika
165bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
175bd8deadSopenharmony_ci     
185bd8deadSopenharmony_ciContact
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciStatus
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Shipping for GeForce 8 Series (November 2006)
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciVersion
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Last Modified Date:         July 30, 2017
295bd8deadSopenharmony_ci    Revision: 2
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ciNumber
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    331
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciDependencies
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OpenGL 1.3 or ARB_texture_compression required
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    This extension is written against the OpenGL 2.0 (September 7,
405bd8deadSopenharmony_ci    2004) specification.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension interacts with OpenGL 2.0 and ARB_texture_non_power_of_two.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciOverview
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    This extension introduces four new block-based texture compression
475bd8deadSopenharmony_ci    formats suited for unsigned and signed luminance and luminance-alpha
485bd8deadSopenharmony_ci    textures (hence the name "latc" for Luminance-Alpha Texture
495bd8deadSopenharmony_ci    Compression).
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    These formats are designed to reduce the storage requirements and
525bd8deadSopenharmony_ci    memory bandwidth required for luminance and luminance-alpha textures
535bd8deadSopenharmony_ci    by a factor of 2-to-1 over conventional uncompressed luminance and
545bd8deadSopenharmony_ci    luminance-alpha textures with 8-bit components (GL_LUMINANCE8 and
555bd8deadSopenharmony_ci    GL_LUMINANCE8_ALPHA8).
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    The compressed signed luminance-alpha format is reasonably suited
585bd8deadSopenharmony_ci    for storing compressed normal maps.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ciNew Procedures and Functions
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    None.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciNew Tokens
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of TexImage2D,
675bd8deadSopenharmony_ci    CopyTexImage2D, and CompressedTexImage2D and the <format> parameter
685bd8deadSopenharmony_ci    of CompressedTexSubImage2D:
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_LATC1_EXT                 0x8C70
715bd8deadSopenharmony_ci        COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT          0x8C71
725bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT           0x8C72
735bd8deadSopenharmony_ci        COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT    0x8C73
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    None.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci -- Section 3.8.1, Texture Image Specification
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    Add to Table 3.17 (page 155):  Specific compressed internal formats
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci        Compressed Internal Format                   Base Internal Format
865bd8deadSopenharmony_ci        -------------------------------------------  --------------------
875bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_LATC1_EXT               LUMINANCE
885bd8deadSopenharmony_ci        COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT        LUMINANCE
895bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT         LUMINANCE_ALPHA
905bd8deadSopenharmony_ci        COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT  LUMINANCE_ALPHA
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci -- Section 3.8.2, Alternative Texture Image Specification Commands
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Add to the end of the section (page 163):
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    "If the internal format of the texture image being modified is
975bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1_EXT, COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
985bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
995bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, the texture is stored 
1005bd8deadSopenharmony_ci    using one of the two LATC compressed texture image encodings (see
1015bd8deadSopenharmony_ci    appendix).  Such images are easily edited along 4x4 texel boundaries,
1025bd8deadSopenharmony_ci    so the limitations on TexSubImage2D or CopyTexSubImage2D parameters
1035bd8deadSopenharmony_ci    are relaxed.  TexSubImage2D and CopyTexSubImage2D will result in
1045bd8deadSopenharmony_ci    an INVALID_OPERATION error only if one of the following conditions
1055bd8deadSopenharmony_ci    occurs:
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci        * <width> is not a multiple of four, <width> plus <xoffset> is not
1085bd8deadSopenharmony_ci          equal to TEXTURE_WIDTH, and either <xoffset> or <yoffset> is
1095bd8deadSopenharmony_ci          non-zero;
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci        * <height> is not a multiple of four, <height> plus <yoffset> is not
1125bd8deadSopenharmony_ci          equal to TEXTURE_HEIGHT, and either <xoffset> or <yoffset> is
1135bd8deadSopenharmony_ci          non-zero; or
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci        * <xoffset> or <yoffset> is not a multiple of four.
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    The contents of any 4x4 block of texels of an LATC compressed texture
1185bd8deadSopenharmony_ci    image that does not intersect the area being modified are preserved
1195bd8deadSopenharmony_ci    during valid TexSubImage2D and CopyTexSubImage2D calls."
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci -- Section 3.8.3, Compressed Texture Images
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    Add after the 4th paragraph (page 164) at the end of the
1245bd8deadSopenharmony_ci    CompressedTexImage discussion:
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ci    "If <internalformat> is COMPRESSED_LUMINANCE_LATC1_EXT,
1275bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
1285bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
1295bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, the compressed texture is 
1305bd8deadSopenharmony_ci    stored using one of several LATC compressed texture image formats.
1315bd8deadSopenharmony_ci    The LATC texture compression algorithm supports only 2D images
1325bd8deadSopenharmony_ci    without borders.  CompressedTexImage1D and CompressedTexImage3D
1335bd8deadSopenharmony_ci    produce an INVALID_ENUM error if <internalformat> is an LATC format.
1345bd8deadSopenharmony_ci    CompressedTexImage2D will produce an INVALID_OPERATION error if
1355bd8deadSopenharmony_ci    <border> is non-zero.
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    Add to the end of the section (page 166) at the end of the
1385bd8deadSopenharmony_ci    CompressedTexSubImage discussion:
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    "If the internal format of the texture image being modified is
1415bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1_EXT, COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
1425bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
1435bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, the texture is stored
1445bd8deadSopenharmony_ci    using one of the several LATC compressed texture image formats.
1455bd8deadSopenharmony_ci    Since the LATC texture compression algorithm supports only 2D images,
1465bd8deadSopenharmony_ci    CompressedTexSubImage1D and CompressedTexSubImage3D produce an
1475bd8deadSopenharmony_ci    INVALID_ENUM error if <format> is an LATC format.  Since LATC images
1485bd8deadSopenharmony_ci    are easily edited along 4x4 texel boundaries, the limitations on
1495bd8deadSopenharmony_ci    CompressedTexSubImage2D are relaxed.  CompressedTexSubImage2D will
1505bd8deadSopenharmony_ci    result in an INVALID_OPERATION error only if one of the following
1515bd8deadSopenharmony_ci    conditions occurs:
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci        * <width> is not a multiple of four, and <width> plus <xoffset> is not
1545bd8deadSopenharmony_ci          equal to TEXTURE_WIDTH;
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci        * <height> is not a multiple of four, and <height> plus <yoffset> is
1575bd8deadSopenharmony_ci          not equal to TEXTURE_HEIGHT; or
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci        * <xoffset> or <yoffset> is not a multiple of four.
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci    The contents of any 4x4 block of texels of an LATC compressed texture
1625bd8deadSopenharmony_ci    image that does not intersect the area being modified are preserved
1635bd8deadSopenharmony_ci    during valid TexSubImage2D and CopyTexSubImage2D calls."
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment
1665bd8deadSopenharmony_ciOperations and the Frame Buffer)
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    None.
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    None.
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and
1755bd8deadSopenharmony_ciState Requests)
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    None.
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance)
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    None.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    None.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ciGLX Protocol
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    None.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ciDependencies on ARB_texture_compression
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    If ARB_texture_compression is supported, all the
1945bd8deadSopenharmony_ci    errors and accepted tokens for CompressedTexImage1D,
1955bd8deadSopenharmony_ci    CompressedTexImage2D, CompressedTexImage3D, CompressedTexSubImage1D,
1965bd8deadSopenharmony_ci    CompressedTexSubImage2D, and CompressedTexSubImage3D also apply
1975bd8deadSopenharmony_ci    respectively to the ARB-suffixed CompressedTexImage1DARB,
1985bd8deadSopenharmony_ci    CompressedTexImage2DARB, CompressedTexImage3DARB,
1995bd8deadSopenharmony_ci    CompressedTexSubImage1DARB, CompressedTexSubImage2DARB, and
2005bd8deadSopenharmony_ci    CompressedTexSubImage3DARB.
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ciDependencies on OpenGL 2.0 or ARB_texture_non_power_of_two
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    If OpenGL 2.0 or ARB_texture_non_power_of_two is supported, compressed
2055bd8deadSopenharmony_ci    texture images can have sizes that are neither multiples of four nor small
2065bd8deadSopenharmony_ci    values like one or two.  The original version of this specification didn't
2075bd8deadSopenharmony_ci    allow TexSubImage2D and CompressedTexSubImage2D to update only a portion
2085bd8deadSopenharmony_ci    of such images.  The spec has been updated to allow such edits in the
2095bd8deadSopenharmony_ci    spirit of the resolution of issue (3) of the EXT_texture_compression_s3tc
2105bd8deadSopenharmony_ci    specification.  See the "Implementation Note" section for more details.
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ciErrors
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    INVALID_ENUM is generated by CompressedTexImage1D
2155bd8deadSopenharmony_ci    or CompressedTexImage3D if <internalformat> is
2165bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1_EXT, COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
2175bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
2185bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT.
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    INVALID_OPERATION is generated by CompressedTexImage2D
2215bd8deadSopenharmony_ci    if <internalformat> is COMPRESSED_LUMINANCE_LATC1_EXT,
2225bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
2235bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
2245bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT and <border> is not
2255bd8deadSopenharmony_ci    equal to zero.
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    INVALID_ENUM is generated by CompressedTexSubImage1D
2285bd8deadSopenharmony_ci    or CompressedTexSubImage3D if <format> is
2295bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1_EXT, COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
2305bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
2315bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    INVALID_OPERATION is generated by TexSubImage2D or CopyTexSubImage2D if
2345bd8deadSopenharmony_ci    TEXTURE_INTERNAL_FORMAT is COMPRESSED_LUMINANCE_LATC1_EXT,
2355bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
2365bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
2375bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT and any of the following
2385bd8deadSopenharmony_ci    apply:
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci        * <width> is not a multiple of four, <width> plus <xoffset> is not
2415bd8deadSopenharmony_ci          equal to TEXTURE_WIDTH, and either <xoffset> or <yoffset> is
2425bd8deadSopenharmony_ci          non-zero;
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci        * <height> is not a multiple of four, <height> plus <yoffset> is not
2455bd8deadSopenharmony_ci          equal to TEXTURE_HEIGHT, and either <xoffset> or <yoffset> is
2465bd8deadSopenharmony_ci          non-zero; or
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci        * <xoffset> or <yoffset> is not a multiple of four.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    INVALID_OPERATION is generated by CompressedTexSubImage2D if
2515bd8deadSopenharmony_ci    TEXTURE_INTERNAL_FORMAT is COMPRESSED_LUMINANCE_LATC1_EXT,
2525bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
2535bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, or
2545bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT and any of the following
2555bd8deadSopenharmony_ci    apply:
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci        * <width> is not a multiple of four, and <width> plus <xoffset> is not
2585bd8deadSopenharmony_ci          equal to TEXTURE_WIDTH;
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci        * <height> is not a multiple of four, and <height> plus <yoffset> is
2615bd8deadSopenharmony_ci          not equal to TEXTURE_HEIGHT; or
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci        * <xoffset> or <yoffset> is not a multiple of four.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    The following restrictions from the ARB_texture_compression
2675bd8deadSopenharmony_ci    specification do not apply to LATC texture formats, since subimage
2685bd8deadSopenharmony_ci    modification is straightforward as long as the subimage is properly
2695bd8deadSopenharmony_ci    aligned.
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    DELETE: INVALID_OPERATION is generated by TexSubImage1D, TexSubImage2D,
2725bd8deadSopenharmony_ci    DELETE: TexSubImage3D, CopyTexSubImage1D, CopyTexSubImage2D, or
2735bd8deadSopenharmony_ci    DELETE: CopyTexSubImage3D if the internal format of the texture image is
2745bd8deadSopenharmony_ci    DELETE: compressed and <xoffset>, <yoffset>, or <zoffset> does not equal
2755bd8deadSopenharmony_ci    DELETE: -b, where b is value of TEXTURE_BORDER.
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    DELETE: INVALID_VALUE is generated by CompressedTexSubImage1D,
2785bd8deadSopenharmony_ci    DELETE: CompressedTexSubImage2D, or CompressedTexSubImage3D if the
2795bd8deadSopenharmony_ci    DELETE: entire texture image is not being edited:  if <xoffset>,
2805bd8deadSopenharmony_ci    DELETE: <yoffset>, or <zoffset> is greater than -b, <xoffset> + <width> is
2815bd8deadSopenharmony_ci    DELETE: less than w+b, <yoffset> + <height> is less than h+b, or <zoffset>
2825bd8deadSopenharmony_ci    DELETE: + <depth> is less than d+b, where b is the value of
2835bd8deadSopenharmony_ci    DELETE: TEXTURE_BORDER, w is the value of TEXTURE_WIDTH, h is the value of
2845bd8deadSopenharmony_ci    DELETE: TEXTURE_HEIGHT, and d is the value of TEXTURE_DEPTH.
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    See also errors in the GL_ARB_texture_compression specification.
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ciNew State
2895bd8deadSopenharmony_ci
2905bd8deadSopenharmony_ci    4 new state values are added for the per-texture object
2915bd8deadSopenharmony_ci    GL_TEXTURE_INTERNAL_FORMAT state.
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    In the "Textures" state table( page 278), increment the
2945bd8deadSopenharmony_ci    TEXTURE_INTERNAL_FORMAT subscript for Z by 4 in the "Type" row.
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci    [NOTE: The OpenGL 2.0 specification actually should read "n x Z48*"
2975bd8deadSopenharmony_ci    because of the 6 generic compressed internal formats in table 3.18.]
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ciNew Implementation Dependent State
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci    None
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ciAppendix
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci    LATC Compressed Texture Image Formats
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ci    Compressed texture images stored using the LATC compressed image
3085bd8deadSopenharmony_ci    encodings are represented as a collection of 4x4 texel blocks,
3095bd8deadSopenharmony_ci    where each block contains 64 or 128 bits of texel data.  The image
3105bd8deadSopenharmony_ci    is encoded as a normal 2D raster image in which each 4x4 block is
3115bd8deadSopenharmony_ci    treated as a single pixel.  If an LATC image has a width or height
3125bd8deadSopenharmony_ci    that is not a multiple of four, the data corresponding to texels 
3135bd8deadSopenharmony_ci    outside the image are irrelevant and undefined.
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    When an LATC image with a width of <w>, height of <h>, and block
3165bd8deadSopenharmony_ci    size of <blocksize> (8 or 16 bytes) is decoded, the corresponding
3175bd8deadSopenharmony_ci    image size (in bytes) is:
3185bd8deadSopenharmony_ci    
3195bd8deadSopenharmony_ci        ceil(<w>/4) * ceil(<h>/4) * blocksize.
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci    When decoding an LATC image, the block containing the texel at offset
3225bd8deadSopenharmony_ci    (<x>, <y>) begins at an offset (in bytes) relative to the base of the
3235bd8deadSopenharmony_ci    image of:
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        blocksize * (ceil(<w>/4) * floor(<y>/4) + floor(<x>/4)).
3265bd8deadSopenharmony_ci
3275bd8deadSopenharmony_ci    The data corresponding to a specific texel (<x>, <y>) are extracted
3285bd8deadSopenharmony_ci    from a 4x4 texel block using a relative (x,y) value of
3295bd8deadSopenharmony_ci    
3305bd8deadSopenharmony_ci        (<x> modulo 4, <y> modulo 4).
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci    There are four distinct LATC image formats:
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci
3355bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1:  Each 4x4 block of texels consists of
3365bd8deadSopenharmony_ci    64 bits of unsigned luminance image data.  
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci    Each luminance image data block is encoded as a sequence of 8 bytes,
3395bd8deadSopenharmony_ci    called (in order of increasing address):
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci            lum0, lum1, bits_0, bits_1, bits_2, bits_3, bits_4, bits_5
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci        The 6 "bits_*" bytes of the block are decoded into a 48-bit bit
3445bd8deadSopenharmony_ci        vector:
3455bd8deadSopenharmony_ci
3465bd8deadSopenharmony_ci            bits   = bits_0 +
3475bd8deadSopenharmony_ci                     256 * (bits_1 +
3485bd8deadSopenharmony_ci                            256 * (bits_2 +
3495bd8deadSopenharmony_ci                                   256 * (bits_3 +
3505bd8deadSopenharmony_ci                                          256 * (bits_4 + 
3515bd8deadSopenharmony_ci                                                 256 * bits_5))))
3525bd8deadSopenharmony_ci        
3535bd8deadSopenharmony_ci        lum0 and lum1 are 8-bit unsigned integers that are unpacked to
3545bd8deadSopenharmony_ci        luminance values LUM0 and LUM1 as though they were pixels with
3555bd8deadSopenharmony_ci        a <format> of LUMINANCE and a type of UNSIGNED_BTYE.
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci        bits is a 48-bit unsigned integer, from which a three-bit control
3585bd8deadSopenharmony_ci        code is extracted for a texel at location (x,y) in the block
3595bd8deadSopenharmony_ci        using:
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci            code(x,y) = bits[3*(4*y+x)+2..3*(4*y+x)+0]
3625bd8deadSopenharmony_ci        
3635bd8deadSopenharmony_ci        where bit 47 is the most significant and bit 0 is the least
3645bd8deadSopenharmony_ci        significant bit.
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci        The luminance value L for a texel at location (x,y) in the block
3675bd8deadSopenharmony_ci        is given by:
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci            LUM0,              if lum0 > lum1 and code(x,y) == 0
3705bd8deadSopenharmony_ci            LUM1,              if lum0 > lum1 and code(x,y) == 1
3715bd8deadSopenharmony_ci            (6*LUM0+  LUM1)/7, if lum0 > lum1 and code(x,y) == 2
3725bd8deadSopenharmony_ci            (5*LUM0+2*LUM1)/7, if lum0 > lum1 and code(x,y) == 3
3735bd8deadSopenharmony_ci            (4*LUM0+3*LUM1)/7, if lum0 > lum1 and code(x,y) == 4
3745bd8deadSopenharmony_ci            (3*LUM0+4*LUM1)/7, if lum0 > lum1 and code(x,y) == 5
3755bd8deadSopenharmony_ci            (2*LUM0+5*LUM1)/7, if lum0 > lum1 and code(x,y) == 6
3765bd8deadSopenharmony_ci            (  LUM0+6*LUM1)/7, if lum0 > lum1 and code(x,y) == 7
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci            LUM0,              if lum0 <= lum1 and code(x,y) == 0
3795bd8deadSopenharmony_ci            LUM1,              if lum0 <= lum1 and code(x,y) == 1
3805bd8deadSopenharmony_ci            (4*LUM0+  LUM1)/5, if lum0 <= lum1 and code(x,y) == 2
3815bd8deadSopenharmony_ci            (3*LUM0+2*LUM1)/5, if lum0 <= lum1 and code(x,y) == 3
3825bd8deadSopenharmony_ci            (2*LUM0+3*LUM1)/5, if lum0 <= lum1 and code(x,y) == 4
3835bd8deadSopenharmony_ci            (  LUM0+4*LUM1)/5, if lum0 <= lum1 and code(x,y) == 5
3845bd8deadSopenharmony_ci            MINLUM,            if lum0 <= lum1 and code(x,y) == 6
3855bd8deadSopenharmony_ci            MAXLUM,            if lum0 <= lum1 and code(x,y) == 7
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci        MINLUM and MAXLUM are 0.0 and 1.0 respectively.
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    Since the decoded texel has a luminance format, the resulting RGBA
3905bd8deadSopenharmony_ci    value for the texel is (L,L,L,1).
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1:  Each 4x4 block of texels consists
3945bd8deadSopenharmony_ci    of 64 bits of signed luminance image data.  The luminance values of
3955bd8deadSopenharmony_ci    a texel are extracted in the same way as COMPRESSED_LUMINANCE_LATC1
3965bd8deadSopenharmony_ci    except lum0, lum1, LUM0, LUM1, MINLUM, and MAXLUM are signed values
3975bd8deadSopenharmony_ci    defined as follows:
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci        lum0 and lum1 are 8-bit signed (two's complement) integers.
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci               { lum0 / 127.0, lum0 > -128
4025bd8deadSopenharmony_ci        LUM0 = {
4035bd8deadSopenharmony_ci               { -1.0,         lum0 == -128
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ci               { lum1 / 127.0, lum1 > -128
4065bd8deadSopenharmony_ci        LUM1 = {
4075bd8deadSopenharmony_ci               { -1.0,         lum1 == -128
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci        MINLUM = -1.0
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci        MAXLUM =  1.0
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    CAVEAT for signed lum0 and lum1 values: the expressions "lum0 >
4145bd8deadSopenharmony_ci    lum1" and "lum0 <= lum1" above are considered undefined (read: may
4155bd8deadSopenharmony_ci    vary by implementation) when lum0 equals -127 and lum1 equals -128,
4165bd8deadSopenharmony_ci    This is because if lum0 were remapped to -127 prior to the comparison
4175bd8deadSopenharmony_ci    to reduce the latency of a hardware decompressor, the expressions
4185bd8deadSopenharmony_ci    would reverse their logic.  Encoders for the signed LA formats should
4195bd8deadSopenharmony_ci    avoid encoding blocks where lum0 equals -127 and lum1 equals -128.
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_ALPHA_LATC2:  Each 4x4 block of texels consists
4235bd8deadSopenharmony_ci    of 64 bits of compressed unsigned luminance image data followed by
4245bd8deadSopenharmony_ci    64 bits of compressed unsigned alpha image data.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    The first 64 bits of compressed luminance are decoded exactly like
4275bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1 above.
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    The second 64 bits of compressed alpha are decoded exactly like
4305bd8deadSopenharmony_ci    COMPRESSED_LUMINANCE_LATC1 above except the decoded value L for this
4315bd8deadSopenharmony_ci    second block is considered the resulting alpha value A.
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci    Since the decoded texel has a luminance-alpha format, the resulting
4345bd8deadSopenharmony_ci    RGBA value for the texel is (L,L,L,A).
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2:  Each 4x4 block of texels
4385bd8deadSopenharmony_ci    consists of 64 bits of compressed signed luminance image data followed
4395bd8deadSopenharmony_ci    by 64 bits of compressed signed alpha image data.
4405bd8deadSopenharmony_ci
4415bd8deadSopenharmony_ci    The first 64 bits of compressed luminance are decoded exactly like
4425bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1 above.
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    The second 64 bits of compressed alpha are decoded exactly like
4455bd8deadSopenharmony_ci    COMPRESSED_SIGNED_LUMINANCE_LATC1 above except the decoded value L
4465bd8deadSopenharmony_ci    for this second block is considered the resulting alpha value A.
4475bd8deadSopenharmony_ci
4485bd8deadSopenharmony_ci    Since this image has a luminance-alpha format, the resulting RGBA
4495bd8deadSopenharmony_ci    value is (L,L,L,A).
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ciIssues
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    1)  What should these new formats be called?
4545bd8deadSopenharmony_ci
4555bd8deadSopenharmony_ci        RESOLVED: "latc" for Luminance-Alpha Texture Compression.
4565bd8deadSopenharmony_ci
4575bd8deadSopenharmony_ci    2)  How should the uncompressed and filtered texels be returned by
4585bd8deadSopenharmony_ci        texture fetches?
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci        RESOLVED:  Luminance values show up as they do conventionally as
4615bd8deadSopenharmony_ci        (L,L,L,1) where the luminance value L is replicated in the red,
4625bd8deadSopenharmony_ci        green, and blue components and alpha is forced to 1.  Likewise,
4635bd8deadSopenharmony_ci        luminance-alpha values show up as (L,L,L,A) where A is the alpha
4645bd8deadSopenharmony_ci        value.
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci        Alternatively, prior extensions such as NV_float_buffer and
4675bd8deadSopenharmony_ci        NV_texture_shader have introduced formats such as GL_FLOAT_R_NV
4685bd8deadSopenharmony_ci        and GL_DSDT_NV where one- and two-component texture formats show
4695bd8deadSopenharmony_ci        up as (X,0,0,1) or (X,Y,0,1) RGBA texels.  Such formats have
4705bd8deadSopenharmony_ci        not proven popular.  In particular, they interact awkwardly with
4715bd8deadSopenharmony_ci        the pixel path and conventional texture environment modes.
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci        The (X,Y,0,1) convention, particularly with signed components,
4745bd8deadSopenharmony_ci        is nice for normal maps because a normalized vector can be
4755bd8deadSopenharmony_ci        formed by a shader program by computing sqrt(abs(1-X*X-Y*Y))
4765bd8deadSopenharmony_ci        for the Z component.  However, this niceness is mostly conceptual
4775bd8deadSopenharmony_ci        however since the same effect can be accomplished with swizzling
4785bd8deadSopenharmony_ci        as shown in this GLSL code:
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci            vec2 texLA  = texture2D(samplerLA, gl_TexCoord[0]).xw;
4815bd8deadSopenharmony_ci            vec3 normal = vec3(texLA.x,
4825bd8deadSopenharmony_ci                               texLA.y,
4835bd8deadSopenharmony_ci                               sqrt(abs(1-texLA.x*texLA.x-texLA.y*texLA.y)));
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci        The most important reason to make these new compressed formats
4865bd8deadSopenharmony_ci        show up identically to conventional luminance and luminance-alpha
4875bd8deadSopenharmony_ci        texels is to allow applications to seamlessly substitute
4885bd8deadSopenharmony_ci        the new compressed formats for existing GL_LUMINANCE and
4895bd8deadSopenharmony_ci        GL_LUMINANCE_ALPHA textures.  Alternative component arrangements
4905bd8deadSopenharmony_ci        would make it more cumbersome for existing applications to switch
4915bd8deadSopenharmony_ci        over luminance and luminance-alpha textures to these compressed
4925bd8deadSopenharmony_ci        formats.
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci    3)  Should luminance and luminance-alpha compression formats with
4955bd8deadSopenharmony_ci        signed components be introduced when the core specification
4965bd8deadSopenharmony_ci        lacked uncompressed luminance and luminance-alpha texture formats?
4975bd8deadSopenharmony_ci
4985bd8deadSopenharmony_ci        RESOLVED:  Yes, signed luminance and luminance-alpha compression
4995bd8deadSopenharmony_ci        formats should be added.
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci        Signed luminance-alpha formats are suited for compressed normal
5025bd8deadSopenharmony_ci        maps.  Compressed normal maps may well be the dominant use of
5035bd8deadSopenharmony_ci        this extension.
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci        Unsigned luminance-alpha formats require an extra "expand normal"
5065bd8deadSopenharmony_ci        operation to convert [0,1] to [-1,+1].  Direct support for signed
5075bd8deadSopenharmony_ci        luminance-alpha formats avoids this step in a shader program.
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci    4)  Should there be a mix of signed luminance and unsigned alpha or
5105bd8deadSopenharmony_ci        vice versa?
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci        RESOLVED:  No.
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci        NV_texture_shader provided an internal format
5155bd8deadSopenharmony_ci        (GL_SIGNED_RGB_UNSIGNED_ALPHA_NV) with mixed signed and unsigned
5165bd8deadSopenharmony_ci        components.  The format saw little usage.  There's no reason to
5175bd8deadSopenharmony_ci        think a GL_SIGNED_LUMINANCE_UNSIGNED_ALPHA format would be any
5185bd8deadSopenharmony_ci        more useful or popular.
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci    5)  How are signed integer values mapped to floating-point values?
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci        RESOLVED:  A signed 8-bit two's complement value X is computed to
5235bd8deadSopenharmony_ci        a floating-point value Xf with the formula:
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci                 { X / 127.0, X > -128
5265bd8deadSopenharmony_ci            Xf = {
5275bd8deadSopenharmony_ci                 { -1.0,      X == -128
5285bd8deadSopenharmony_ci
5295bd8deadSopenharmony_ci        This conversion means -1, 0, and +1 are all exactly representable,
5305bd8deadSopenharmony_ci        however -128 and -127 both map to -1.0.  Mapping -128 to -1.0
5315bd8deadSopenharmony_ci        avoids the numerical awkwardness of have a representable value
5325bd8deadSopenharmony_ci        slightly more negative than -1.0.
5335bd8deadSopenharmony_ci
5345bd8deadSopenharmony_ci        This conversion is intentionally NOT the "byte" conversion listed
5355bd8deadSopenharmony_ci        in Table 2.9 for component conversions.  That conversion says: 
5365bd8deadSopenharmony_ci
5375bd8deadSopenharmony_ci            Xf = (2*X + 1) / 255.0
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ci        The Table 2.9 conversion is incapable of exactly representing
5405bd8deadSopenharmony_ci        zero.
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci    6)  How will signed components resulting from
5435bd8deadSopenharmony_ci        GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT and
5445bd8deadSopenharmony_ci        GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT texture fetches
5455bd8deadSopenharmony_ci        interact with fragment coloring?
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ci        RESOLVED:  The specification language for this extension is silent
5485bd8deadSopenharmony_ci        about clamping behavior leaving this to the core specification
5495bd8deadSopenharmony_ci        and other extensions.  The clamping or lack of clamping is left
5505bd8deadSopenharmony_ci        to the core specification and other extensions.
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci        For assembly program extensions supporting texture fetches
5535bd8deadSopenharmony_ci        (ARB_fragment_program, EXT_fragment_program, EXT_vertex_program3,
5545bd8deadSopenharmony_ci        etc.) or the OpenGL Shading Language, these signed formats will
5555bd8deadSopenharmony_ci        appear as expected with unclamped signed components as a result
5565bd8deadSopenharmony_ci        of a texture fetch instruction.
5575bd8deadSopenharmony_ci
5585bd8deadSopenharmony_ci        If ARB_color_buffer_float is supported, its clamping controls
5595bd8deadSopenharmony_ci        will apply.
5605bd8deadSopenharmony_ci
5615bd8deadSopenharmony_ci        NV_texture_shader extension, if supported, adds support for
5625bd8deadSopenharmony_ci        fixed-point textures with signed components and relaxed the
5635bd8deadSopenharmony_ci        fixed-function texture environment clamping appropriately.  If the
5645bd8deadSopenharmony_ci        NV_texture_shader extension is supported, its specified behavior
5655bd8deadSopenharmony_ci        for the texture environment applies where intermediate values
5665bd8deadSopenharmony_ci        are clamped to [-1,1] unless stated otherwise as in the case
5675bd8deadSopenharmony_ci        of explicitly clamped to [0,1] for GL_COMBINE.  or clamping the
5685bd8deadSopenharmony_ci        linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND.
5695bd8deadSopenharmony_ci
5705bd8deadSopenharmony_ci        Otherwise, the conventional core texture environment clamps
5715bd8deadSopenharmony_ci        incoming, intermediate, and output color components to [0,1].
5725bd8deadSopenharmony_ci
5735bd8deadSopenharmony_ci        This implies that the conventional texture environment
5745bd8deadSopenharmony_ci        functionality of unextended OpenGL 1.5 or OpenGL 2.0 without
5755bd8deadSopenharmony_ci        using GLSL (and with none of the extensions referred to above)
5765bd8deadSopenharmony_ci        is unable to make proper use of the signed texture formats added
5775bd8deadSopenharmony_ci        by this extension because the conventional texture environment
5785bd8deadSopenharmony_ci        requires texture source colors to be clamped to [0,1].  Texture
5795bd8deadSopenharmony_ci        filtering of these signed formats would be still signed, but
5805bd8deadSopenharmony_ci        negative values generated post-filtering would be clamped to
5815bd8deadSopenharmony_ci        zero by the core texture environment functionality.  The
5825bd8deadSopenharmony_ci        expectation is clearly that this extension would be co-implemented
5835bd8deadSopenharmony_ci        with one of the previously referred to extensions or used with
5845bd8deadSopenharmony_ci        GLSL for the new signed formats to be useful.
5855bd8deadSopenharmony_ci
5865bd8deadSopenharmony_ci    7)  Should a specific normal map compression format be added?
5875bd8deadSopenharmony_ci
5885bd8deadSopenharmony_ci        RESOLVED:  No.
5895bd8deadSopenharmony_ci
5905bd8deadSopenharmony_ci        It's probably short-sighted to design a format just for normal
5915bd8deadSopenharmony_ci        maps.  Indeed, NV_texture_shader added a GL_SIGNED_HILO_NV
5925bd8deadSopenharmony_ci        format with exactly the kind of "hemisphere remap" useful for
5935bd8deadSopenharmony_ci        normal maps and the format went basically unused.  Instead,
5945bd8deadSopenharmony_ci        this extension provides the mechanism for compressed normal maps
5955bd8deadSopenharmony_ci        based on the more conventional luminance-alpha format.
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ci        The GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT and
5985bd8deadSopenharmony_ci        GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT formats are
5995bd8deadSopenharmony_ci        sufficient for normal maps with additional shader instructions
6005bd8deadSopenharmony_ci        used to generate the 3rd component.
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci    8)  Should uncompressed signed luminance and luminance-alpha formats
6035bd8deadSopenharmony_ci        be added by this extension?
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci        RESOLVED:  No, this extension is focused on just adding compressed
6065bd8deadSopenharmony_ci        texture formats.
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ci        The NV_texture_shader extension adds such uncompressed signed
6095bd8deadSopenharmony_ci        texture formats.  A distinct multi-vendor extension for signed
6105bd8deadSopenharmony_ci        fixed-point texture formats could provide all or a subset of
6115bd8deadSopenharmony_ci        the signed fixed-point uncompressed texture formats introduced
6125bd8deadSopenharmony_ci        by NV_texture_shader.
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci    9)  What compression ratios does this extension provide?
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci        The LATC1 formats are 8 bytes (64 bits) per 4x4 pixel block.
6175bd8deadSopenharmony_ci        A 4x4 block of GL_LUMINANCE8 data requires 16 bytes (1 byte
6185bd8deadSopenharmony_ci        per texel).  This is a 2-to-1 compression ratio.
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci        The LATC2 formats are 16 bytes (128 bits) per 4x4 pixel block.
6215bd8deadSopenharmony_ci        A 4x4 block of GL_LUMINANCE8_ALPHA8 data requires 32 bytes
6225bd8deadSopenharmony_ci        (2 bytes per texel).  This is again a 2-to-1 compression ratio.
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci        In contrast, the comparable compression ratio for the S3TC
6255bd8deadSopenharmony_ci        formats is 4-to-1.
6265bd8deadSopenharmony_ci
6275bd8deadSopenharmony_ci        Arguably, the lower compression ratio allows better compression
6285bd8deadSopenharmony_ci        quality particularly because the LATC formats compress each
6295bd8deadSopenharmony_ci        component separately.
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci    10) How do these new formats compare with the existing GL_LUMINANCE4,
6325bd8deadSopenharmony_ci        GL_LUMINANCE4_ALPHA4, and GL_LUMINANCE6_ALPHA2 internal formats?
6335bd8deadSopenharmony_ci
6345bd8deadSopenharmony_ci        RESOLVED:  The existing GL_LUMINANCE4, GL_LUMINANCE4_ALPHA4,
6355bd8deadSopenharmony_ci        and GL_LUMINANCE6_ALPHA2 internal formats provide a similar
6365bd8deadSopenharmony_ci        2-to-1 compression ratio but mandate a uniform quantization
6375bd8deadSopenharmony_ci        for all components.  In contrast, this extension provides a
6385bd8deadSopenharmony_ci        compression format with 3-bit quantization over a specifiable
6395bd8deadSopenharmony_ci        min/max range that can vary per 4x4 texel tile.
6405bd8deadSopenharmony_ci
6415bd8deadSopenharmony_ci        Additionally, many OpenGL implementations do not natively support
6425bd8deadSopenharmony_ci        the GL_LUMINANCE4, GL_LUMINANCE4_ALPHA4, and GL_LUMINANCE6_ALPHA2
6435bd8deadSopenharmony_ci        internal formats but rather silently promote these formats
6445bd8deadSopenharmony_ci        to store 8 bits per component, thereby eliminating any
6455bd8deadSopenharmony_ci        storage/bandwidth advantage for these formats.
6465bd8deadSopenharmony_ci
6475bd8deadSopenharmony_ci    11) Does this extension require EXT_texture_compression_s3tc?
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ci        RESOLVED:  No.
6505bd8deadSopenharmony_ci
6515bd8deadSopenharmony_ci        As written, this specification does not rely on wording of the
6525bd8deadSopenharmony_ci        EXT_texture_compression_s3tc extension.  For example, certain
6535bd8deadSopenharmony_ci        discussion added to Sections 3.8.2 and 3.8.3 is quite similar
6545bd8deadSopenharmony_ci        to corresponding EXT_texture_compression_s3tc language.
6555bd8deadSopenharmony_ci
6565bd8deadSopenharmony_ci    12) Should anything be said about the precision of texture filtering
6575bd8deadSopenharmony_ci        for these new formats?
6585bd8deadSopenharmony_ci
6595bd8deadSopenharmony_ci        RESOLVED:  No precision requirements are part of the specification
6605bd8deadSopenharmony_ci        language since OpenGL extensions typically leave precision
6615bd8deadSopenharmony_ci        details to the implementation.
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci        Realistically, at least 8-bit filtering precision can be expected
6645bd8deadSopenharmony_ci        from implementations (and probably more).
6655bd8deadSopenharmony_ci
6665bd8deadSopenharmony_ci    13) Should these formats be allowed to specify 3D texture images
6675bd8deadSopenharmony_ci        when NV_texture_compression_vtc is supported?
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci        RESOLVED: The NV_texture_compression_vtc stacks 4x4 blocks into
6705bd8deadSopenharmony_ci        4x4x4 bricks.  It may be more desirable to represent compressed
6715bd8deadSopenharmony_ci        3D textures as simply slices of 4x4 blocks.
6725bd8deadSopenharmony_ci
6735bd8deadSopenharmony_ci        However the NV_texture_compression_vtc extension expects
6745bd8deadSopenharmony_ci        data passed to the glCompressedTexImage commands to be "bricked"
6755bd8deadSopenharmony_ci        rather than blocked slices.
6765bd8deadSopenharmony_ci
6775bd8deadSopenharmony_ci    14) Why is GL_NV_texture_compression_latc also listed in the Name Strings
6785bd8deadSopenharmony_ci        section?
6795bd8deadSopenharmony_ci
6805bd8deadSopenharmony_ci        The very first GeForce 8800 driver shipped with the extension
6815bd8deadSopenharmony_ci        designated as NV before EXT-ization with S3 was agreed.
6825bd8deadSopenharmony_ci        Subsequent NVIDIA drivers will rename the extension to its EXT
6835bd8deadSopenharmony_ci        name only.
6845bd8deadSopenharmony_ci
6855bd8deadSopenharmony_ci    15) Should the the generic formats
6865bd8deadSopenharmony_ci        GL_COMPRESSED_LUMINANCE and GL_COMPRESSED_LUMINANCE_ALPHA
6875bd8deadSopenharmony_ci        correspond to COMPRESSED_LUMINANCE_LATC1_EXT and
6885bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT respecitively when this
6895bd8deadSopenharmony_ci        extension is supported?
6905bd8deadSopenharmony_ci
6915bd8deadSopenharmony_ci        RESOLVED:  Yes.  While no generic compression is strictly
6925bd8deadSopenharmony_ci        required for an implementation and there might exist superior
6935bd8deadSopenharmony_ci        compression schemes for luminance and luminance-alpha textures
6945bd8deadSopenharmony_ci        in the future, an application should reasonably expect that an
6955bd8deadSopenharmony_ci        implementation that supports EXT_texture_compression_latc will
6965bd8deadSopenharmony_ci        also use these formats for the generic compressed luminance and
6975bd8deadSopenharmony_ci        luminance-alpha formats.
6985bd8deadSopenharmony_ci
6995bd8deadSopenharmony_ci        The COMPRESSED_LUMINANCE_LATC1_EXT and
7005bd8deadSopenharmony_ci        COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT are generic enough in their
7015bd8deadSopenharmony_ci        respective luminance and luminance-alpha behavior that these
7025bd8deadSopenharmony_ci        compression formats are acceptable generic compressed formats
7035bd8deadSopenharmony_ci        for luminance and luminance-alpha generic compressed formats.
7045bd8deadSopenharmony_ci
7055bd8deadSopenharmony_ci    16) Should the GL_NUM_COMPRESSED_TEXTURE_FORMATS and
7065bd8deadSopenharmony_ci        GL_COMPRESSED_TEXTURE_FORMATS queries return the LATC formats?
7075bd8deadSopenharmony_ci
7085bd8deadSopenharmony_ci        RESOLVED:  No.
7095bd8deadSopenharmony_ci
7105bd8deadSopenharmony_ci        The OpenGL 2.1 specification says "The only values returned
7115bd8deadSopenharmony_ci        by this query [GL_COMPRESSED_TEXTURE_FORMATS"] are those
7125bd8deadSopenharmony_ci        corresponding to formats suitable for general-purpose usage.
7135bd8deadSopenharmony_ci        The renderer will not enumerate formats with restrictions that
7145bd8deadSopenharmony_ci        need to be specifically understood prior to use."
7155bd8deadSopenharmony_ci
7165bd8deadSopenharmony_ci        Historically, OpenGL implementation have advertised the RGB and
7175bd8deadSopenharmony_ci        RGBA versions of the S3TC extensions compressed format tokens
7185bd8deadSopenharmony_ci        through this mechanism.
7195bd8deadSopenharmony_ci
7205bd8deadSopenharmony_ci        The specification is not sufficiently clear about what "suitable
7215bd8deadSopenharmony_ci        for general-purpose usage" means.  Historically that seems to mean
7225bd8deadSopenharmony_ci        unsigned RGB or unsigned RGBA.  The DXT1 format supporting alpha
7235bd8deadSopenharmony_ci        (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) is not exposed in the list (at
7245bd8deadSopenharmony_ci        least for NVIDIA drivers) because the alpha is always 1.0 expect
7255bd8deadSopenharmony_ci        when it is 0.0 when RGB is required to be black.  NVIDIA's even
7265bd8deadSopenharmony_ci        limits itself to true linear RGB or RGBA formats, specifically
7275bd8deadSopenharmony_ci        not including EXT_texture_sRGB's sRGB S3TC compressed formats.
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci        Adding luminance and luminance-alpha texture formats (and
7305bd8deadSopenharmony_ci        certainly signed versions of luminance and luminance-alpha
7315bd8deadSopenharmony_ci        formats!) invites potential comptaibility problems with old
7325bd8deadSopenharmony_ci        applications using this mechanism since old applications are
7335bd8deadSopenharmony_ci        unlikely to expect non-RGB or non-RGBA formats to be advertised
7345bd8deadSopenharmony_ci        through this mechanism.  However no specific misinteractions
7355bd8deadSopenharmony_ci        with old applications is known.
7365bd8deadSopenharmony_ci
7375bd8deadSopenharmony_ci        Applications that seek to use the LATC formats should do so
7385bd8deadSopenharmony_ci        by looking for this extension's name in the string returned by
7395bd8deadSopenharmony_ci        glGetString(GL_EXTENSIONS) rather than
7405bd8deadSopenharmony_ci        what GL_NUM_COMPRESSED_TEXTURE_FORMATS and
7415bd8deadSopenharmony_ci        GL_COMPRESSED_TEXTURE_FORMATS return.
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ciImplementation Note
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci    This extension allows TexSubImage2D and CompressedTexSubImage2D to perform
7465bd8deadSopenharmony_ci    partial updates to compressed images, but generally requires that the
7475bd8deadSopenharmony_ci    updated area be aligned to 4x4 block boundaries.  If the width or height
7485bd8deadSopenharmony_ci    is not a multiple of four, there will be 4x4 blocks at the edge of the
7495bd8deadSopenharmony_ci    image that contain "extra" texels that are not part of the image.  This
7505bd8deadSopenharmony_ci    spec has an exception allowing edits that partially cover such blocks as
7515bd8deadSopenharmony_ci    long as the edit covers all texels in the block belonging to the image.
7525bd8deadSopenharmony_ci    For example, in a 2D texture of size 70x50, it is legal to update the
7535bd8deadSopenharmony_ci    single partial block covering the four texels from (68,48) to (69,49) by
7545bd8deadSopenharmony_ci    setting (<xoffset>, <yoffset>) to (68,48) and <width> and <height> to 2.
7555bd8deadSopenharmony_ci
7565bd8deadSopenharmony_ci    This specification derived some of its language from the
7575bd8deadSopenharmony_ci    EXT_texture_compression_s3tc specification.  When that extension was
7585bd8deadSopenharmony_ci    originally written, non-bordered textures were required to have widths and
7595bd8deadSopenharmony_ci    heights that were powers of two.  Therefore, the only cases where partial
7605bd8deadSopenharmony_ci    blocks could occur were if the width or height of the texture image was
7615bd8deadSopenharmony_ci    one or two.  The original spec language allowed partial block edits only
7625bd8deadSopenharmony_ci    if the width or height of the region edited was equal to the full texture
7635bd8deadSopenharmony_ci    size.  That language didn't handle cases such as the 70x50 example above.
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci    This specification was updated in April, 2009 to allow such edits.
7665bd8deadSopenharmony_ci    Multiple OpenGL implementers correctly implemented the original
7675bd8deadSopenharmony_ci    restriction, and partial edits that include partially covered tiles will
7685bd8deadSopenharmony_ci    result in INVALID_OPERATION errors on older drivers.
7695bd8deadSopenharmony_ci
7705bd8deadSopenharmony_ci
7715bd8deadSopenharmony_ciRevision History
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci    Revision 1.1, April 24, 2007: mjk
7745bd8deadSopenharmony_ci        -  Add caveat about how signed LA decompression happens when
7755bd8deadSopenharmony_ci           lum0 equals -127 and lum1 equals -128.  This caveat matches
7765bd8deadSopenharmony_ci           a decoding allowance in DirectX 10.
7775bd8deadSopenharmony_ci
7785bd8deadSopenharmony_ci    Revision 1.2, January 21, 2008: mjk
7795bd8deadSopenharmony_ci        -  Add issues #15 and #16.
7805bd8deadSopenharmony_ci
7815bd8deadSopenharmony_ci    Revision 1.3, April 14, 2009: pbrown 
7825bd8deadSopenharmony_ci        - Add interaction with non-power-of-two textures from OpenGL 2.0 /
7835bd8deadSopenharmony_ci          ARB_texture_non_power_of_two.  Allow CompressedTexSubImage2D to
7845bd8deadSopenharmony_ci          perform edits that include partial tiles at the edge of the image as
7855bd8deadSopenharmony_ci          long as the specified width/height parameters line up with the edge.
7865bd8deadSopenharmony_ci          Thanks to Emil Persson for finding this issue.
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    Revision 2, July 30, 2017: dgkoch
7895bd8deadSopenharmony_ci	- replace references to COMPRESSED_LUMINANCE_LACT1_EXT with references
7905bd8deadSopenharmony_ci          to the correct spelling COMPRESSED_LUMINANCE_LATC1_EXT.
791