Fatal render error, only on 1 device afaik

TypeError: this._gl.vertexAttribDivisor is not a function
  at t.e._bindVertexBuffersAttributes
  at t.e.recordVertexArrayObject
  at e._bind at at e.render
  at e.renderUnsorted
  at e.render
  at e.render
  at t._renderForCamera

renderer: ARM Mali-400 MP WebGL 1.0 (OpenGL ES 2.0 Chromium)
userAgent: Mozilla/5.0 (Linux; Android 11; Note_4CAM) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36

It is consistently happening for this device (I don’t own it, so can’t test)
I have no clue yet what triggers it, but there is a few minutes of rendering going on before it crashes.

Seems like this is a WebGL 2 function used on a WebGL 1 renderer (which I don’t force). When I force WebGL 1.0 locally everything works fine. Also I don’t see any problems for IPhone players.

this is on beta 11, but this device has never been used before, so no telling if this is a new issue.

Yeah Mali drivers are terrible
Try to turn off webgl2, that should fix it

1 Like

I tried it, but the result seems to be the same. I guess there is nothing we can do about this?

for reference: I added a deeplink to the site which can be used to disable webgl2: https://tuggowar.io/webgl1, I think that works.

I’ve dealt with this before with embedded devices that had Mali drivers… The drivers are broken in so many strange ways that you don’t have many choices except to design code that dances around the numerous issues. It’s not something you would want to support in a library since the behavior is non-standard.

Should count yourself lucky that the entire operating system kernel didn’t crash (happened to me frequently).

1 Like

I can live with this problem for sure, but I’m still curious how it could possibly be that Babylon calls a webgl2 function when we’re in webgl1 mode :woozy_face:

this would be automatically redirected by the engine creation:

if (instanceExtension != null) {
                this._caps.instancedArrays = true;
                this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);
                this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);
                this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);
            } else {
                this._caps.instancedArrays = false;
            }

So it looks like you would not support the instanceExtension and some of the code still calls into it. Are you using Particles, Sprites, EdgesRenderer, Sprites or instances in your app ?

I will find a fix ASAP :slight_smile:

yes, lots of instances.
I’m not sure what the instanceExtension is, but keep in mind that for 999/1000 players everything works great :slight_smile:

My guess is instances are not supported on this device. Could you check what the value of engine.getCaps().instancedArrays is ?

I don’t have access to the device unfortunately. But I think you’re right.
I think you need to pretty good GPU to play tuggowar without instances, so it wouldn’t help much to have a workaround for such a device. I guess a ‘this device is not supported’ will have to do.