EXT_color_buffer_half_float
WebGL working group (public_webgl 'at' khronos.org)
Mark Callow, HI Corporation
Members of the WebGL working group
Last modified date: December 02, 2022
Revision: 9
WebGL extension #14
Written against the WebGL API 1.0 specification.
In WebGL 1.0 contexts, implementations must also support the OES_texture_half_float extension.
This extension exposes the EXT_color_buffer_half_float functionality to WebGL.
The following WebGL-specific behavioral changes apply:
In WebGL 1.0 contexts, references to the R16F and
RG16F types are ignored.
WebGL implementations supporting this extension are required to
support rendering to the RGBA16F format.
Consult the above extension for documentation, issues and new functions and enumerants.
When this extension is enabled:
In WebGL 1.0 contexts, the 16-bit floating-point types
RGB16F and RGBA16F become available as
color-renderable formats. Renderbuffers can be created in these
formats. These and textures created with type =
HALF_FLOAT_OES, which will have one of these internal formats,
can be attached to framebuffer object color attachments for
rendering. Implementations supporting this extension are required to
support rendering to the RGBA16F format. Applications must
check framebuffer completeness to determine if RGB16F is
supported.
In WebGL 2.0 contexts, the 16-bit floating-point types
RGBA16F, RG16F, and R16F become
available as color-renderable formats. Renderbuffers can be created in
these formats. These and textures created with type =
HALF_FLOAT, which will have one of these internal formats, can be
attached to framebuffer object color attachments for rendering.
Implementations supporting this extension are required to support
rendering to RGBA16F format. The RGB16F format
is not color-renderable.
NOTE: fragment shaders' outputs
gl_FragColor and gl_FragData[0] will only be
clamped and converted when the color buffer is fixed-point, and
clearColor() will no longer clamp its parameter values on
input. Clamping will be applied as necessary at draw time according to
the type of color buffer in use.
If the implementation supports unclamped blend color, the
blendColor() will no longer clamp its parameter values on
input. Clamping will be applied as necessary at draw time according to
the type of color buffer in use. Applications may check the effective
blend color with getParameter.
The format and type combination RGBA and
FLOAT becomes valid for reading from a floating-point
rendering buffer. Note: RGBA and
UNSIGNED_BYTE cannot be used for reading from a
floating-point rendering buffer.
The component types of framebuffer object attachments can be queried.
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface EXT_color_buffer_half_float {
const GLenum RGBA16F_EXT = 0x881A;
const GLenum RGB16F_EXT = 0x881B;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
}; // interface EXT_color_buffer_half_float
In WebGL 1.0 contexts, RGB16F_EXT and
RGBA16F_EXT are accepted as the
internalformat parameter.
In WebGL 2.0 contexts, RGBA16F,
RG16F, and R16F are accepted as the
internalformat parameter.
In WebGL 1.0 contexts,
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT
is accepted as the pname parameter.
An INVALID_OPERATION error is generated if
attachment is DEPTH_STENCIL_ATTACHMENT
and pname is FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT.
In section 5.13.12 Reading back pixels, change the allowed format and types table to:
| frame buffer type |
format
|
type
|
|---|---|---|
| normalized fixed-point | RGBA | UNSIGNED_BYTE |
| floating-point | RGBA | FLOAT |
Change the paragraph beginning "If pixels is null ..."
to
If frame buffer type is not that indicated in the table for theformatandtypecombination, an INVALID_OPERATON error is generated. If pixels is null ...
Revision 1, 2012/11/08
Revision 2, 2012/11/13
Revision 3, 2012/11/26
Revision 4, 2014/07/15
Revision 5, 2014/11/24
Revision 6, 2016/05/05
Revision 7, 2017/09/14
Revision 8, 2020/08/31
Revision 9, 2022/12/02