add skvx::{sin,cos,tan}
This lets us get rid of VECTOR_UNARY_FN_VEC.
I don't know exactly what was wrong with VECTOR_UNARY_FN_VEC,
but `color.rgb = color.rgb + a*(sin(6.28*color.rgb)*0.159)` looks
ok to me now when run through the interpreter.
Change-Id: I700398cd55eca1b8e1b3b46858415ecae5585a32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286065
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/sksl/SkSLByteCode.cpp b/src/sksl/SkSLByteCode.cpp
index af18c28..c2a1ab6 100644
--- a/src/sksl/SkSLByteCode.cpp
+++ b/src/sksl/SkSLByteCode.cpp
@@ -366,19 +366,6 @@
case ByteCodeInstruction::base: sp[ 0] = fn(sp[ 0].field); \
continue;
-#define VECTOR_UNARY_FN_VEC(base, fn) \
- case ByteCodeInstruction::base ## 4: \
- case ByteCodeInstruction::base ## 3: \
- case ByteCodeInstruction::base ## 2: \
- case ByteCodeInstruction::base: { \
- int count = (int)inst - (int)(ByteCodeInstruction::base) + 1; \
- float* v = (float*)sp - count + 1; \
- for (int i = VecWidth * count; i > 0; --i, ++v) { \
- *v = fn(*v); \
- } \
- continue; \
- }
-
union VValue {
VValue() {}
VValue(F32 f) : fFloat(f) {}
@@ -648,7 +635,7 @@
case ByteCodeInstruction::kConvertUtoF: sp[ 0] = skvx::cast<float>(sp[ 0].fUnsigned);
continue;
- VECTOR_UNARY_FN_VEC(kCos, cosf)
+ VECTOR_UNARY_FN(kCos, skvx::cos, fFloat)
VECTOR_BINARY_MASKED_OP(kDivideS, fSigned, /)
VECTOR_BINARY_MASKED_OP(kDivideU, fUnsigned, /)
@@ -951,7 +938,7 @@
sp[0] = sp[0].fUnsigned >> READ8();
continue;
- VECTOR_UNARY_FN_VEC(kSin, sinf)
+ VECTOR_UNARY_FN(kSin, skvx::sin, fFloat)
VECTOR_UNARY_FN(kSqrt, skvx::sqrt, fFloat)
case ByteCodeInstruction::kStore4:
@@ -1075,7 +1062,7 @@
continue;
}
- VECTOR_UNARY_FN_VEC(kTan, tanf)
+ VECTOR_UNARY_FN(kTan, skvx::tan, fFloat)
case ByteCodeInstruction::kWriteExternal4:
case ByteCodeInstruction::kWriteExternal3: