Use ShaderCore functions to implement GLSL.std.450 transcendentals
These ShaderCore implementations of transcendental functions are
identical to the current Reactor 'optimal' intrinsics. These were
already used by Subzero before, but not by Reactor's LLVM backend.
This change will enable removing approximate implementations of
transcendental functions which are Vulkan-specific, from the Reactor
side. Only full-precision reference implementations will be left.
Bug: b/169755552
Change-Id: I22662c6b4395f65965aac407f95b261bcd9df2b4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/62248
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShaderGLSLstd450.cpp b/src/Pipeline/SpirvShaderGLSLstd450.cpp
index 355dc19..85cc6ff 100644
--- a/src/Pipeline/SpirvShaderGLSLstd450.cpp
+++ b/src/Pipeline/SpirvShaderGLSLstd450.cpp
@@ -595,7 +595,7 @@
auto radians = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Sin(radians.Float(i)));
+ dst.move(i, sw::Sin(radians.Float(i)));
}
}
break;
@@ -604,7 +604,7 @@
auto radians = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Cos(radians.Float(i)));
+ dst.move(i, sw::Cos(radians.Float(i)));
}
}
break;
@@ -613,7 +613,7 @@
auto radians = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Tan(radians.Float(i)));
+ dst.move(i, sw::Tan(radians.Float(i)));
}
}
break;
@@ -624,7 +624,7 @@
ApplyDecorationsForId(&d, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Asin(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
+ dst.move(i, sw::Asin(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
}
}
break;
@@ -635,7 +635,7 @@
ApplyDecorationsForId(&d, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Acos(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
+ dst.move(i, sw::Acos(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
}
}
break;
@@ -644,7 +644,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Atan(val.Float(i)));
+ dst.move(i, sw::Atan(val.Float(i)));
}
}
break;
@@ -653,7 +653,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Sinh(val.Float(i)));
+ dst.move(i, sw::Sinh(val.Float(i)));
}
}
break;
@@ -662,7 +662,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Cosh(val.Float(i)));
+ dst.move(i, sw::Cosh(val.Float(i)));
}
}
break;
@@ -671,7 +671,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Tanh(val.Float(i)));
+ dst.move(i, sw::Tanh(val.Float(i)));
}
}
break;
@@ -680,7 +680,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Asinh(val.Float(i)));
+ dst.move(i, sw::Asinh(val.Float(i)));
}
}
break;
@@ -689,7 +689,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Acosh(val.Float(i)));
+ dst.move(i, sw::Acosh(val.Float(i)));
}
}
break;
@@ -698,7 +698,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Atanh(val.Float(i)));
+ dst.move(i, sw::Atanh(val.Float(i)));
}
}
break;
@@ -708,7 +708,7 @@
auto y = Operand(this, state, insn.word(6));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Atan2(x.Float(i), y.Float(i)));
+ dst.move(i, sw::Atan2(x.Float(i), y.Float(i)));
}
}
break;
@@ -718,7 +718,7 @@
auto y = Operand(this, state, insn.word(6));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Pow(x.Float(i), y.Float(i)));
+ dst.move(i, sw::Pow(x.Float(i), y.Float(i)));
}
}
break;
@@ -727,7 +727,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Exp(val.Float(i)));
+ dst.move(i, sw::Exp(val.Float(i)));
}
}
break;
@@ -736,7 +736,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Log(val.Float(i)));
+ dst.move(i, sw::Log(val.Float(i)));
}
}
break;
@@ -745,7 +745,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Exp2(val.Float(i)));
+ dst.move(i, sw::Exp2(val.Float(i)));
}
}
break;
@@ -754,7 +754,7 @@
auto val = Operand(this, state, insn.word(5));
for(auto i = 0u; i < type.componentCount; i++)
{
- dst.move(i, rr::Log2(val.Float(i)));
+ dst.move(i, sw::Log2(val.Float(i)));
}
}
break;