Bug 135905 - ios8 webgl shader compiler thinks that pow(negative_float, 2.0) is zero
Summary: ios8 webgl shader compiler thinks that pow(negative_float, 2.0) is zero
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-13 14:35 PDT by makc
Modified: 2019-07-22 21:42 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description makc 2014-08-13 14:35:07 PDT
well maybe not compiler.

Steps to Reproduce:
create any shader with x * x and pow (x, 2.0) side by side, you will see a difference.

Expected Results:
x * x is always equal to pow (x, 2.0)

Actual Results:
pow (x, 2.0) is zero when x < 0

Version:
ios 8.0 12A4345d

Configuration:
iPad 3

See this commit
https://github.com/makc/makc.github.io/commit/4221dc9788d2f509caf6427571656681fb3ad442

And the demo that is fixed by it:
http://makc.github.io/three.js/map2globe/demo.html
Comment 1 makc 2014-08-13 14:38:25 PDT
I actually have a recording of how that demo looked prior to commit: https://www.youtube.com/watch?v=y5-VwWlFZqo
Comment 2 Gregg Tavares 2019-07-22 21:42:06 PDT
pow(x < 0, ...) is undefined behavior according to the spec

According to the OpenGL ES GLSL 1.0 spec

https://www.khronos.org/files/opengles_shading_language.pdf

Section 8.2 

genType pow (genType x, genType y) 

Returns x raised to the y power, i.e., x ^ y
Results are undefined if x < 0.
Results are undefined if x = 0 and y <= 0.