Webgpu init issues

I’m testing WebGPU with Babylon on Electron and running into these issues:

after some browsing the warnings could be due to mime type not being registered in webpackdevserver, but I’m not sure what the file server could have to do with rendering wasm…

Another thing: when I try to test it in regular Chrome (stable or beta) with the chrome://flags/#enable-unsafe-webgpu enabled Babylon still says ‘WebGPU is not supported by your browser’. Am I missing something?

This is not a webgpu issue but an issue within your build where BABYLON namespace was not found (eg it is not referenced from your code somehow)

I thought the error might be solved if the warnings were solved.

this is the only diff between it working and not working

well this is super weird because the system error is about a missing ref to BABYLON

I just resolved my second question: I should have used Chrome Canary and not Chrome Beta.
Now at least I got the playground working in Chrome and it gives the same warnings, so those are not the problem.

1 Like

this is where the error is (while calling engine.initAsync())
(I’m using the latest alpha, and nowhere do I reference BABYLON. directly)

let me add @syntheticmagus

Are you using ES6? We need BABYLON to exist in the global namespace because of some initialization code for the TintWASM module. So, in ES6, you have to do something like:

import * as BABYLON from "@babylon/core";
(window as any).BABYLON = BABYLON;

We will need to get rid of that, but for the time being it’s required.

1 Like

we need to make sure we track the need to get rid of it to not forget :wink:

ah, that is a simple solution. For now that probably means the bundle will contain all of Babylon, but that is manageable.

Not getting any errors anymore, but not seeing any meshes either. Only an all white screen (which is not the clear color) so I have some work to do :slight_smile:.
Thanks for now.

Is there an issue number for this? I’d like to track this one if possible :slightly_smiling_face:

I have created an issue:

1 Like

Probably related. The window babylon was fixed but still seeing the “wrong mime type” error, is this something fixable in the cdn ? or should we host the glslang and twgsl ? is there a package containing those files ? so probably I’ll need a predeploy copy command

Thanks

I have the same error in the console with :

wasm streaming compile failed: TypeError: Failed to execute ‘compile’ on ‘WebAssembly’: Incorrect response MIME type. Expected ‘application/wasm’.

It’s a recent error that I’ve had for maybe 2 or 3 weeks, I don’t really know.

However, I load the physics engine normally :

async loadPhysic(scene) {
        const gravity = new BABYLON.Vector3(0, -12, 0);
        const havokEngine = await HavokPhysics();
        const babylonPhysicPlugin = new BABYLON.HavokPlugin(true, havokEngine);
        scene.enablePhysics(gravity, babylonPhysicPlugin);
    }

in htaccess :

AddType application/wasm .wasm

cc @RaananW
Do we have a server side issue?

Looking into that

Problem was resolved. Also fixed deployment so next nightly will work correctly as well.

3 Likes

haha I love that :smiley: Problem? Yes sir, here is the solution!

1 Like