WEBGL_compressed_texture_astc - Web APIs 编辑

The WEBGL_compressed_texture_astc extension is part of the WebGL API and exposes Adaptive Scalable Texture Compression (ASTC) compressed texture formats to WebGL.

For more information, see the article Using ASTC Texture Compression for Game Assets by nvidia.

WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial.

Availability: ASTC compression is typically available on Mali ARM GPUs, Intel GPUs, and Nividia Tegra chips.

This extension is available to both, WebGL1 and WebGL2 contexts.

Methods

This extension exposes one new methods.

ext.getSupportedProfiles()

Returns an array of strings containing the names of the ASTC profiles supported by the implementation.

Constants

The compressed texture formats are exposed by 28 constants and can be used in two functions: compressedTexImage2D() and compressedTexSubImage2D().

ConstantsBlocksBits per pixelArrayBuffer byteLengthbytes if height and width are 512
ext.COMPRESSED_RGBA_ASTC_4x4_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
4x48.00floor((width + 3) / 4) * floor((height + 3) / 4) * 16262144
ext.COMPRESSED_RGBA_ASTC_5x4_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
5x46.40floor((width + 4) / 5) * floor((height + 3) / 4) * 16210944
ext.COMPRESSED_RGBA_ASTC_5x5_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
5x55.12floor((width + 4) / 5) * floor((height + 4) / 5) * 16169744
ext.COMPRESSED_RGBA_ASTC_6x5_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
6x54.27floor((width + 5) / 6) * floor((height + 4) / 5) * 16141728
ext.COMPRESSED_RGBA_ASTC_6x6_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
6x63.56floor((width + 5) / 6) * floor((height + 5) / 6) * 16118336
ext.COMPRESSED_RGBA_ASTC_8x5_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
8x53.20floor((width + 7) / 8) * floor((height + 4) / 5) * 16105472
ext.COMPRESSED_RGBA_ASTC_8x6_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
8x62.67floor((width + 7) / 8) * floor((height + 5) / 6) * 1688064
ext.COMPRESSED_RGBA_ASTC_8x8_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
8x82.00floor((width + 7) / 8) * floor((height + 7) / 8) * 1665536
ext.COMPRESSED_RGBA_ASTC_10x5_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
10x52.56floor((width + 9) / 10) * floor((height + 4) / 5) * 1685696
ext.COMPRESSED_RGBA_ASTC_10x6_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
10x62.13floor((width + 9) / 10) * floor((height + 5) / 6) * 1671552
ext.COMPRESSED_RGBA_ASTC_10x8_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
10x81.60floor((width + 9) / 10) * floor((height + 7) / 8) * 1653248
ext.COMPRESSED_RGBA_ASTC_10x10_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
10x101.28floor((width + 9) / 10) * floor((height + 9) / 10) * 1643264
ext.COMPRESSED_RGBA_ASTC_12x10_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
12x101.07floor((width + 11) / 12) * floor((height + 9) / 10) * 1635776
ext.COMPRESSED_RGBA_ASTC_12x12_KHR
ext.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
12x120.89floor((width + 11) / 12) * floor((height + 11) / 12) * 1629584

Examples

var ext = gl.getExtension('WEBGL_compressed_texture_astc');

var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);

gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGBA_ASTC_12x12_KHR, 512, 512, 0, textureData);

Specifications

SpecificationStatusComment
WEBGL_compressed_texture_astc
The definition of 'WEBGL_compressed_texture_astc' in that specification.
RecommendationInitial definition.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:59 次

字数:8295

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文