{"record":{"id":"337f6654f8ec87c9","repo":"BabylonJS/Babylon.js","slug":"computedispatch-this-engine-does-not-support-comp","errorCode":null,"errorMessage":"computeDispatch: This engine does not support compute shaders!","messagePattern":"computeDispatch: This engine does not support compute shaders!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Engines/Extensions/engine.computeShader.pure.ts","lineNumber":100,"sourceCode":"\r\n    ThinEngine.prototype.createComputePipelineContext = function (): IComputePipelineContext {\r\n        throw new Error(\"createComputePipelineContext: This engine does not support compute shaders!\");\r\n    };\r\n\r\n    ThinEngine.prototype.createComputeContext = function (): IComputeContext | undefined {\r\n        return undefined;\r\n    };\r\n\r\n    ThinEngine.prototype.computeDispatch = function (\r\n        effect: ComputeEffect,\r\n        context: IComputeContext,\r\n        bindings: ComputeBindingList,\r\n        x: number,\r\n        y?: number,\r\n        z?: number,\r\n        bindingsMapping?: ComputeBindingMapping\r\n    ): void {\r\n        throw new Error(\"computeDispatch: This engine does not support compute shaders!\");\r\n    };\r\n\r\n    ThinEngine.prototype.computeDispatchIndirect = function (\r\n        effect: ComputeEffect,\r\n        context: IComputeContext,\r\n        bindings: ComputeBindingList,\r\n        buffer: DataBuffer,\r\n        offset?: number,\r\n        bindingsMapping?: ComputeBindingMapping\r\n    ): void {\r\n        throw new Error(\"computeDispatchIndirect: This engine does not support compute shaders!\");\r\n    };\r\n\r\n    ThinEngine.prototype.areAllComputeEffectsReady = function (): boolean {\r\n        return true;\r\n    };\r\n\r\n    ThinEngine.prototype.releaseComputeEffects = function (): void {};\r","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Engines/Extensions/engine.computeShader.pure.ts#L82-L118","documentation":"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.","triggerScenarios":"Calling engine.computeDispatch(effect, context, bindings, x, y, z) — directly or through ComputeShader.dispatch() — while the underlying engine is WebGL1/WebGL2 without compute support.","commonSituations":"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.","solutions":["Ensure the app runs on WebGPU (feature-detect navigator.gpu and surface a clear message when absent).","Feature-check before dispatch: if (!engine.isWebGPU) use a fallback implementation.","Catch the error around dispatch and switch to a CPU or fragment-shader fallback path.","Use EngineFactory.CreateAsync which negotiates WebGPU first instead of constructing ThinEngine/Engine directly."],"exampleFix":"// before\ncomputeShader.dispatch(64, 1, 1);\n// after\nif (engine.isWebGPU) {\n    computeShader.dispatch(64, 1, 1);\n} else {\n    runFallbackOnCpu();\n}","handlingStrategy":"try-catch","validationCode":"if (!engine.isWebGPU) {\n    throw new Error('computeDispatch requires WebGPU');\n}","typeGuard":"function canDispatch(e: AbstractEngine): boolean {\n    return (e as any).isWebGPU === true || e._features?.supportComputeShaders === true;\n}","tryCatchPattern":"try {\n    computeShader.dispatch(x, y, z);\n} catch (e) {\n    if (String((e as Error).message).includes('computeDispatch')) {\n        runCpuFallback();\n    } else { throw e; }\n}","preventionTips":["Check engine capabilities before creating any ComputeShader","Provide CPU or fragment-shader fallbacks for simulations","Detect WebGPU at startup and inform users when unavailable","Do not rely on areAllComputeEffectsReady() — it returns true even on non-compute engines"],"tags":["webgpu","compute-shaders","dispatch","engine-capability"],"backgroundTag":"compute-shaders-not-supported","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}