15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_texture_compression_vtc
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_texture_compression_vtc
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Matt Craighead, NVIDIA Corporation (mcraighead 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNotice
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Copyright NVIDIA Corporation, 2000, 2001, 2004.
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciIP Status
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    NVIDIA Proprietary.
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciVersion
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    NVIDIA Date: June 3, 2004
245bd8deadSopenharmony_ci    Version:     4
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciNumber
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    228
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciDependencies
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.2.1 specification.
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    ARB_texture_compression is required.
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ci    EXT_texture_compression_s3tc is required.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    ARB_texture_non_power_of_two interacts with this extension.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciOverview
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension adds support for the VTC 3D texture compression
435bd8deadSopenharmony_ci    formats, which are analogous to the S3TC texture compression formats,
445bd8deadSopenharmony_ci    with the addition of some retiling in the Z direction.  VTC has the
455bd8deadSopenharmony_ci    same compression ratio as S3TC and uses 4x4x1, 4x4x2, (4x4x3 when
465bd8deadSopenharmony_ci    non-power-of-two textures are supported), or 4x4x4 blocks.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciIssues
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    *   Should the enumerants' (1) values and (2) names be reused from
515bd8deadSopenharmony_ci        the S3TC extension?
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci        RESOLVED: Yes and yes.  There is such a close correspondence
545bd8deadSopenharmony_ci        between the formats that introducing new values or names would
555bd8deadSopenharmony_ci        serve no purpose.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    *   Should the block alignment restrictions differ in any way from
585bd8deadSopenharmony_ci        the block alignment restrictions in the S3TC extension?
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci        RESOLVED: No, except for the addition of the Z-direction block
615bd8deadSopenharmony_ci        alignment restriction for CompressedTexSubImage3D, which is
625bd8deadSopenharmony_ci        analogous to the X and Y restrictions.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    *   Should VTC compression work with the ARB_texture_non_power_of_two
655bd8deadSopenharmony_ci        functionality?
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci        RESOLVED: Yes.  The blockIndex computation works for
685bd8deadSopenharmony_ci        non-power-of-two width, height, and depth dimensions.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci        Consider a 31x25x11 3D texture to be stored using VTC.
715bd8deadSopenharmony_ci        The initial 31x25x8 portion of the volume is bricked up using
725bd8deadSopenharmony_ci        VTC with 4x4x4 blocks where the 31x25 dimensions are rounded
735bd8deadSopenharmony_ci        up to 32x28.  Following the expanded 32x28x8 initial volume are
745bd8deadSopenharmony_ci        the final texels arranged as 32x28x3 with 4x4x3 blocks.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew Procedures and Functions
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    None.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciNew Tokens
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of TexImage3D and
835bd8deadSopenharmony_ci    CompressedTexImage3DARB and the <format> parameter of
845bd8deadSopenharmony_ci    CompressedTexSubImage2DARB:
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci        COMPRESSED_RGB_S3TC_DXT1_EXT                   0x83F0
875bd8deadSopenharmony_ci        COMPRESSED_RGBA_S3TC_DXT1_EXT                  0x83F1
885bd8deadSopenharmony_ci        COMPRESSED_RGBA_S3TC_DXT3_EXT                  0x83F2
895bd8deadSopenharmony_ci        COMPRESSED_RGBA_S3TC_DXT5_EXT                  0x83F3
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    None.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    Modify the paragraph added to the end of the TexSubImage discussion
985bd8deadSopenharmony_ci    (page 123) by EXT_texture_compression_s3tc to say:
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    "If the internal format of the texture image being modified is
1015bd8deadSopenharmony_ci    COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
1025bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT, the
1035bd8deadSopenharmony_ci    texture is stored using one of several S3TC or VTC compressed texture
1045bd8deadSopenharmony_ci    image formats.  Such images are easily edited along 4x4 texel
1055bd8deadSopenharmony_ci    boundaries, so the limitations on TexSubImage2D, TexSubImage3D,
1065bd8deadSopenharmony_ci    CopyTexSubImage2D, and CopyTexSubImage3D parameters are relaxed.
1075bd8deadSopenharmony_ci    These commands will result in an INVALID_OPERATION error only if one
1085bd8deadSopenharmony_ci    of the following conditions occurs:
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci        * <width> is not a multiple of four or equal to TEXTURE_WIDTH.
1115bd8deadSopenharmony_ci        * <height> is not a multiple of four or equal to TEXTURE_HEIGHT.
1125bd8deadSopenharmony_ci        * <xoffset> or <yoffset> is not a multiple of four."
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    Modify the paragraph added to Section 3.8.2 "Alternate Image
1155bd8deadSopenharmony_ci    Specification" at the end of the CompressedTexImage section by
1165bd8deadSopenharmony_ci    EXT_texture_compression_s3tc to say:
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    "If <internalformat> is COMPRESSED_RGB_S3TC_DXT1_EXT,
1195bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or
1205bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT5_EXT, the compressed texture is stored using
1215bd8deadSopenharmony_ci    one of several S3TC or VTC compressed texture image formats.  The
1225bd8deadSopenharmony_ci    S3TC texture compression algorithm supports only 2D images without
1235bd8deadSopenharmony_ci    borders, while the VTC texture compression algorithm supports only
1245bd8deadSopenharmony_ci    3D images without borders.  CompressedTexImage1DARB produces an
1255bd8deadSopenharmony_ci    INVALID_ENUM error if <internalformat> is an S3TC/VTC format.
1265bd8deadSopenharmony_ci    CompressedTexImage2DARB and CompressedTexImage3DARB will produce an
1275bd8deadSopenharmony_ci    INVALID_OPERATION error if <border> is non-zero."
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    Modify the paragraph added to Section 3.8.2 "Alternate Image
1305bd8deadSopenharmony_ci    Specification" at the end of the CompressedTexSubImage section by
1315bd8deadSopenharmony_ci    EXT_texture_compression_s3tc to say:
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    "If the internal format of the texture image being modified is
1345bd8deadSopenharmony_ci    COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
1355bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT, the
1365bd8deadSopenharmony_ci    texture is stored using one of several S3TC or VTC compressed texture
1375bd8deadSopenharmony_ci    image formats.  Since these algorithms support only 2D and 3D images,
1385bd8deadSopenharmony_ci    CompressedTexSubImage1DARB produces an INVALID_ENUM error if <format>
1395bd8deadSopenharmony_ci    is an S3TC/VTC format.  Since S3TC/VTC images are easily edited along
1405bd8deadSopenharmony_ci    4x4 and 4x4x4 texel boundaries, the limitations on
1415bd8deadSopenharmony_ci    CompressedTexSubImage2D and CompressedTexSubImage3D are relaxed.
1425bd8deadSopenharmony_ci    CompressedTexSubImage2D and CompressedTexSubImage3D will result in an
1435bd8deadSopenharmony_ci    INVALID_OPERATION error only if one of the following conditions
1445bd8deadSopenharmony_ci    occurs:
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci        * <width> is not a multiple of four or equal to TEXTURE_WIDTH.
1475bd8deadSopenharmony_ci        * <height> is not a multiple of four or equal to TEXTURE_HEIGHT.
1485bd8deadSopenharmony_ci        * <depth> is not a multiple of four or equal to TEXTURE_DEPTH.
1495bd8deadSopenharmony_ci        * <xoffset>, <yoffset>, or <zoffset> is not a multiple of four."
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
1525bd8deadSopenharmony_ciOperations and the Frame Buffer)
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    None.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    None.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
1615bd8deadSopenharmony_ciState Requests)
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    None.
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    None.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ciDependencies on ARB_texture_non_power_of_two
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    There are no explicit dependencies on ARB_texture_non_power_of_two
1725bd8deadSopenharmony_ci    but the Appendix language is compatible with non-power-of-two
1735bd8deadSopenharmony_ci    texture sizes.  4x4x3 blocks are not possible if texture sizes are
1745bd8deadSopenharmony_ci    restricted to power-of-two values.
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ciGLX Protocol
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    None.
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ciErrors
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    The INVALID_ENUM error that was generated by CompressedTexImage3DARB
1835bd8deadSopenharmony_ci    if <internalformat> is COMPRESSED_RGB_S3TC_DXT1_EXT,
1845bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or
1855bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT5_EXT no longer occurs.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    INVALID_OPERATION is generated by CompressedTexImage3DARB if
1885bd8deadSopenharmony_ci    <internalformat> is COMPRESSED_RGB_S3TC_DXT1_EXT,
1895bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or
1905bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT5_EXT and <border> is not equal to zero.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    The INVALID_ENUM error that was generated by
1935bd8deadSopenharmony_ci    CompressedTexSubImage3DARB if <format> is
1945bd8deadSopenharmony_ci    COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
1955bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT no
1965bd8deadSopenharmony_ci    longer occurs.
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    INVALID_OPERATION is generated by TexSubImage3D or
1995bd8deadSopenharmony_ci    CopyTexSubImage3D if INTERNAL_FORMAT is COMPRESSED_RGB_S3TC_DXT1_EXT,
2005bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or
2015bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT5_EXT and any of the following apply: <width>
2025bd8deadSopenharmony_ci    is not a multiple of four or equal to TEXTURE_WIDTH; <height> is not
2035bd8deadSopenharmony_ci    a multiple of four or equal to TEXTURE_HEIGHT; <xoffset> or <yoffset>
2045bd8deadSopenharmony_ci    is not a multiple of four.
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci    INVALID_OPERATION is generated by CompressedTexSubImage3D
2075bd8deadSopenharmony_ci    if INTERNAL_FORMAT is COMPRESSED_RGB_S3TC_DXT1_EXT,
2085bd8deadSopenharmony_ci    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
2095bd8deadSopenharmony_ci    or COMPRESSED_RGBA_S3TC_DXT5_EXT and any of the following apply:
2105bd8deadSopenharmony_ci    <width> is not a multiple of four or equal to TEXTURE_WIDTH; <height>
2115bd8deadSopenharmony_ci    is not a multiple of four or equal to TEXTURE_HEIGHT; <depth> is not
2125bd8deadSopenharmony_ci    a multiple of four or equal to TEXTURE_DEPTH; <xoffset> <yoffset>,
2135bd8deadSopenharmony_ci    or <zoffset> is not a multiple of four.
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    See also errors in the GL_ARB_texture_compression and
2165bd8deadSopenharmony_ci    GL_EXT_texture_compression_s3tc specifications.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ciNew State
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    None.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ciAppendix
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci    VTC Compressed Texture Image Formats
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    Each VTC compression format is similar to a corresponding S3TC
2275bd8deadSopenharmony_ci    compression format, but where an S3TC block encodes a 4x4 block of
2285bd8deadSopenharmony_ci    texels, a VTC block encodes a 4x4x1, 4x4x2, or 4x4x4 (or 4x4x3 if
2295bd8deadSopenharmony_ci    non-power-of-two textures are supported) block of texels.  If the
2305bd8deadSopenharmony_ci    depth of the image is four or greater, 4x4x4 blocks are used, and
2315bd8deadSopenharmony_ci    if the depth is 1 or 2, 4x4x1 or 4x4x2 blocks are used.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    (If non-power-of-two textures are supported and the depth of the
2345bd8deadSopenharmony_ci    texture is not a multiple 4, the excess texels in depth after 4x4x4
2355bd8deadSopenharmony_ci    blocks are arranged are stored with 4x4x1, 4x4x2, or 4x4x3 blocks
2365bd8deadSopenharmony_ci    as necessary to complete the texture.)
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    The size in bytes of a VTC image with dimensions w, h, and d is:
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci        ceil(w/4) * ceil(h/4) * d * blocksize,
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    where blocksize is the size of an analogous 4x4 S3TC block and is
2435bd8deadSopenharmony_ci    either 8 or 16 bytes.
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci    The block containing a texel at location (x,y,z) starts at an offset
2465bd8deadSopenharmony_ci    inside the image of blockIndex bytes where blockIndex is computed
2475bd8deadSopenharmony_ci    as follows:
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci    if (z >= 4*floor(d/4)) {
2505bd8deadSopenharmony_ci        blockIndex = blocksize * (ceil(w/4) * ceil(h/4) * 4*floor(d/4) +
2515bd8deadSopenharmony_ci                                  floor(x/4) +
2525bd8deadSopenharmony_ci                                  ceil(w/4) * (floor(y/4) +
2535bd8deadSopenharmony_ci                                               ceil(h/4) * (z-4*floor(d/4)) ));
2545bd8deadSopenharmony_ci    } else {
2555bd8deadSopenharmony_ci        blockIndex = blocksize * 4 * (floor(x/4) +
2565bd8deadSopenharmony_ci                                      ceil(w/4) * (floor(y/4) +
2575bd8deadSopenharmony_ci                                                   ceil(h/4) * floor(z/4)));
2585bd8deadSopenharmony_ci    }
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci    These two observations about subexpressions in the above computation
2615bd8deadSopenharmony_ci    are useful:
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci        4*floor(d/4) == d & ~0x3
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci        when z > 4*floor(d/4) and z < d, z-4*floor(d/4) == z & 0x3
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    A 4x4x1 block of each of the four formats is stored in exactly the
2685bd8deadSopenharmony_ci    same way that a 4x4 block of the analogous S3TC format is stored.
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    A 4x4x2, 4x4x3, or 4x4x4 block is stored as two, three, or four
2715bd8deadSopenharmony_ci    consecutive 4x4 blocks of the analogous S3TC format, one for each
2725bd8deadSopenharmony_ci    layer inside the block.  For example, a 4x4x2 DXT1 block consists of
2735bd8deadSopenharmony_ci    16 bytes in total.  The first 8 bytes encode the texels at locations
2745bd8deadSopenharmony_ci    (0,0,0) through (3,3,0), and the second 8 bytes encode the texels
2755bd8deadSopenharmony_ci    at locations (0,0,1) through (3,3,1).
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    For definitions of the S3TC formats, please refer to the
2785bd8deadSopenharmony_ci    EXT_texture_compression_s3tc specification.
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ciRevision History
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    April 20, 2004 - Relax restrictions on depth and zoffset for
2835bd8deadSopenharmony_ci    CopyTexSubImage3D and TexSubImage3D commands.  Previous restrictions
2845bd8deadSopenharmony_ci    required 1) the image level's depth to be 1 for CopyTexSubImage3D to
2855bd8deadSopenharmony_ci    work (making the command useless in practice) and 2) the depth and
2865bd8deadSopenharmony_ci    zoffset for TexSubImage3D to be a multiple 4.  If these restrictions
2875bd8deadSopenharmony_ci    were violated, an INVALID_OPERATION error was documented to be
2885bd8deadSopenharmony_ci    generated.  NVIDIA Release 60 drivers after April 20, 2004 relax
2895bd8deadSopenharmony_ci    these restrictions.  Note the restrictions on CompressedTexSubImage3D
2905bd8deadSopenharmony_ci    that depth and zoffset must be multiples of 4 still exist because the
2915bd8deadSopenharmony_ci    VTC block is a 3D 4x4x4 block (or 4x4x2 and 4x4x1 in the end cases).
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    Jun 3, 2004 - Update blockIndex to support non-power-of-two dimensions
2945bd8deadSopenharmony_ci    for VTC storage.
295