Why does GLSL's arithmetic functions yield so different results on the iPad than on the simulator?
Posted
by
cheeesus
on Stack Overflow
See other posts from Stack Overflow
or by cheeesus
Published on 2012-08-31T21:34:45Z
Indexed on
2012/08/31
21:37 UTC
Read the original article
Hit count: 233
I'm currently chasing some bugs in my OpenGL ES 2.0 fragment shader code which is running on iOS devices. The code runs fine in the simulator, but on the iPad it has huge problems and some of the calculations yield vastly different results, I had for example 0.0
on the iPad and 4013.17
on the simulator, so I'm not talking about small differences which could be the result of some rounding errors.
One of the things I noticed is that, on the iPad,
float1 = pow(float2, 2.0);
can yield results which are very different from the results of
float1 = float2 * float2;
Specifically, when using pow(x, 2.0)
on a variable containing a larger negative number like -8
, it seemed to return a value which satified the condition if (powResult <= 0.0)
.
Also, the result of both operations (pow(x, 2.0)
as well as x*x
) yields different results in the simulator than on the iPad.
Used floats are mediump
, but I get the same stuff with highp
.
Is there a simple explanation for those differences?
I'm narrowing the problem down, but it takes so much time, so maybe someone can help me here with a simple explanation.
© Stack Overflow or respective owner