three.js: Safari v15 (on desktop) -> threejs bug

As of Safari 15 (Desktop) something having to do with OpenGL causes a total browser failure.

(Sorry I don’t have better information, feel free to delete this and create a more helpful ticket once more info becomes available)

A problem repeatedly occurred with “site url” [ reload webpage button ]

notes:

  • Mobile safari v15 works fine.
  • Chrome / Firefox browsers appear unaffected by whatever this is.

Live examples

Steps to reproduce the behavior:

  1. visit one of the following official three js showcase websites in safari v15 on OSX

Screenshots Screen Shot 2021-09-24 at 11 22 04 AM

Platform:

  • Device: [Desktop]
  • OS: [MacOS]
  • Browser: [Safari]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16 (4 by maintainers)

Most upvoted comments

I found that enabling Develop > Experimental Features > GPU Process: WebGL in Safari 15 fixes the error. Why it’s not enabled by default is a whole separate question, but I’m hoping this will get fixed by Apple soon. webgl-flag

@mrdoob I feel like dad just told me to go ask my mother. ;P Just filed the report, thanks!

One more update here. With GPU Process: WebGL turned off in Safari 15, and updating my project’s three version to "0.132.2" (from "0.112.1") the error is fixed for me.

Better to report this to Apple directly: https://webkit.org/reporting-bugs/

@dustinkerstein For those why may be looking for a quick code-based workaround to avoid needing to upgrade threejs version, this worked for me…

In WebGLRenderer constructor:

  1. Remove xrCompatible from contextAttributes
  2. Attempt to create context with _canvas.getContext( 'webgl2', contextAttributes ) and only if unsuccessful, fallback to _canvas.getContext( 'webgl', contextAttributes ) because the webgl2 version should succeed on Safari Desktop which avoids hitting the second call which is where the crash occurs (in my old version 110 of threejs)

@willmorgan We just can’t do anything about it. This is a regression in Safari.

Hi @willmorgan, didn’t expect to meet you here 😄 Yes, on the Treevee project 😄

I have figured it out now:

I had a separate bug in a shader that apparently also managed to make Safari crash the entire tab. Have not investigated it fully yet, only rolled back that shader change.

@walpolea That fixes the error. What also fixes the error for me is enabling Develop > Experimental Features > WebGL via Metal

And somewhat unfortunately once you enable/disable that feature, I am no longer able to replicate the issue, even after restarting Safari. Luckily I have Safari Technical Preview installed so I can continue looking for a workaround for my production site. Has anyone found a viable code-based workaround? I’m on Three.js version 108.

@willmorgan I actually just posted it to the apple developers bug reporting page. You posting it directly to the webkit project was a much better idea.

Webkit team has this issue fixed internally and it will ship in upcoming releases.

@walpolea Rollback to r112 really helped. All the anomalies brought by Safari on iOS 15 have disappeared. Thanks.