yangqiaosheng / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

isnan() not working correctly #927

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
isnan() is always returning false.

dEQP tests failing because of this:
dEQP-GLES3.functional.shaders.builtin_functions.common.isnan.*_highp_*

example shader from dEQP tests:
--------------------------------------------
#version 300 es
in highp float in0;
flat out highp int o_out0;

void main (void)
{
    gl_Position = vec4(0.0);
    gl_PointSize = 1.0;

    bool out0;
    out0 = isnan(in0);
    o_out0 = int(out0);
}
--------------------------------------------

out0 is always false even for NANs.

Original issue reported on code.google.com by apat...@nvidia.com on 24 Feb 2015 at 5:59

GoogleCodeExporter commented 9 years ago
I debugged this issue but it doesn't look to be a problem with ANGLE or dEQP 
test. 

ANGLE is just mapping it to HLSL intrinsic function isnan. Test is also 
properly generating NANs((sign << 31) | (exp << 23) | mantissa) and passing it 
on but still isnan is returning false. 

May be an issue with HLSL or drivers. I tested it on Windows7 with NVIDIA GPU. 
Anyone seeing these failures with other GPUs?

lowp and midp isnan tests are passing but these tests just check if isnan is 
returning 0 or 1 and they don't check exact value.

Original comment by apat...@nvidia.com on 24 Feb 2015 at 9:17

GoogleCodeExporter commented 9 years ago
isnan() in HLSL is returning false even when NANs are properly getting passed 
to the shaders. I verified this by adding a sample built-in function that just 
receives float values including NANs and returns unit. I manually inspected 
individual bits of uint, NANs are getting passed properly to the shader and 
also getting returned properly.

I uploaded a patch that just emulates isnan implementation for HLSL in ANGLE :
https://chromium-review.googlesource.com/#/c/254041

Original comment by apat...@nvidia.com on 27 Feb 2015 at 6:06

GoogleCodeExporter commented 9 years ago
It turned out to be a problem because we do not have IEEE strictness enabled 
for D3D compiler, uploaded a new change that conditionally enables it for isnan 
to work:
https://chromium-review.googlesource.com/#/c/255834/

Original comment by apat...@nvidia.com on 5 Mar 2015 at 10:53

GoogleCodeExporter commented 9 years ago
Fix is merged: https://chromium-review.googlesource.com/#/c/255834/

Original comment by apat...@nvidia.com on 16 Mar 2015 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by jmad...@chromium.org on 16 Mar 2015 at 2:03