Skip to main content

Function: resolveRenderTargetFormat()

resolveRenderTargetFormat(gl, requested): RENDER_TARGET_FORMAT_KEYS

Defined in: rendering/shaders/utils/resolve-render-target-format.ts:18

Resolves the color texture format a RenderTarget should actually allocate, falling back to RENDER_TARGET_FORMAT.ldr when RENDER_TARGET_FORMAT.hdr was requested but the context doesn't support EXT_color_buffer_float (required to render into a half-float texture).

Never calls gl.getExtension for RENDER_TARGET_FORMAT.ldr, so requesting the default format has no extension-detection cost.

Parameters

gl

WebGL2RenderingContext

The WebGL2 rendering context.

requested

RENDER_TARGET_FORMAT_KEYS

The format the caller asked for.

Returns

RENDER_TARGET_FORMAT_KEYS

The format to actually allocate.