nir/opcodes: Properly flush denormals in fquantize2f16
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jan 2016 06:04:09 +0000 (22:04 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jan 2016 06:18:31 +0000 (22:18 -0800)
src/glsl/nir/nir_opcodes.py

index 1b176209e20605442ea818542d9263e11d0e4fc3..c5fb0420bb608f0bf19a8a4728e73b330226c3d8 100644 (file)
@@ -176,7 +176,7 @@ unop("ffloor", tfloat, "floorf(src0)")
 unop("ffract", tfloat, "src0 - floorf(src0)")
 unop("fround_even", tfloat, "_mesa_roundevenf(src0)")
 
-unop("fquantize2f16", tfloat, "_mesa_half_to_float(_mesa_float_to_half(src0))")
+unop("fquantize2f16", tfloat, "(fabs(src0) < ldexpf(1.0, -14)) ? copysignf(0.0f, src0) : _mesa_half_to_float(_mesa_float_to_half(src0))")
 
 # Trigonometric operations.