rename Arg to Ptr
This makes almost all existing code read more clearly.
Change-Id: I314331d9aa2ecb4664557efc7972e1a820afc250
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352085
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/tests/SkVMTest.cpp b/tests/SkVMTest.cpp
index a206fae..fccaaf7 100644
--- a/tests/SkVMTest.cpp
+++ b/tests/SkVMTest.cpp
@@ -24,7 +24,7 @@
DEF_TEST(SkVM_eliminate_dead_code, r) {
skvm::Builder b;
{
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
skvm::I32 l = b.load32(arg);
skvm::I32 a = b.add(l, l);
b.add(a, b.splat(7));
@@ -99,7 +99,7 @@
// buf[i] += 1
skvm::Builder b;
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
b.store32(arg,
b.add(b.splat(1),
b.load32(arg)));
@@ -125,7 +125,7 @@
DEF_TEST(SkVM_gather32, r) {
skvm::Builder b;
{
- skvm::Arg uniforms = b.uniform(),
+ skvm::Ptr uniforms = b.uniform(),
buf = b.varying<int>();
skvm::I32 x = b.load32(buf);
b.store32(buf, b.gather32(uniforms,0, b.bit_and(x, b.splat(7))));
@@ -173,7 +173,7 @@
DEF_TEST(SkVM_gathers, r) {
skvm::Builder b;
{
- skvm::Arg uniforms = b.uniform(),
+ skvm::Ptr uniforms = b.uniform(),
buf32 = b.varying<int>(),
buf16 = b.varying<uint16_t>(),
buf8 = b.varying<uint8_t>();
@@ -231,7 +231,7 @@
DEF_TEST(SkVM_gathers2, r) {
skvm::Builder b;
{
- skvm::Arg uniforms = b.uniform(),
+ skvm::Ptr uniforms = b.uniform(),
buf32 = b.varying<int>(),
buf16 = b.varying<uint16_t>(),
buf8 = b.varying<uint8_t>();
@@ -280,7 +280,7 @@
DEF_TEST(SkVM_bitops, r) {
skvm::Builder b;
{
- skvm::Arg ptr = b.varying<int>();
+ skvm::Ptr ptr = b.varying<int>();
skvm::I32 x = b.load32(ptr);
@@ -306,7 +306,7 @@
DEF_TEST(SkVM_select_is_NaN, r) {
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
dst = b.varying<float>();
skvm::F32 x = b.loadF(src);
@@ -338,7 +338,7 @@
DEF_TEST(SkVM_f32, r) {
skvm::Builder b;
{
- skvm::Arg arg = b.varying<float>();
+ skvm::Ptr arg = b.varying<float>();
skvm::F32 x = b.loadF(arg),
y = b.add(x,x), // y = 2x
@@ -448,7 +448,7 @@
skvm::Builder b;
{
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
skvm::F32 x = b.to_F32(b.load32(arg)),
y = b.mad(x,x,x), // x is needed in the future, so r[x] != r[y].
@@ -474,7 +474,7 @@
// Create a pattern that can be peepholed into an Op::fms_f32.
skvm::Builder b;
{
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
skvm::F32 x = b.to_F32(b.load32(arg)),
v = b.sub(b.mul(x, b.splat(2.0f)),
@@ -496,7 +496,7 @@
// Create a pattern that can be peepholed into an Op::fnma_f32.
skvm::Builder b;
{
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
skvm::F32 x = b.to_F32(b.load32(arg)),
v = b.sub(b.splat(1.0f),
@@ -517,7 +517,7 @@
DEF_TEST(SkVM_madder, r) {
skvm::Builder b;
{
- skvm::Arg arg = b.varying<float>();
+ skvm::Ptr arg = b.varying<float>();
skvm::F32 x = b.loadF(arg),
y = b.mad(x,x,x), // x is needed in the future, so r[x] != r[y].
@@ -539,7 +539,7 @@
DEF_TEST(SkVM_floor, r) {
skvm::Builder b;
{
- skvm::Arg arg = b.varying<float>();
+ skvm::Ptr arg = b.varying<float>();
b.storeF(arg, b.floor(b.loadF(arg)));
}
@@ -556,8 +556,8 @@
DEF_TEST(SkVM_round, r) {
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>();
- skvm::Arg dst = b.varying<int>();
+ skvm::Ptr src = b.varying<float>();
+ skvm::Ptr dst = b.varying<int>();
b.store32(dst, b.round(b.loadF(src)));
}
@@ -578,9 +578,9 @@
DEF_TEST(SkVM_min, r) {
skvm::Builder b;
{
- skvm::Arg src1 = b.varying<float>();
- skvm::Arg src2 = b.varying<float>();
- skvm::Arg dst = b.varying<float>();
+ skvm::Ptr src1 = b.varying<float>();
+ skvm::Ptr src2 = b.varying<float>();
+ skvm::Ptr dst = b.varying<float>();
b.storeF(dst, b.min(b.loadF(src1), b.loadF(src2)));
}
@@ -600,9 +600,9 @@
DEF_TEST(SkVM_max, r) {
skvm::Builder b;
{
- skvm::Arg src1 = b.varying<float>();
- skvm::Arg src2 = b.varying<float>();
- skvm::Arg dst = b.varying<float>();
+ skvm::Ptr src1 = b.varying<float>();
+ skvm::Ptr src2 = b.varying<float>();
+ skvm::Ptr dst = b.varying<float>();
b.storeF(dst, b.max(b.loadF(src1), b.loadF(src2)));
}
@@ -624,7 +624,7 @@
// The JIT will try again without hoisting, and that'll just need 2 registers.
skvm::Builder b;
{
- skvm::Arg arg = b.varying<int>();
+ skvm::Ptr arg = b.varying<int>();
skvm::I32 x = b.load32(arg);
for (int i = 0; i < 32; i++) {
x = b.add(x, b.splat(i));
@@ -644,7 +644,7 @@
DEF_TEST(SkVM_select, r) {
skvm::Builder b;
{
- skvm::Arg buf = b.varying<int>();
+ skvm::Ptr buf = b.varying<int>();
skvm::I32 x = b.load32(buf);
@@ -676,7 +676,7 @@
// y = *Y
// *X = y
// but this reordering does not produce the same results and is invalid.
- skvm::Arg X = b.varying<int>(),
+ skvm::Ptr X = b.varying<int>(),
Y = b.varying<int>();
skvm::I32 x = b.load32(X),
@@ -701,7 +701,7 @@
// Exercise a somewhat arbitrary set of new ops.
skvm::Builder b;
{
- skvm::Arg buf = b.varying<int16_t>(),
+ skvm::Ptr buf = b.varying<int16_t>(),
uniforms = b.uniform();
skvm::I32 x = b.load16(buf);
@@ -1869,7 +1869,7 @@
DEF_TEST(SkVM_approx_math, r) {
auto eval = [](int N, float values[], auto fn) {
skvm::Builder b;
- skvm::Arg inout = b.varying<float>();
+ skvm::Ptr inout = b.varying<float>();
b.storeF(inout, fn(&b, b.loadF(inout)));
@@ -1927,7 +1927,7 @@
auto test = [r](float arg, float expected, float tolerance, auto prog) {
skvm::Builder b;
- skvm::Arg inout = b.varying<float>();
+ skvm::Ptr inout = b.varying<float>();
b.storeF(inout, prog(b.loadF(inout)));
float actual = arg;
b.done().eval(1, &actual);
@@ -1943,9 +1943,9 @@
auto test2 = [r](float arg0, float arg1, float expected, float tolerance, auto prog) {
skvm::Builder b;
- skvm::Arg in0 = b.varying<float>();
- skvm::Arg in1 = b.varying<float>();
- skvm::Arg out = b.varying<float>();
+ skvm::Ptr in0 = b.varying<float>();
+ skvm::Ptr in1 = b.varying<float>();
+ skvm::Ptr out = b.varying<float>();
b.storeF(out, prog(b.loadF(in0), b.loadF(in1)));
float actual;
b.done().eval(1, &arg0, &arg1, &actual);
@@ -2052,7 +2052,7 @@
{
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
mn = b.varying<float>(),
mx = b.varying<float>();
@@ -2081,7 +2081,7 @@
for (int i = 0; i < 8; i++) {
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
mn = b.varying<float>(),
mx = b.varying<float>();
@@ -2106,7 +2106,7 @@
for (int i = 0; i < 8; i++) {
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
mn = b.varying<float>(),
mx = b.varying<float>();
@@ -2135,7 +2135,7 @@
-4.0f,-0.5f,-1.0f,-2.0f};
{
skvm::Builder b;
- skvm::Arg src = b.varying<uint16_t>(),
+ skvm::Ptr src = b.varying<uint16_t>(),
dst = b.varying<float>();
b.storeF(dst, b.from_fp16(b.load16(src)));
@@ -2149,7 +2149,7 @@
}
{
skvm::Builder b;
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
dst = b.varying<uint16_t>();
b.store16(dst, b.to_fp16(b.loadF(src)));
@@ -2177,7 +2177,7 @@
{
skvm::Builder b;
{
- skvm::Arg wide = b.varying<uint64_t>(),
+ skvm::Ptr wide = b.varying<uint64_t>(),
lo = b.varying<int>(),
hi = b.varying<int>();
b.store32(lo, b.load64(wide, 0));
@@ -2196,7 +2196,7 @@
{
skvm::Builder b;
{
- skvm::Arg wide = b.varying<uint64_t>(),
+ skvm::Ptr wide = b.varying<uint64_t>(),
lo = b.varying<int>(),
hi = b.varying<int>();
b.store64(wide, b.load32(lo), b.load32(hi));
@@ -2227,7 +2227,7 @@
{ // Convert RGBA F32 to RGBA 8888, testing 128-bit loads.
skvm::Builder b;
{
- skvm::Arg dst = b.arg( 4),
+ skvm::Ptr dst = b.arg( 4),
src = b.arg(16);
skvm::Color c = b.load(rgba_ffff, src);
@@ -2246,7 +2246,7 @@
{ // Convert RGBA 8888 to RGBA F32, testing 128-bit stores.
skvm::Builder b;
{
- skvm::Arg dst = b.arg(16),
+ skvm::Ptr dst = b.arg(16),
src = b.arg( 4);
skvm::Color c = b.load(rgba_8888, src);
@@ -2266,7 +2266,7 @@
DEF_TEST(SkVM_is_NaN_is_finite, r) {
skvm::Builder b;
{
- skvm::Arg src = b.varying<float>(),
+ skvm::Ptr src = b.varying<float>(),
nan = b.varying<int>(),
fin = b.varying<int>();
b.store32(nan, is_NaN (b.loadF(src)));
@@ -2291,7 +2291,7 @@
// Test we can handle at least six arguments.
skvm::Builder b;
{
- skvm::Arg dst = b.varying<float>(),
+ skvm::Ptr dst = b.varying<float>(),
A = b.varying<float>(),
B = b.varying<float>(),
C = b.varying<float>(),
@@ -2321,7 +2321,7 @@
// originally with a bad arm64 implementation of pack().
skvm::Builder p;
{
- skvm::Arg uniforms = p.uniform(),
+ skvm::Ptr uniforms = p.uniform(),
dst = p.varying<uint16_t>();
skvm::I32 r = round(p.uniformF(uniforms, 8) * 15),
@@ -2380,7 +2380,7 @@
// First a typical gather scenario with varying index.
{
skvm::Builder b;
- skvm::Arg uniforms = b.uniform(),
+ skvm::Ptr uniforms = b.uniform(),
buf = b.varying<int>();
skvm::I32 ix = b.load32(buf);
b.store32(buf, b.gather32(uniforms,0, ix));
@@ -2400,7 +2400,7 @@
// Now the same but with a uniform index instead.
{
skvm::Builder b;
- skvm::Arg uniforms = b.uniform(),
+ skvm::Ptr uniforms = b.uniform(),
buf = b.varying<int>();
skvm::I32 ix = b.uniform32(uniforms,8);
b.store32(buf, b.gather32(uniforms,0, ix));
@@ -2427,7 +2427,7 @@
constexpr int K = 2;
skvm::Builder b;
{
- skvm::Arg buf = b.varying<int>();
+ skvm::Ptr buf = b.varying<int>();
for (int i = 0; i < K; i++) {
b.store32(buf, b.load32(buf) + 1);
}
@@ -2448,7 +2448,7 @@
// will invalidate the first store, meaning we do need to reissue that store operation.
skvm::Builder b;
{
- skvm::Arg buf = b.varying<int>();
+ skvm::Ptr buf = b.varying<int>();
b.store32(buf, b.splat(4));
b.store32(buf, b.splat(5));
b.store32(buf, b.splat(4)); // If we dedup'd, we'd skip this store.