# Initialising webgpu engine causes errors

**URL:** <https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562>\
**Category:** Questions\
**Created:** [August 5, 2024, 1:08pm UTC](https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562 "2024-08-05T13:08:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baktrian](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/baktrian/32/29646_2.png) [@Baktrian](https://forum.babylonjs.com/u/Baktrian)\
**Post date:** [August 5, 2024, 1:08pm UTC](https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562/1 "2024-08-05T13:08:25Z")

</div>

```auto
BJS - [13:40:54]: Babylon.js v7.18.0 - WebGPU1 engine
chunk-SFU3E6AJ.js?v=e92887a0:47472 Uncaught TypeError: Cannot read properties of undefined (reading 'enabled')
    at get snapshotRendering (chunk-SFU3E6AJ.js?v=e92887a0:47472:40)
    at _WebGPUEngine.setSize (chunk-SFU3E6AJ.js?v=e92887a0:48232:18)
    at ResizeObserver.<anonymous> (Portal.tsx:94:44)
get snapshotRendering @ chunk-SFU3E6AJ.js?v=e92887a0:47472
setSize @ chunk-SFU3E6AJ.js?v=e92887a0:48232
(anonymous) @ Portal.tsx:94
Show 2 more frames
Show less
chunk-MZR46QHU.js?v=e92887a0:9766 BJS - [13:41:34]: A fatal error occurred during WebGPU creation/initialization.
_LogEnabled @ chunk-MZR46QHU.js?v=e92887a0:9766
(anonymous) @ chunk-SFU3E6AJ.js?v=e92887a0:47863
Show 2 more frames
Show less
chunk-SFU3E6AJ.js?v=e92887a0:47881 Uncaught (in promise) TypeError: self.glslang is not a function
    at chunk-SFU3E6AJ.js?v=e92887a0:47881:25
    at async Engine.createRenderer (Engine.ts:347:9)

```

here is my webgpu init code:

```auto
    private async createRenderer() {
        console.log('creating engine')
        WebGPUTintWASM.ShowWGSLShaderCode = true;
        const webGPUSupported = navigator.gpu;
        console.log(webGPUSupported);
        if(!webGPUSupported) return;
        this.core = new WebGPUEngine(this.container);
        await this.core.initAsync();
        this.createScene();
        this.createRenderingPipeline();
        this.cameras.setup(); 
    }

```

I can create an example github project but theres not really much special code here, just using yarn to install babylonjs via @babylonjs/core

and importing WebGPUEngine from @babylonjs/core

Right now I cant find a working example of the webgpu engine through a standard project, it works in the playground but that i cant see the initialisation code.

Thanks

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [August 5, 2024, 1:12pm UTC](https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562/2 "2024-08-05T13:12:39Z")

</div>

Here is the example of WebGPU engine initialization - [babylonjs-webpack-es6/src/index.ts at master · RaananW/babylonjs-webpack-es6 · GitHub](https://github.com/RaananW/babylonjs-webpack-es6/blob/master/src/index.ts#L16)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 5, 2024, 3:45pm UTC](https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562/3 "2024-08-05T15:45:56Z")

</div>

A repro would be great as I do not see how it fails as it looks like it should be protected in the code.

---

<div class="post-metadata">

**Author:** ![Baktrian](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/baktrian/32/29646_2.png) [@Baktrian](https://forum.babylonjs.com/u/Baktrian)\
**Post date:** [August 8, 2024, 3:59pm UTC](https://forum.babylonjs.com/t/initialising-webgpu-engine-causes-errors/52562/4 "2024-08-08T15:59:06Z")

</div>

I have made progress on this but still see the error from time to time on specific types of scenes. I am now creating a repo with all the nda stuff taken out and just the basic project and webgpu to show you guys the error.

I will post that now
