WebGPU instancing does not render

I downloaded the latest chrome canari and enabled webgpu in the about::flags
I wanted to test the instancing performance using a existing playground.

In webgl it renders fine, but in webgpu it just renders a blue screen

Canari version:
Version 105.0.5137.2 (Official Build) canary (64-bit)

ping @Evgeni_Popov @sebavan

@Evgeni_Popov is it a known limitation ?

It is not a problem with WebGPU, it is working in WebGL because of a side effect: the parallel compilation of shaders let some time before the scene is ready, so scene.freezeActiveMeshes(true) is postponed a bit (because this function is using scene.executeWhenReady internally) and for some reason it makes it work.

Honestly, I think it’s a bug in WebGL. In frozen mode, the vertex buffers should not be updated as there’s this bug:

if (!this._instanceDataStorage.isFrozen) {
    instancesBuffer!.updateDirectly(instanceStorage.instancesData, 0, instancesCount);
    if (this._scene.needsPreviousWorldMatrices && (!this._instanceDataStorage.manualUpdate || this._instanceDataStorage.previousManualUpdate)) {
        instancesPreviousBuffer!.updateDirectly(instanceStorage.instancesPreviousData, 0, instancesCount);
    }
}

But because of the delay the master mesh is not flagged as frozen.

If you disable parallel shader compilation, it is not working in WebGL neither:

I think we should add a method to perform the updateDirectly calls on the matrix buffer so that the user can update the matrices even in frozen mode.

1 Like