# There is a WebGPU sample that doesn't work with Babylon.js 6.0

**URL:** <https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035>\
**Category:** Bugs\
**Created:** [April 20, 2023, 4:32pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035 "2023-04-20T16:32:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cx20](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cx20/32/46_2.png) [@cx20](https://forum.babylonjs.com/u/cx20)\
**Post date:** [April 20, 2023, 4:32pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/1 "2023-04-20T16:32:45Z")

</div>

I tried some of the samples found in the official docs.  
Some WebGPU samples don’t seem to work on Chrome 113(beta).

> **[WebGPU Breaking Changes | Babylon.js Documentation](https://doc.babylonjs.com/setup/support/webGPU/webGPUBreakingChanges)**
>
> Detail the breaking changes and differences in behaviour with WebGL

> **[Babylon.js Playground](https://playground.babylonjs.com/#U1CZV3%234)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

```auto
BJS - [01:28:21]: Babylon.js v6.0.0 - WebGPU1 engine
Vertex buffer arrayStride (3) is not a multiple of 4.
 - While validating buffers[0].
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor "RenderPipeline_bgra8unorm_depth24plus-stencil8_samples4"]).

```

---

<div class="post-metadata">

**Author:** ![cx20](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cx20/32/46_2.png) [@cx20](https://forum.babylonjs.com/u/cx20)\
**Post date:** [April 20, 2023, 4:42pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/2 "2023-04-20T16:42:01Z")

</div>

Oops. It looks like my misunderstanding. It seems correct(!?) that this sample does not work.

> **[WebGPU Breaking Changes | Babylon.js Documentation](https://doc.babylonjs.com/setup/support/webGPU/webGPUBreakingChanges#miscellaneous)**
>
> Detail the breaking changes and differences in behaviour with WebGL

> Try this PG, which works in WebGL but not in WebGPU:

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 20, 2023, 5:03pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/3 "2023-04-20T17:03:12Z")

</div>

Yes, it’s expected to fail in WebGPU as stride can’t be less than 4.

---

<div class="post-metadata">

**Author:** ![cx20](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cx20/32/46_2.png) [@cx20](https://forum.babylonjs.com/u/cx20)\
**Post date:** [April 20, 2023, 5:07pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/4 "2023-04-20T17:07:19Z")

</div>

Thank you for teaching me.

I think it’s another problem, but the Babylon.js + WGSL sample below causes an error. Any advice? (It could also be my bug.)

This sample expects a textured cube to be displayed.  
[https://cx20.github.io/webgpu-test/examples/babylonjs\_wgsl/texture/index.html](https://cx20.github.io/webgpu-test/examples/babylonjs_wgsl/texture/index.html)

```auto
Tint WGSL reader failure: :41:1 error: unresolved identifier 'vUV'
vUV = uv;
^^^

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

```

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 20, 2023, 5:42pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/5 "2023-04-20T17:42:13Z")

</div>

The syntax has changed to access some predefined data, see [Writing shaders for WebGPU in WGSL | Babylon.js Documentation](https://doc.babylonjs.com/setup/support/webGPU/webGPUWGSL#special-syntax-used-in-wgsl-code) for details (we had to make this change because of a change in the specification, but I think the new way of accessing data is better anyway).

I also just created a PR in the documentation to correct this:

```plaintext
@vertex
fn main(input : VertexInputs) -> FragmentInputs {
    gl_Position = scene.viewProjection * mesh.world * vec4<f32>(position, 1.0);
}

```

into that:

```plaintext
@vertex
fn main(input : VertexInputs) -> FragmentInputs {
    vertexOutputs.position = scene.viewProjection * mesh.world * vec4<f32>(vertexInputs.position, 1.0);
}

```

---

<div class="post-metadata">

**Author:** ![cx20](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cx20/32/46_2.png) [@cx20](https://forum.babylonjs.com/u/cx20)\
**Post date:** [April 20, 2023, 6:09pm UTC](https://forum.babylonjs.com/t/there-is-a-webgpu-sample-that-doesnt-work-with-babylon-js-6-0/40035/6 "2023-04-20T18:09:05Z")

</div>

Thanks to your advice, I realized that there was a correction mistake.  
The sample now works.
