BabylonJS/Babylon.js · error

computeDispatch: This engine does not support compute shader

Error message

computeDispatch: This engine does not support compute shaders!

What it means

ThinEngine.prototype.computeDispatch is a stub that always throws on engines without compute shader support. Dispatching a compute shader workgroup therefore fails immediately on WebGL-based engines. Real dispatching exists only on WebGPU (and Native) engines.

Source

Thrown at packages/dev/core/src/Engines/Extensions/engine.computeShader.pure.ts:100

    ThinEngine.prototype.createComputePipelineContext = function (): IComputePipelineContext {
        throw new Error("createComputePipelineContext: This engine does not support compute shaders!");
    };

    ThinEngine.prototype.createComputeContext = function (): IComputeContext | undefined {
        return undefined;
    };

    ThinEngine.prototype.computeDispatch = function (
        effect: ComputeEffect,
        context: IComputeContext,
        bindings: ComputeBindingList,
        x: number,
        y?: number,
        z?: number,
        bindingsMapping?: ComputeBindingMapping
    ): void {
        throw new Error("computeDispatch: This engine does not support compute shaders!");
    };

    ThinEngine.prototype.computeDispatchIndirect = function (
        effect: ComputeEffect,
        context: IComputeContext,
        bindings: ComputeBindingList,
        buffer: DataBuffer,
        offset?: number,
        bindingsMapping?: ComputeBindingMapping
    ): void {
        throw new Error("computeDispatchIndirect: This engine does not support compute shaders!");
    };

    ThinEngine.prototype.areAllComputeEffectsReady = function (): boolean {
        return true;
    };

    ThinEngine.prototype.releaseComputeEffects = function (): void {};

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Ensure the app runs on WebGPU (feature-detect navigator.gpu and surface a clear message when absent).
  2. Feature-check before dispatch: if (!engine.isWebGPU) use a fallback implementation.
  3. Catch the error around dispatch and switch to a CPU or fragment-shader fallback path.
  4. Use EngineFactory.CreateAsync which negotiates WebGPU first instead of constructing ThinEngine/Engine directly.

Example fix

// before
computeShader.dispatch(64, 1, 1);
// after
if (engine.isWebGPU) {
    computeShader.dispatch(64, 1, 1);
} else {
    runFallbackOnCpu();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!engine.isWebGPU) {
    throw new Error('computeDispatch requires WebGPU');
}

Type guard

function canDispatch(e: AbstractEngine): boolean {
    return (e as any).isWebGPU === true || e._features?.supportComputeShaders === true;
}

Try / catch

try {
    computeShader.dispatch(x, y, z);
} catch (e) {
    if (String((e as Error).message).includes('computeDispatch')) {
        runCpuFallback();
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling engine.computeDispatch(effect, context, bindings, x, y, z) — directly or through ComputeShader.dispatch() — while the underlying engine is WebGL1/WebGL2 without compute support.

Common situations: Using ComputeShader for GPU compute (e.g. skinning, particles, simulation) in a browser session where WebGPU is missing or disabled; Safari/Firefox without WebGPU enabled; CI headless browsers defaulting to WebGL.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/337f6654f8ec87c9. Report an issue: GitHub.