Testing for NaN in GLSL ES 1

24 views
Skip to first unread message

Tarek Sherif

unread,
Jul 16, 2021, 6:05:26 PM7/16/21
to WebGL Dev List
Hi all,

I was wondering if anyone knows of a way to reliably test for NaN in GLSL ES 1. I tried using the following polyfill that I found in this mesa bug ticket:

bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }

This worked on the desktop devices I tested but failed an iPhone and an iPad. I created this playground to try out different tests (the squares test whether a NaN attribute was correctly detected at low, medium, and high shader float precision, green == pass, red == fail).

Any help would be appreciated!

Tarek

Ken Russell

unread,
Jul 16, 2021, 6:45:49 PM7/16/21
to WebGL Dev List
I don't have a good suggestion for GLSL ES 1.00, but please test the isnan primitive in GLSL ES 3.00 shaders on the iOS 15 betas and WebGL 2.0 implementation on your iPhone and iPad! If you see any bugs there, please file them on bugs.webkit.org, WebGL component. Thanks!

-Ken



--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/webgl-dev-list/6fe5280d-6d67-433d-81a8-d8a5a6b67120n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages