BabylonJS/Babylon.js · error

computeDispatchIndirect: This engine does not support comput

Error message

computeDispatchIndirect: This engine does not support compute shaders!

What it means

ThinEngine.prototype.computeDispatchIndirect is another always-throwing stub installed on engines without compute shader support. Indirect dispatch (reading dispatch dimensions from a GPU buffer) is a WebGPU-only capability, so calling it on a WebGL engine throws this error. Note areAllComputeEffectsReady still returns true on such engines, so readiness checks will not stop you.

Source

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

        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 {};

    ThinEngine.prototype._prepareComputePipelineContext = function (
        pipelineContext: IComputePipelineContext,
        computeSourceCode: string,
        rawComputeSourceCode: string,
        defines: Nullable<string>,
        entryPoint: string
    ): void {};

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

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Run on a WebGPU engine; feature-detect navigator.gpu before initializing compute code paths.
  2. Gate indirect dispatch behind engine.isWebGPU (or engine._features.supportComputeShaders) and provide a standard computeDispatch or CPU fallback otherwise.
  3. Try/catch around the dispatch call to degrade gracefully.
  4. Document the WebGPU requirement so users do not load the compute path in WebGL-only environments.

Example fix

// before
computeShader.dispatchIndirect(argsBuffer, 0);
// after
if (engine.isWebGPU) {
    computeShader.dispatchIndirect(argsBuffer, 0);
} else {
    computeShader.dispatch(workgroupsX, 1, 1); // or CPU fallback
}
Defensive patterns

Strategy: fallback

Validate before calling

if (!('gpu' in navigator)) {
    throw new Error('Indirect dispatch requires WebGPU');
}

Type guard

function supportsIndirectDispatch(e: AbstractEngine): boolean {
    return (e as any).isWebGPU === true;
}

Try / catch

try {
    computeShader.dispatchIndirect(argsBuffer, 0);
} catch (e) {
    if (String((e as Error).message).includes('computeDispatchIndirect')) {
        computeShader.dispatch(cpuWorkgroupsX, 1, 1);
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling engine.computeDispatchIndirect(effect, context, bindings, buffer, offset) — or ComputeShader.dispatchIndirect — on a WebGL-based engine lacking compute support.

Common situations: GPUs-driven simulations or culling code using indirect dispatch running under WebGL fallback; porting a WebGPU-only sample to a machine/browser without WebGPU; headless CI without --enable-unsafe-webgpu.

Related errors


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