Babylon 4.2 enabling spotlight gives webgl uniform error

I’ve been chasing a console error today and tracked it down to the enabling of a spotlight I’m using as a cursor on a ground plane.

[.WebGL-000014C400217600] GL_INVALID_OPERATION: It is undefined behaviour to use a uniform buffer that is too small.

If instead I just set the intensity to 0 and 20 instead of enabling / disabling it, I can prevent the error, but wouldn’t it be better to disable it when it’s not shown in the scene?

Any idea which uniforms I should be looking at? I’m worried at how long / how much code I’d have to move over to playground to provide a reproducible example, so I’m just looking for ideas on things to look at.

That will be hard to help on this one, as we don’t do fixes of older Babylon versions.

Have you tried with 5.0? I know we fixed some “It is undefined behaviour to use a uniform buffer that is too small” warnings, but I don’t remember if it applies to spotlights or not…

Note also that if you get this warning only a single time (or a small number of times - meaning, the number of logs in the console log does not rise infinitely - or at least does not reach 250, which is I think the limit after which the browser stops logging an error), it is ok, it means the problem is only transient and your program is fine.

I’ve had problems in the past with Safari and those warnings causing things to just stop working at all, so I’m hesitant. It seems like I only log 4 of them so maybe I can ignore it.

Will test on 5.0 but I’m not sure I can update to that in a timely manner.

1 Like