Random webGL error

so in our app, sometimes we get WebGL: INVALID_OPERATION: uniform1i: location not for current program.
It happens:

  • seemingly randomly, roughly 1 out of 20 times I open the app
  • only during initialization (when I open the app)

Does anyone have some tips on how to isolate this issue, or even better - how to resolve it? I can’t reproduce it reliably, so it’s really hard to fix.

Note: we have a material that extends the PBRCustomMaterial and the problem is probably somewhere there.

Any tips appreciated.

That’s very hard to tell without a repro.

Are you using scene.executeWhenReady before starting the real work? Maybe it can help making sure everything is in order before going on.

Note that uniform1i is used to set a INT uniform, so if your custom shader is using an INT as an uniform the problem probably comes from it (but I’m not able to tell how it can happen…).