Allow min/max/clamp to flush subnormals only during comparison
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 20 Sep 2017 20:26:44 +0000 (22:26 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 29 Sep 2017 07:36:43 +0000 (03:36 -0400)
commitfa91d36c2688cb593e975fbe017c0a47767967cb
tree6fd054f054242d4dc015b478f22509a3f7f07f7d
parentb242d7cd4ef17c8a5f2f5c886181db6a9796b2a5
Allow min/max/clamp to flush subnormals only during comparison

An implementation may follow the rule that subnormals are flushed
to zero for all arithmetic operations (including comparisons), but
never for mere copies.

In this case, if the input to min/max/clamp contains more than one
subnormal number (including +/-0.0), the returned value may be any
of the subnormal numbers and not really the true minimum/maximum/
clamped value.

This does not hurt real applications, since any subsequent use of
the result will flush it to zero anyway, and it does seem to be
implicitly allowed by the GLSL ES spec.

Change the implementation of min/max/clamp to explicitly handle
the subnormal case in the comparison.

Components: AOSP

VK-GL-CTS issue: 705

Affects:
dEQP-GLES3.functional.shaders.builtin_functions.precision.clamp.*
dEQP-GLES3.functional.shaders.builtin_functions.precision.max.*
dEQP-GLES3.functional.shaders.builtin_functions.precision.min.*
dEQP-GLES31.functional.shaders.builtin_functions.precision.clamp.*
dEQP-GLES31.functional.shaders.builtin_functions.precision.max.*
dEQP-GLES31.functional.shaders.builtin_functions.precision.min.*

Change-Id: I9a5bed9d78e311f96fe03b689299d777050ea063
modules/glshared/glsBuiltinPrecisionTests.cpp