Inconsistent shader crash without any error message with WebGLMultisampleRenderTarget


I’m maintaining an add-on that adds 3D dice in a virtual tabletop to play roleplaying games.
The addon is called “Dice So Nice” ( Simone Ricciardi / FoundryVTT Dice So Nice · GitLab ).
It is used by approximately 100k users monthly so usually when something goes wrong, I have a lot of user feedback.

Since my latest release 3 weeks ago, only 4 different people are experiencing a WebGL crash on Chrome and Edge with a shader error that does not say anything about what happened.

They all have the same shader error but as you can see, it says “Shader Error 0 - VALIDATE_STATUS false” and nothing is printed under “VERTEX” or “FRAGMENT” to explain the error.

One of them is on Linux with Intel GPU and crash immediately, the others are on Windows with NVIDIA GPU (GTX 970/980) and only crash after using the addon for a while.

I changed multiple things in the latest version, mainly:

  • Upgraded to rev136
  • Added a post-processing render with a WebGLMultisampleRenderTarget when I detect a webgl2 context for anti-aliasing.
  • Added some custom shader modification with onBeforeCompile to Standard and Physical materials

I was able to find the cause for the linux/intel GPU user: their GPU was not able to use WebGLMultisampleRenderTarget . When I sent them this page, they immediately had a context loss: three.js WebGL 2 - Multisampled Renderbuffers
However, the same page worked on Firefox for them.

For the other users on Windows tho, this page works.

I’m looking for ideas in order to debug this:

  • If I can’t be sure that WebGLMultisampleRenderTarget works even if the browser is able to create a webgl2 context, could I check for something else to use a fallback to a SMAA pass?

  • Any idea why this issue could happen? Is there some limitation to WebGLMultisampleRenderTarget that I’m not aware of? Like a maximum number of WebGLMultisampleRenderTarget associated with improper memory management?

  • Should I report this issue to the github? I’m not sure what could be done, if it is a threejs issue or a browser issue or something else

Thank you!