diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index bdfd928c152..ee57634c2ac 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -264,6 +264,15 @@ class GraphicsDevice extends EventHandler { */ textureHalfFloatRenderable; + /** + * True if small-float textures with format {@link PIXELFORMAT_111110F} can be used as a frame + * buffer. This is always true on WebGL2, but optional on WebGPU device. + * + * @type {boolean} + * @readonly + */ + textureRG11B10Renderable = false; + /** * True if filtering can be applied when sampling float textures. * @@ -855,6 +864,12 @@ class GraphicsDevice extends EventHandler { /** * Get a renderable HDR pixel format supported by the graphics device. * + * Note: + * - When the `filterable` parameter is set to false, this function returns one of the supported + * formats on the majority of devices apart from some very old iOS and Android devices (99%). + * - When the `filterable` parameter is set to true, the function returns a format on a + * considerably lower number of devices (70%). + * * @param {number[]} [formats] - An array of pixel formats to check for support. Can contain: * * - {@link PIXELFORMAT_111110F} diff --git a/src/platform/graphics/texture.js b/src/platform/graphics/texture.js index 96bca13b7ac..ee09bcba1c7 100644 --- a/src/platform/graphics/texture.js +++ b/src/platform/graphics/texture.js @@ -25,6 +25,27 @@ let id = 0; * A texture is a container for texel data that can be utilized in a fragment shader. Typically, * the texel data represents an image that is mapped over geometry. * + * Note on **HDR texture format** support: + * 1. **As textures**: + * - float (i.e. {@link PIXELFORMAT_RGBA32F}), half-float (i.e. {@link PIXELFORMAT_RGBA16F}) and + * small-float ({@link PIXELFORMAT_111110F}) formats are always supported on both WebGL2 and WebGPU + * with point sampling. + * - half-float and small-float formats are always supported on WebGL2 and WebGPU with linear + * sampling. + * - float formats are supported on WebGL2 and WebGPU with linear sampling only if + * {@link GraphicsDevice#textureFloatFilterable} is true. + * + * 2. **As renderable textures** that can be used as color buffers in a {@link RenderTarget}: + * - on WebGPU, rendering to float and half-float formats is always supported. + * - on WebGPU, rendering to small-float format is supported only if + * {@link GraphicsDevice#textureRG11B10Renderable} is true. + * - on WebGL2, rendering to these 3 formats formats is supported only if + * {@link GraphicsDevice#textureFloatRenderable} is true. + * - on WebGL2, if {@link GraphicsDevice#textureFloatRenderable} is false, but + * {@link GraphicsDevice#textureHalfFloatRenderable} is true, rendering to half-float formats only + * is supported. This is the case of many mobile iOS devices. + * - you can determine available renderable HDR format using + * {@link GraphicsDevice#getRenderableHdrFormat}. * @category Graphics */ class Texture {