Cube texture, shader material errors

Constructing a material that uses a cube texture and a regular 2d texture, if the regular texture is not set results in errors for some browsers:

  • In Chromium the error GL_INVALID_OPERATION: Two textures of different types use the same sampler location is produced, and the material is not displayed.
  • In Safari the material is not displayed, but no errors are produced (silently fails).
  • In Firefox, it works as expected.

All browsers work as expected if the texture is set, or if two regular textures are used (i.e. one isn’t a cube texture.

Working pg (texture is set): Babylon.js Playground
Not working pg (except in Firefox): https://playground.babylonjs.com/#29NKQZ#1

This might be a browser bug, as I’d expect the usual behaviour for unbound textures (reads 0,0,0,1) to apply in this case too, across all browsers.

Yes, I don’t think we can do anything about this, we don’t check that all inputs are provided to shaders (for performance sake): it’s up to the user to ensure all bindings are provided.

In WebGPU you will also get an error that a texture has not been bound.

Strangely I’m also getting this bug and I dont understand how it works in Firefox but not Chrome