phetsims / density-buoyancy-common

Common code for the Density and Buoyancy simulations
GNU General Public License v3.0
0 stars 2 forks source link

iPad: WebGL support #316

Open samreid opened 1 month ago

samreid commented 1 month ago

In Faraday's Electromagnetic lab, mobile safari WebGL had to be disabled to prevent crashing, see https://github.com/phetsims/faradays-electromagnetic-lab/issues/182#issuecomment-2168713207

In Gas Properties, the same thing happened, see https://github.com/phetsims/gas-properties/issues/289#issuecomment-2246277100.

Today I observed that neither unbuilt nor built buoyancy launched on the iPhone 15 Pro Max, see https://github.com/phetsims/density-buoyancy-common/issues/315

@KatieWoe also identified rendering issues on the iPad, which is puzzling--since it means it must have run on iPad at least a bit. https://github.com/phetsims/density-buoyancy-common/issues/230

@arouinfar can you please advise?

samreid commented 1 week ago

The aliasing is leaving some white dot crumbs in the earth in my latest launch on iPad 7:

image
zepumph commented 1 week ago

zip test: charges-and-fields_en_phet.zip

zepumph commented 1 week ago

The above doesn't work to give files to an iPad/iPhone. So instead we are hosting three built versions here:

https://sparky.colorado.edu/dev/dbc-webgl-test/

@samreid will make a QA issue to see if they can get a crash.

zepumph commented 1 week ago

Similar to https://github.com/phetsims/density-buoyancy-common/issues/316#issuecomment-2331769454, we feel like the pixelRatio and aliasing are appropriate workarounds given how close we are to RC. Let's not eagerly go down the road of using a single renderer for all screens. If we need to investigate later, then we can. We'll wait to see how QA goes.

samreid commented 1 week ago

@Nancy-Salpepi can you please test the links in [redacted link] to see how they do on iOS devices? We disabled antialiasing and the pixelRatio to save on memory, and it is working much better on iPad 7 and iPhone 15 Pro Max. An initial crash + reload on startup may be ok--we hypothesize this is clearing out some hidden memory. Can you run some fuzzing tests and some manual tests for those links on your iOS devices and let us know how it is going? If it is crashy, we have some new query parameters we can share with you to experiment with.

UPDATE: Please start with buoyancy as a worst-case-scenario (for memory). If that is OK, then density and buoyancy-basics can be quicker spot checks. Also note we have seen a little bit of rendering aliasing and "crumbs" due to the aliasing and pixel ratio changes.

Nancy-Salpepi commented 1 week ago

Here is what I saw so far:

For the iPad (9th generation):

For iPhone 12 Pro:

@samreid I'm in a meeting right now but if you want to give me the query parameters I can test with those later.

samreid commented 1 week ago

Thanks! Can you visit https://johankj.github.io/devicePixelRatio/ on each of those devices and report its device pixel density? My iPad 7 is a 2 and my iPhone 15 Pro Max is a 3.

Also for future fuzz/crash testing, I forgot to mention we added ?launchCounter. That counts the number of launches (including auto-relaunches from a crash) so that if it auto-reloads and you don't happen to see it, it can still be counted.

samreid commented 1 week ago

@Nancy-Salpepi thanks. Can you also run the failing tests with ?threeRendererPixelRatio=1? It will look blurry but we want to see how crashy it is.

Nancy-Salpepi commented 1 week ago

Device Pixel Density: iPad 9th gen: 2 iPhone 12 Pro: 3

Nancy-Salpepi commented 1 week ago

using ?threeRendererPixelRatio=1&launchCounter&fuzz:

On my iPhone, with ?threeRendererPixelRatio=1: -going to the shapes screen, selecting the duck and then taking a screenshot still produced a crash

Wondering if crashes would still happen without screenshots on? @samreid you said something about possibly shutting them off during fuzzing?

samreid commented 1 week ago

Screenshots are now shut off (do not appear in phet menu) during fuzzing (including in the recent test above). I'm not sure how to proceed here but will discuss with my subteam on Monday morning. Thanks for all the great testing!

samreid commented 1 week ago

I'm able to take screenshots of the duck on iPhone 15 Pro Max using the buoyancy link on sparky.

samreid commented 1 week ago

We reduced the pixel ratio for iOS, and would like QA to verify in RC. Please test that iPad and iPhones graphics look reasonable and run a reasonable amount of time before crashing. (Initial crash on startup is ok.)