API

Interface WebGPUEngineOptions

Options to create the WebGPU engine

interface WebGPUEngineOptions {
    adaptToDeviceRatio?: boolean;
    antialias?: boolean;
    audioEngine?: boolean;
    audioEngineOptions?: IAudioEngineOptions;
    canvasColorSpace?: PredefinedColorSpace;
    canvasTabIndex?: number;
    canvasToneMapping?: GPUCanvasToneMapping;
    deterministicLockstep?: boolean;
    deviceDescriptor?: GPUDeviceDescriptor;
    doNotHandleContextLost?: boolean;
    doNotHandleTouchAction?: boolean;
    enableAllFeatures?: boolean;
    enableGPUDebugMarkers?: boolean;
    featureLevel?: string;
    forceFallbackAdapter?: boolean;
    glslangOptions?: GlslangOptions;
    limitDeviceRatio?: number;
    lockstepMaxSteps?: number;
    powerPreference?: GPUPowerPreference;
    premultipliedAlpha?: boolean;
    setMaximumLimits?: boolean;
    stencil?: boolean;
    swapChainFormat?: GPUTextureFormat;
    timeStep?: number;
    twgslOptions?: TwgslOptions;
    useExactSrgbConversions?: boolean;
    useHighPrecisionMatrix?: boolean;
    useLargeWorldRendering?: boolean;
    xrCompatible?: boolean;
}

Hierarchy (View Summary)

Index
adaptToDeviceRatio?: boolean

Defines whether to adapt to the device's viewport characteristics (default: false)

antialias?: boolean

Defines whether MSAA is enabled on the canvas.

audioEngine?: boolean

Defines if webaudio should be initialized as well

audioEngineOptions?: IAudioEngineOptions

Specifies options for the audio engine

canvasColorSpace?: PredefinedColorSpace

Defines the canvas output color space. Default: "srgb". Selecting "display-p3" changes how output colors are interpreted; it does not convert the rendering pipeline's colors to Display P3.

canvasTabIndex?: number

Defines the tab index to set on the rendering canvas (default: 1). Any value >= 0 makes the canvas focusable so it can capture keyboard events and places it in the document's sequential tab order (0 follows DOM order, a positive value forces an explicit order). Use -1 to keep the canvas focusable programmatically (via focus()) while excluding it from the tab order.

canvasToneMapping?: GPUCanvasToneMapping

Defines the canvas presentation tone mapping. Default: { mode: "standard" }. Extended mode allows HDR presentation with swapChainFormat: "rgba16float" on supported browsers and displays. This does not replace material or post-process tone mapping; the rendering pipeline must preserve values above 1 for HDR output.

deterministicLockstep?: boolean

Defines if animations should run using a deterministic lock step

deviceDescriptor?: GPUDeviceDescriptor

Defines the device descriptor used to create a device once we have retrieved an appropriate adapter

doNotHandleContextLost?: boolean

Defines that engine should ignore context lost events If this event happens when this parameter is true, you will have to reload the page to restore rendering

doNotHandleTouchAction?: boolean

Defines that engine should ignore modifying touch action attribute and style If not handle, you might need to set it up on your side for expected touch devices behavior.

enableAllFeatures?: boolean

When requesting the device, enable all the features supported by the adapter. Default: false Note that this setting is ignored if you explicitely set deviceDescriptor.requiredFeatures

enableGPUDebugMarkers?: boolean

Defines whether we should generate debug markers in the gpu command lists (can be seen with PIX for eg). Default: false

featureLevel?: string

The featureLevel property of the GPURequestAdapterOptions interface

forceFallbackAdapter?: boolean

When set to true, indicates that only a fallback adapter may be returned when requesting an adapter. If the user agent does not support a fallback adapter, will cause requestAdapter() to resolve to null. Default: false

glslangOptions?: GlslangOptions

Options to load the associated Glslang library

limitDeviceRatio?: number

Defines if the engine should no exceed a specified device ratio

lockstepMaxSteps?: number

Defines the maximum steps to use with deterministic lock step mode

powerPreference?: GPUPowerPreference

Defines the category of adapter to use. Is it the discrete or integrated device.

premultipliedAlpha?: boolean

Defines whether the canvas should be created in "premultiplied" mode (if false, the canvas is created in the "opaque" mode) (true by default)

setMaximumLimits?: boolean

When requesting the device, set the required limits to the maximum possible values (the ones from adapter.limits). Default: false Note that this setting is ignored if you explicitely set deviceDescriptor.requiredLimits

stencil?: boolean

Defines whether the stencil buffer should be enabled.

swapChainFormat?: GPUTextureFormat

Defines the requested Swap Chain Format.

timeStep?: number

Defines the seconds between each deterministic lock step

twgslOptions?: TwgslOptions

Options to load the associated Twgsl library

useExactSrgbConversions?: boolean

True if the more expensive but exact conversions should be used for transforming colors to and from linear space within shaders. Otherwise, the default is to use a cheaper approximation.

useHighPrecisionMatrix?: boolean

Make the matrix computations to be performed in 64 bits instead of 32 bits. False by default. Note that setting useLargeWorldRendering will also set high precision matrices

useLargeWorldRendering?: boolean

LargeWorldRendering helps avoid floating point imprecision of rendering large worlds by

  1. Forcing highPrecisionMatrices (matrix computations in 64 bits instead of 32)
  2. Enabling floatingOriginMode in all scenes -- offsetting position-related uniform and attribute values before passing to shader so that active camera is centered at origin and world is offset by active camera position

NOTE that if this mode is set during engineCreation, all scenes will have floatingOrigin offset and you do not need to send floatingOriginMode option to each scene creation. If you'd like to have only specific scenes using the offset logic, you can set the flag on those scenes directly -- however, to achieve proper large world rendering, you must also set the useHighPrecisionMatrix option on engine.

xrCompatible?: boolean

When set to true, requests a GPU adapter that is compatible with the user agent's XR device, as required to create a WebGPU-compatible WebXR session (see the WebXR/WebGPU binding spec). This mirrors the WebGL xrCompatible context attribute and must be set when the engine is created (adapter-request time): WebGPU has no post-hoc "make XR compatible" step, so it cannot be toggled on later. Leave unset/false for the default non-XR path. Default: false WebGPU-XR support is experimental and may change.