Correct configuration for Babylon WebGPU Electron

I am executing Babylon WebGPU with electron with following npm configuration:-

“electron”: “^18.0.0-alpha.4”,
“electron-builder”: “^23.0.1”,
“electron-nightly”: “^19.0.0-nightly.20220209”,
@babylonjs/core”: “5.0.0-beta.11”,
@babylonjs/materials”: “^5.0.0-beta.11”,

This configuration works good for me on my custom small test webgpu implementation and renders the output.
However, it produces errors on Babylon WebGPU, as given below.

Query: What is the recommended electron and babylon configuration should I use to overcome these errors?

graffiti.js:2 Uncaught TypeError: Failed to execute 'beginRenderPass' on 'GPUCommandEncoder': Failed to read the 'colorAttachments' property from 'GPURenderPassDescriptor': Failed to read the 'loadValue' property from 'GPURenderPassColorAttachment': Failed to read the 'loadValue' property from 'GPURenderPassColorAttachment': Required member is undefined.
    at t._startMainRenderPass (graffiti.js:2:640515)
    at t.clear (graffiti.js:2:616043)
    at t._clear (graffiti.js:2:774901)
    at t._clearFrameBuffer (graffiti.js:2:769522)
    at t.render (graffiti.js:2:778092)
    at GroundScene.render (graffiti.js:2:4041661)
    at GroundScene.render (visualizer-babylon.ts:42:11)
    at graffiti.js:2:655240
    at t._renderFrame (graffiti.js:2:200086)
    at t._renderLoop (graffiti.js:2:200194)

Tint WGSL reader failure:
Parser: 22:3 error: expected identifier for struct member
  @location(0)
  ^

Shader:
var<private> vTex : vec2<f32>;

var<private> gl_VertexIndex : i32;

var<private> gl_Position : vec4<f32>;

fn main_1() {
  var indexable : array<vec2<f32>, 4u>;
  var indexable_1 : array<vec2<f32>, 4u>;
  let x_23 : i32 = gl_VertexIndex;
  indexable = array<vec2<f32>, 4u>(vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0), vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 1.0));
  let x_28 : vec2<f32> = indexable[x_23];
  vTex = x_28;
  let x_41 : i32 = gl_VertexIndex;
  indexable_1 = array<vec2<f32>, 4u>(vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0), vec2<f32>(-1.0, -1.0), vec2<f32>(1.0, -1.0));
  let x_44 : vec2<f32> = indexable_1[x_41];
  gl_Position = vec4<f32>(x_44.x, x_44.y, 0.0, 1.0);
  return;
}

struct main_out {
  @location(0)
  vTex_1 : vec2<f32>;
  @builtin(position)
  gl_Position : vec4<f32>;
}

@stage(vertex)
fn main(@builtin(vertex_index) gl_VertexIndex_param : u32) -> main_out {
  gl_VertexIndex = bitcast<i32>(gl_VertexIndex_param);
  main_1();
  return main_out(vTex, gl_Position);
}


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

graffiti.js:2 BJS - [19:42:02]: WebGPU uncaptured error (1): [object GPUValidationError] - Tint WGSL reader failure:
Parser: 22:3 error: expected identifier for struct member
  @location(0)
  ^

Shader:
var<private> vTex : vec2<f32>;

var<private> gl_VertexIndex : i32;

var<private> gl_Position : vec4<f32>;

fn main_1() {
  var indexable : array<vec2<f32>, 4u>;
  var indexable_1 : array<vec2<f32>, 4u>;
  let x_23 : i32 = gl_VertexIndex;
  indexable = array<vec2<f32>, 4u>(vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0), vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 1.0));
  let x_28 : vec2<f32> = indexable[x_23];
  vTex = x_28;
  let x_41 : i32 = gl_VertexIndex;
  indexable_1 = array<vec2<f32>, 4u>(vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0), vec2<f32>(-1.0, -1.0), vec2<f32>(1.0, -1.0));
  let x_44 : vec2<f32> = indexable_1[x_41];
  gl_Position = vec4<f32>(x_44.x, x_44.y, 0.0, 1.0);
  return;
}

struct main_out {
  @location(0)
  vTex_1 : vec2<f32>;
  @builtin(position)
  gl_Position : vec4<f32>;
}

@stage(vertex)
fn main(@builtin(vertex_index) gl_VertexIndex_param : u32) -> main_out {
  gl_VertexIndex = bitcast<i32>(gl_VertexIndex_param);
  main_1();
  return main_out(vTex, gl_Position);
}


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

What version of chromium does it run? We are adjusted to chrome canary, so some older versions might not work (as the specs adjusted since then).

1 Like

Sure, I have tested it Chrome Canary Version 97.0.4692.99 (Official Build) (x86_64).
Works good for me.