Eliminate rr::Precision
Reactor now only has full-precision implementations of transcendental
functions, so there's no need for a precision argument.
The only exceptions are the reciprocal function, and reciprocal square
root. Those are very useful to keep as part of the Reactor API because
there are fast approximate instructions for these operations. For now,
the precision is selected using a boolean parameter. This is intended to
later be replaced by having just an approximate intrinsic, and a query
Caps::rcpIsFast() which will allow users of Reactor to determine whether
to use 1/x or Rcp(). Specifically, when Rcp() is actually implemented as
1/x it would be wasteful to apply the Newton–Raphson method to obtain a
more precise result (cf. Caps::fmaIsFast() which addresses a similar
problem).
Bug: b/169755552
Change-Id: I553746aeee3ac01f6c47e06da17de1f6bfcd7df6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/62289
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp
index 37aa93a..510d062 100644
--- a/src/Pipeline/SamplerCore.cpp
+++ b/src/Pipeline/SamplerCore.cpp
@@ -1144,12 +1144,12 @@
uDelta = As<Float4>((As<Int4>(dudx) & mask) | ((As<Int4>(dudy) & ~mask)));
vDelta = As<Float4>((As<Int4>(dvdx) & mask) | ((As<Int4>(dvdy) & ~mask)));
- anisotropy = lod * Rcp(det, Precision::Relaxed);
+ anisotropy = lod * Rcp(det, true /* relaxedPrecision */);
anisotropy = Min(anisotropy, state.maxAnisotropy);
// TODO(b/151263485): While we always need `lod` above, when there's only
// a single mipmap level the following calculations could be skipped.
- lod *= Rcp(anisotropy * anisotropy, Precision::Relaxed);
+ lod *= Rcp(anisotropy * anisotropy, true /* relaxedPrecision */);
}
lod = log2sqrt(lod); // log2(sqrt(lod))