Commit 93451856 by Ben Clayton

SpirvShader: Implement GLSLstd450InverseSqrt

RcpSqrt_pp is not accurate enough to be used on non-relaxed precision types. Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.inversesqrt.* Change-Id: I3e34d28dbd863c9cb14cf6c79afe08a1992b5478 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28697Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 8448cc5b
......@@ -3463,7 +3463,23 @@ namespace sw
}
case GLSLstd450InverseSqrt:
{
UNIMPLEMENTED("GLSLstd450InverseSqrt");
auto val = GenericValue(this, routine, insn.word(5));
Decorations d;
ApplyDecorationsForId(&d, insn.word(5));
if (d.RelaxedPrecision)
{
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, RcpSqrt_pp(val.Float(i)));
}
}
else
{
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, SIMD::Float(1.0f) / Sqrt(val.Float(i)));
}
}
break;
}
case GLSLstd450Determinant:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment