Am I just going to use the method and not pay particular attention to webgl versus webgpu
labris
April 17, 2023, 4:39am
2
It is compatible if you tell to Babylon what to use and check if it is possible to use webGPU (currently, before version 113, it is possible only with beta version of Chrome which needs to be installed separately).
You may have a look how it is done here
// get the module to load
const moduleName = getModuleToLoad();
const createSceneModule = await getSceneModuleWithName(moduleName);
const engineType =
location.search.split("engine=")[1]?.split("&")[0] || "webgl";
// Execute the pretasks, if defined
await Promise.all(createSceneModule.preTasks || []);
// Get the canvas element
const canvas = document.getElementById("renderCanvas") as HTMLCanvasElement;
// Generate the BABYLON 3D engine
let engine: Engine;
if (engineType === "webgpu") {
const webGPUSupported = await WebGPUEngine.IsSupportedAsync;
if (webGPUSupported) {
const webgpu = engine = new WebGPUEngine(canvas, {
adaptToDeviceRatio: true,
antialias: true,
});
await webgpu.initAsync();
engine = webgpu;
} else {