BabylonJS/Babylon.js · error

createComputeEffect: This engine does not support compute sh

Error message

createComputeEffect: This engine does not support compute shaders!

What it means

BabylonJS registers stub compute-shader methods on ThinEngine for engines that lack compute support (WebGL1/WebGL2 without WebGPU). Calling engine.createComputeEffect() on such an engine hits this stub, which throws immediately. Compute effects are only really implemented on WebGPU (and Native) engines.

Source

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

    InternalTexture = 8,
}

/** @internal */
export type ComputeBindingList = { [key: string]: { type: ComputeBindingType; object: any; indexInGroupEntries?: number } };

let _Registered = false;
/**
 * Register side effects for enginesExtensionsEngineComputeShader.
 * Safe to call multiple times; only the first call has an effect.
 */
export function RegisterEnginesExtensionsEngineComputeShader(): void {
    if (_Registered) {
        return;
    }
    _Registered = true;

    ThinEngine.prototype.createComputeEffect = function (baseName: IComputeShaderPath & { computeToken?: string }, options: IComputeEffectCreationOptions): ComputeEffect {
        throw new Error("createComputeEffect: This engine does not support compute shaders!");
    };

    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

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Run the app with a WebGPU-capable engine (navigator.gpu available) or force WebGPU via EngineFactory.CreateAsync(engineType: 'webgpu').
  2. Check engine.isWebGPU / engine._features.supportComputeShaders before creating compute effects and branch to a non-compute path.
  3. Wrap compute initialization in try/catch and fall back to a fragment-shader or CPU implementation.
  4. Update BabylonJS packages so the WebGPU compute extension registration is included in the bundle.

Example fix

// before
const effect = engine.createComputeEffect({ computeSource: '...' }, {});
// after
if (engine.isWebGPU) {
    const effect = engine.createComputeEffect({ computeSource: '...' }, {});
} else {
    // fallback path without compute shaders
}
Defensive patterns

Strategy: fallback

Validate before calling

if (!('gpu' in navigator) || !engine.isWebGPU) {
    throw new Error('Compute shaders require a WebGPU engine');
}

Type guard

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

Try / catch

try {
    const effect = engine.createComputeEffect({ computeSource }, options);
} catch (e) {
    if (e instanceof Error && e.message.includes('does not support compute shaders')) {
        useNonComputeFallback();
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling engine.createComputeEffect() (directly or via ComputeShader / GPU particle helpers) on a ThinEngine/Engine derived from WebGL rather than a WebGPU engine, i.e. when the full WebGPU compute extension was not registered on this engine.

Common situations: Running a compute-based feature (ComputeShader, compute GPU particles) while the page falls back to WebGL because WebGPU is unavailable; forcing engineType to WebGL in EngineFactory; calling compute APIs on a raw ThinEngine in tests or headless environments.

Related errors


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