"A problem repeatedly occurred" in Safari when shadow map size too big

Anyone else ever experience a very annoying iPhone Safari error like the following without any output showing up in the devtools console?

I found that this happens if I set a PointLight’s .mapSize.width and .mapSize.height too big (4096x4096). Then the app just crashes with nothing but this totally useless error on the screen, the console empty.

Wish Safari threw a catchable error rather than just crashing the tab.

I dont know if i have the same problem but i geht the same error in IOS without output in the console.

What is too big in integer?

@fleixi I updated above to include the numbers. In my case 4096x4096 was too big, so I downsized to 2048x2048.

this error comes from too much vram usage on iphones. some iphones may accept 4k textures, but as you’ve experienced some don’t, so i’d recommend sticking to 2k.

1 Like

@alex-shortt Thanks. I wonder if there’s a way to detect the error rather than, for example, setting a lower size depending on navigator.platform which is what my current workaround is for iPhone.

afaik safari’s behavior is to just crash if the vram reaches some threshold. but that threshold is different per device and, since the memory is shared between cpu/gpu, can be different depending on other processes running on the phone.

besides the edge case of 4k textures, all you can do is try to lower memory usage by using smaller textures or compressing them with ktx

The problem is though, how do we detect the crash at runtime, so that we can adjust accordingly (instead of using User Agent sniffing)? This isn’t clear because the whole Safari tab simply crashes with nothing in the console.