migrate spiral demo from canvaskit
- add atan, fract, dividef, subtractf
Also wants mix(), but I'm still learning how to handle 2 args
functions (e.g. how to support atan(y,x) as well)
Change-Id: Ib9f233cd1c4266110cfea68a7d444f834f875f1f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286276
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/sksl/SkSLByteCodeGenerator.cpp b/src/sksl/SkSLByteCodeGenerator.cpp
index 210b54e..60bff34 100644
--- a/src/sksl/SkSLByteCodeGenerator.cpp
+++ b/src/sksl/SkSLByteCodeGenerator.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
@@ -43,8 +43,10 @@
, fContext(*context)
, fOutput(output)
, fIntrinsics {
+ { "atan", ByteCodeInstruction::kATan },
{ "cos", ByteCodeInstruction::kCos },
{ "dot", SpecialIntrinsic::kDot },
+ { "fract", ByteCodeInstruction::kFract },
{ "inverse", ByteCodeInstruction::kInverse2x2 },
{ "sin", ByteCodeInstruction::kSin },
{ "sqrt", ByteCodeInstruction::kSqrt },
@@ -217,7 +219,9 @@
VECTOR_UNARY_OP(kConvertStoF)
VECTOR_UNARY_OP(kConvertUtoF)
+ VECTOR_UNARY_OP(kATan)
VECTOR_UNARY_OP(kCos)
+ VECTOR_UNARY_OP(kFract)
VECTOR_UNARY_OP(kSin)
VECTOR_UNARY_OP(kSqrt)
VECTOR_UNARY_OP(kTan)
@@ -994,7 +998,9 @@
}
} else {
switch (found->second.fValue.fInstruction) {
+ case ByteCodeInstruction::kATan:
case ByteCodeInstruction::kCos:
+ case ByteCodeInstruction::kFract:
case ByteCodeInstruction::kSin:
case ByteCodeInstruction::kSqrt:
case ByteCodeInstruction::kTan: