WEBGL_compressed_texture_astc
WebGL working group (public_webgl 'at' khronos.org)
Christophe Riccio, Unity
Members of the WebGL working group
Last modified date: December 12, 2016
Revision: 5
WebGL extension #30
Written against the WebGL API 1.0 specification.
This extension exposes the compressed texture format defined in the KHR_texture_compression_astc_hdr OpenGL ES extension to WebGL. Consult that extension specification for behavioral definitions, including error behaviors.
ASTC textures may be encoded using either high or low dynamic range, corresponding to an "HDR
profile" and "LDR profile". The compression format is designed to be extended, and for new
profiles to be added in the future. For this reason, enabling the WebGL extension enables all
of the profiles supported by the implementation. The supported profiles may be queried by
calling getSupportedProfiles against the extension object.
When this extension is enabled:
COMPRESSED_RGBA_ASTC_4x4_KHR,
COMPRESSED_RGBA_ASTC_5x4_KHR,
COMPRESSED_RGBA_ASTC_5x5_KHR,
COMPRESSED_RGBA_ASTC_6x5_KHR,
COMPRESSED_RGBA_ASTC_6x6_KHR,
COMPRESSED_RGBA_ASTC_8x5_KHR,
COMPRESSED_RGBA_ASTC_8x6_KHR,
COMPRESSED_RGBA_ASTC_8x8_KHR,
COMPRESSED_RGBA_ASTC_10x5_KHR,
COMPRESSED_RGBA_ASTC_10x6_KHR,
COMPRESSED_RGBA_ASTC_10x8_KHR,
COMPRESSED_RGBA_ASTC_10x10_KHR,
COMPRESSED_RGBA_ASTC_12x10_KHR,
COMPRESSED_RGBA_ASTC_12x12_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
and COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR may be passed to
the compressedTexImage2D and compressedTexSubImage2D entry points.
getParameter with the argument COMPRESSED_TEXTURE_FORMATS
will include the format from this specification.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 4) / 5) * floor((height + 3) / 4) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 4) / 5) * floor((height + 4) / 5) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 5) / 6) * floor((height + 4) / 5) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 5) / 6) * floor((height + 5) / 6) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 7) / 8) * floor((height + 4) / 5) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 7) / 8) * floor((height + 5) / 6) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 7) / 8) * floor((height + 7) / 8) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 9) / 10) * floor((height + 4) / 5) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 9) / 10) * floor((height + 5) / 6) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 9) / 10) * floor((height + 7) / 8) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 9) / 10) * floor((height + 9) / 10) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 11) / 12) * floor((height + 9) / 10) * 16
If it is not, an INVALID_VALUE error is generated.
The following format-specific restrictions must be enforced:
The byteLength of the ArrayBufferView, pixels, passed to
compressedTexImage2D or compressedTexSubImage2D must be
equal to the following number of bytes:
floor((width + 11) / 12) * floor((height + 11) / 12) * 16
If it is not, an INVALID_VALUE error is generated.
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface WEBGL_compressed_texture_astc {
/* Compressed Texture Format */
const GLenum COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
const GLenum COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
const GLenum COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
const GLenum COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
const GLenum COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
const GLenum COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
const GLenum COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
const GLenum COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
const GLenum COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
const GLenum COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
const GLenum COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
const GLenum COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
const GLenum COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
const GLenum COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
// Profile query support.
sequence<DOMString> getSupportedProfiles();
};
getSupportedProfiles function is to allow easy reconstruction
of the underlying OpenGL or OpenGL ES extension strings for environments like Emscripten, by
prepending the string GL_KHR_texture_compression_astc_ to the returned profile
names.
internalformat parameter:
COMPRESSED_RGBA_ASTC_4x4_KHR,
COMPRESSED_RGBA_ASTC_5x4_KHR,
COMPRESSED_RGBA_ASTC_5x5_KHR,
COMPRESSED_RGBA_ASTC_6x5_KHR,
COMPRESSED_RGBA_ASTC_6x6_KHR,
COMPRESSED_RGBA_ASTC_8x5_KHR,
COMPRESSED_RGBA_ASTC_8x6_KHR,
COMPRESSED_RGBA_ASTC_8x8_KHR,
COMPRESSED_RGBA_ASTC_10x5_KHR,
COMPRESSED_RGBA_ASTC_10x6_KHR,
COMPRESSED_RGBA_ASTC_10x8_KHR,
COMPRESSED_RGBA_ASTC_10x10_KHR,
COMPRESSED_RGBA_ASTC_12x10_KHR,
COMPRESSED_RGBA_ASTC_12x12_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
internalformat parameter:
COMPRESSED_RGBA_ASTC_4x4_KHR,
COMPRESSED_RGBA_ASTC_5x4_KHR,
COMPRESSED_RGBA_ASTC_5x5_KHR,
COMPRESSED_RGBA_ASTC_6x5_KHR,
COMPRESSED_RGBA_ASTC_6x6_KHR,
COMPRESSED_RGBA_ASTC_8x5_KHR,
COMPRESSED_RGBA_ASTC_8x6_KHR,
COMPRESSED_RGBA_ASTC_8x8_KHR,
COMPRESSED_RGBA_ASTC_10x5_KHR,
COMPRESSED_RGBA_ASTC_10x6_KHR,
COMPRESSED_RGBA_ASTC_10x8_KHR,
COMPRESSED_RGBA_ASTC_10x10_KHR,
COMPRESSED_RGBA_ASTC_12x10_KHR,
COMPRESSED_RGBA_ASTC_12x12_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_4x4_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_5x4_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 4) / 5) * floor((height + 3) / 4) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_5x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 4) / 5) * floor((height + 4) / 5) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_6x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 5) / 6) * floor((height + 4) / 5) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_6x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 5) / 6) * floor((height + 5) / 6) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_8x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 7) / 8) * floor((height + 4) / 5) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_8x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 7) / 8) * floor((height + 5) / 6) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_8x8_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 7) / 8) * floor((height + 7) / 8) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_10x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 9) / 10) * floor((height + 4) / 5) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_10x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 9) / 10) * floor((height + 5) / 6) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_10x8_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 9) / 10) * floor((height + 7) / 8) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_10x10_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 9) / 10) * floor((height + 9) / 10) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_12x10_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 11) / 12) * floor((height + 9) / 10) * 16
INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D
if the internalformat parameter is
COMPRESSED_RGBA_ASTC_12x12_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
and the byteLength of the ArrayBufferView is not:
floor((width + 11) / 12) * floor((height + 11) / 12) * 16
Revision 1, 2015/03/10
Revision 2, 2015/08/07
Revision 3, 2015/08/10
Revision 4, 2015/08/10
Revision 5, 2016/12/12