phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Fix "shader too complex" game crash on high-end Android

Open rpn-ollie-james opened this issue 3 years ago • 4 comments

This PR

  • Fixes a bug

Fixes issue on high end Android devices that handle a lot of textures, ie. 128 Previous code created 128 if statements and WebGL would fail to compile, crashing the game

rpn-ollie-james avatar Aug 29 '22 05:08 rpn-ollie-james

This is exactly how I used to have it (see https://github.com/photonstorm/phaser/commit/c8d3a20754c5769dc475d5ba0f41d94b02f6ad43) - but using this approach utterly tanks performance on iOS15.

So it's likely going to need some hybrid solution or device check that swaps shader at boot time.

Also, I can't merge this (aside from breaking iOS) because it uses ES6 string literals.

photonstorm avatar Aug 29 '22 12:08 photonstorm

Interesting, I will look into adding a device check, unless there's a Phaser 3 standard way of checking for iOS? Although, doing some Googling it seems like they may have fixed the performance issue in iOS 15.4?

And wow, I didn't realise backticks were only ES6, I always code in Typescript :)

rpn-ollie-james avatar Aug 29 '22 18:08 rpn-ollie-james

Have updated with check for OS.iOS and removed use of ES6 string literal

rpn-ollie-james avatar Aug 29 '22 19:08 rpn-ollie-james

Oh, and the package change is a minor version bump because npm said it was a critical security vulnerability and it was a non-breaking change..

rpn-ollie-james avatar Aug 29 '22 19:08 rpn-ollie-james

Thank you for your work on this, but I'm going to close this PR off as the 3.60 Beta 11 completely overhauled the mobile pipeline, and improved performance no end meaning there's no longer a requirement for this approach.

photonstorm avatar Oct 10 '22 13:10 photonstorm