Hello there
Working on a project for a client, I struggled like hell with an issue with iOS devices. (I remember by the way I already saw @RaananW writting : “Apple…” here on the forum ^^)
Here is the bug : my app would run smooth, but on iOS after a reload (or 2 or 3, depends on the device), it would crash with an WebGL context lost
error, and then nothing to do but relaunching the browser, either Safari or Chrome does this.
I was going crazy trying to find the source of the error
After hours of debugging, I came accross the solution here :
@Matteo_FF had the exact same issue, and “solved” it by getting rid of HDR texture. (Thanks for the solution by the way ).
That said, I think avoiding the use of the broken feature is not a fix, and that’s why I’m opening this issue.
A few details about this report :
- I could not do tons of tests since I have no Apple hardware myself, I only have limited access to browserstack where I test my code remotely on real hardware. (not emulators)
- The bug is (at least) triggering on all iOS devices I have tested so far, I.E. iPhone 13, iPhone15, iPad 5th gen, iPad 9th gen.
- The title of this topic is pointing out GPU memory leak, also I’m not 100% sure it’s the issue, I just know by experience that this WebGL context loss, might be VRAM issue, because considering it’s after a reload, it should not be browser related, or driver related… But I might be wrong on that.
- Here is a PG to reproduce. Depending on the iOS device, it would anyway crash after some reloads, at some point.
- I happened to find a fix by avoiding the use of mipmap and harmonics generation. So, replacing this line :
scene.environmentTexture = new BABYLON.HDRCubeTexture(url, scene, 1024, false, true, false, true);
By this :
scene.environmentTexture = new BABYLON.HDRCubeTexture(url, scene, 1024, true, false, false, true);
seems to be fixing the bug, or at least I have no more crashes. So there must be an issue on using these params but could not yet find the time to test if it’s either the one (mipmap) or the other (harmonics) or both combined.