OSDN Git Service

Correct reciprocal approximation for power-of-two values.
authorNicolas Capens <capn@google.com>
Fri, 26 Feb 2016 04:58:33 +0000 (23:58 -0500)
committerNicolas Capens <capn@google.com>
Fri, 26 Feb 2016 15:54:48 +0000 (15:54 +0000)
commit05b3d665fd92cd11b8a6517dafe661a5398547b7
tree7b768212a45b17c3c939de470f90b3004b1b960e
parent407813b4c558c92a42831104f32cce0d113db8ca
Correct reciprocal approximation for power-of-two values.

Intel's reciprocal approximation instruction is not exact for power-of-two
values. It provides 12 bits of mantissa precision and keeps a balance between
positive and negative errors, but the reciprocal of 2^x is not 2^-x. This
affects conformance tests which expect varyings not to be affected by the
perspective division. Correct for this by multiplying by the inverse.

Bug 27165393

Change-Id: Ie52ec511a14a4f447adc47ce9c875bbad03cd274
Reviewed-on: https://swiftshader-review.googlesource.com/4903
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/Reactor/Nucleus.cpp
src/Reactor/Nucleus.hpp
src/Shader/PixelRoutine.cpp
src/Shader/ShaderCore.cpp
src/Shader/ShaderCore.hpp