Fix DSL handling of doubles
Previously, "x = 1.0" (as opposed to 1.0f) would fail with an ambiguous
operator resolution.
Change-Id: I9bcb4115d209a2aadb3fc4c237b61c345b25ca00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400619
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/SkSLDSLTest.cpp b/tests/SkSLDSLTest.cpp
index db57f89..de3b640 100644
--- a/tests/SkSLDSLTest.cpp
+++ b/tests/SkSLDSLTest.cpp
@@ -162,6 +162,14 @@
EXPECT_EQUAL(Float4(0, 1, 2, 3),
"float4(0.0, 1.0, 2.0, 3.0)");
+ DSLVar x(kFloat_Type, "x");
+ EXPECT_EQUAL(x = 1.0, "(x = 1.0)");
+ EXPECT_EQUAL(x = 1.0f, "(x = 1.0)");
+
+ DSLVar y(kFloat2_Type, "y");
+ EXPECT_EQUAL(y.x() = 1.0, "(y.x = 1.0)");
+ EXPECT_EQUAL(y.x() = 1.0f, "(y.x = 1.0)");
+
{
ExpectError error(r, "error: floating point value is infinite\n");
Float(std::numeric_limits<float>::infinity()).release();