WEBGL_compressed_texture_s3tc_srgb
WebGL working group (public_webgl 'at' khronos.org)
Members of the WebGL working group
Last modified date: October 24, 2019
Revision: 4
WebGL extension #32
Written against the WebGL API 1.0 specification.
This extension exposes the sRGB compressed texture formats defined in the EXT_texture_compression_s3tc_srgb OpenGL extension to WebGL.
When this extension is enabled:
COMPRESSED_SRGB_S3TC_DXT1_EXT
,
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
, and
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
may be passed to
the compressedTexImage2D
and compressedTexSubImage2D
entry points.
COMPRESSED_SRGB_S3TC_DXT1_EXT
format,
so WebGL implementations may map it to COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
.
This means the alpha channel is not guaranteed to be opaque (0xFF);
it may be transparent (0x0) in some implementations.
Applications expecting maximum portability should avoid authoring and uploading textures of
COMPRESSED_SRGB_S3TC_DXT1_EXT
format. See the corresponding OpenGL extension for technical
details about format differences.
getParameter
with the argument COMPRESSED_TEXTURE_FORMATS
will include the 4 formats from this specification.
The following format specific restrictions must be enforced:
The byteLength
of the ArrayBufferView, pixels
, passed to
either compressedTexImage2D
or compressedTexSubImage2D
must match the following equation:
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
If it is not an INVALID_VALUE
error is generated.
When level
equals zero width
and height
must be a multiple of 4. When level
is greater than 0 width
and height
must be 0, 1, 2 or a multiple of 4.
If they are not an INVALID_OPERATION
error is generated.
For compressedTexSubImage2D
xoffset
and
yoffset
must be a multiple of 4 and
width
must be a multiple of 4 or equal to the original
width of the level
. height
must be a multiple of 4 or
equal to the original height of the level
.
If they are not an INVALID_OPERATION
error is generated.
The byteLength
of the ArrayBufferView, pixels
, passed to
either compressedTexImage2D
or compressedTexSubImage2D
must
match the following equation:
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
If it is not an INVALID_VALUE
error is generated.
When level
equals zero width
and height
must be a multiple of 4. When level
is greater than 0 width
and height
must be 0, 1, 2 or a multiple of 4.
If they are not an INVALID_OPERATION
error is generated.
For compressedTexSubImage2D
xoffset
and
yoffset
must be a multiple of 4 and
width
must be a multiple of 4 or equal to the original
width of the level
. height
must be a multiple of 4 or
equal to the original height of the level
.
If they are not an INVALID_OPERATION
error is generated.
[Exposed=(Window,Worker), LegacyNoInterfaceObject] interface WEBGL_compressed_texture_s3tc_srgb { /* Compressed Texture Formats */ const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; };
Revision 1, 2016/06/10
Revision 2, 2016/07/21
Revision 3, 2017/05/31
Revision 4, 2019/10/24
COMPRESSED_SRGB_S3TC_DXT1_EXT
support.