Commit 749b4e0c by Ben Clayton

SpirvShader: Implement GLSLstd450Atan

Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.atan.* Change-Id: Ic7dc89ca2b3253482e972ced46515fc83da33770 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28437Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent eafae477
...@@ -3329,6 +3329,16 @@ namespace sw ...@@ -3329,6 +3329,16 @@ namespace sw
} }
break; break;
} }
case GLSLstd450Atan:
{
auto val = GenericValue(this, routine, insn.word(5));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, Atan(val.Float(i)));
}
break;
}
default: default:
UNIMPLEMENTED("Unhandled ExtInst %d", extInstIndex); UNIMPLEMENTED("Unhandled ExtInst %d", extInstIndex);
} }
......
...@@ -558,6 +558,7 @@ namespace rr ...@@ -558,6 +558,7 @@ namespace rr
func_.emplace("cosf", reinterpret_cast<void*>(cosf)); func_.emplace("cosf", reinterpret_cast<void*>(cosf));
func_.emplace("asinf", reinterpret_cast<void*>(asinf)); func_.emplace("asinf", reinterpret_cast<void*>(asinf));
func_.emplace("acosf", reinterpret_cast<void*>(acosf)); func_.emplace("acosf", reinterpret_cast<void*>(acosf));
func_.emplace("atanf", reinterpret_cast<void*>(atanf));
#ifdef __APPLE__ #ifdef __APPLE__
// LLVM uses this function on macOS for tan. // LLVM uses this function on macOS for tan.
...@@ -3114,6 +3115,11 @@ namespace rr ...@@ -3114,6 +3115,11 @@ namespace rr
return TransformFloat4PerElement(v, "acosf"); return TransformFloat4PerElement(v, "acosf");
} }
RValue<Float4> Atan(RValue<Float4> v)
{
return TransformFloat4PerElement(v, "atanf");
}
Type *Float4::getType() Type *Float4::getType()
{ {
return T(llvm::VectorType::get(T(Float::getType()), 4)); return T(llvm::VectorType::get(T(Float::getType()), 4));
......
...@@ -2213,6 +2213,7 @@ namespace rr ...@@ -2213,6 +2213,7 @@ namespace rr
RValue<Float4> Tan(RValue<Float4> x); RValue<Float4> Tan(RValue<Float4> x);
RValue<Float4> Asin(RValue<Float4> x); RValue<Float4> Asin(RValue<Float4> x);
RValue<Float4> Acos(RValue<Float4> x); RValue<Float4> Acos(RValue<Float4> x);
RValue<Float4> Atan(RValue<Float4> x);
template<class T> template<class T>
class Pointer : public LValue<Pointer<T>> class Pointer : public LValue<Pointer<T>>
......
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