playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.32k stars 1.32k forks source link

dAmbientLight' : undeclared identifier on Safari #4030

Open yaustar opened 2 years ago

yaustar commented 2 years ago

Forum thread: https://forum.playcanvas.com/t/web-gl-error-on-safari/24268

Hey all, I get this error on Safari when using light mapping on imported models:

WebGL: ERROR: 0:438: 'dAmbientLight' : undeclared identifier

To reproduce I used the model viewer template, imported my model, deleted the PlayCanvas cube, placed my template in the scene, and then turned on light mapping on the imported model. This model does have UV1’s. Here is the project: https://playcanvas.com/project/880175/overview/ambientlighterror 3

I have been working on a project for quite a while with this error looming. It doesn’t seem to affect the scene in any way, I just always get the error in the console. I get the same error from using a default cube and checking on light mapping instead of using an imported model. I cannot reproduce this error on Chrome. Thoughts?

yaustar commented 2 years ago

Callstack

image
slimbuck commented 2 years ago

I did a little digging on this one. The lightmapper is creating a shader that contains the compile error, but this shader is not used (so results are fine). Safari attempts to compile the shader and so generating the error, where Chrome does not compile it and so we see no error.

I was left wondering:

  1. why is a shader being created, but not used (in this case)?
  2. under what circumstances will the erroneous shader be used?
  3. obviously wondering what the underlying issue is
yaustar commented 1 year ago

Is this still an issue?