Hello, community!
I noticed that spritesheet animations are broken on ios14 and lower.
Error
BJS - [14:48:21]: Error: FRAGMENT SHADER ERROR: 0:8: Expression of type 'float' - precision can not be inferred and no default precision available
(anonymous function) — logger.ts:103
(anonymous function)
(anonymous function) — effect.ts:919
(anonymous function) — effect.ts:614
(anonymous function) — effect.ts:848
(anonymous function) — effect.ts:439
(anonymous function) — effect.ts:375
(anonymous function) — shaderProcessor.ts:42
(anonymous function) — shaderProcessor.ts:454
(anonymous function) — shaderProcessor.ts:37
C — effect.ts:366
(anonymous function) — effect.ts:401
(anonymous function) — effect.ts:659
e — effect.ts:398
(anonymous function) — thinEngine.ts:2830
e — spriteRenderer.ts:165
e — spriteManager.ts:284
createScene — Script Element 1:15
(anonymous function) — Script Element 1:36
asyncFunctionResume
(anonymous function)
promiseReactionJobWithoutPromise
thinEngine.ts:2875
Tested it using the Xcode simulator and on a real device. It doesn’t seem to be a WebGL version issue. I tried it on ios 16 with WebGL 1 and everything works fine there.
This is the original playground that doesn’t work https://playground.babylonjs.com/#YCY2IL#4
It seems like this line is an issue. core/src/Shaders/sprites.fragment.fx#L21
if (float(alphaTest) != 0.)
I moved type casting to a separate line and it fixed the issue.