aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2016-11-01 11:57:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-01 17:46:51 +0000
commit4578a8e4a20260b64e0765010d41f5ee6e2c4080 (patch)
treed13270e130b2c8548e68355d3424844495aa9b77 /tests
parenta9e9bfc6e40894c0447c044a380c74061cb9e15e (diff)
fixed skslc's handling of ivec(vec)
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4222 Change-Id: I9b32067af51f3a04efa702cf2eb1ac1ed480df6a Reviewed-on: https://skia-review.googlesource.com/4222 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/SkSLErrorTest.cpp6
-rw-r--r--tests/SkSLGLSLTest.cpp24
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index 3afb64fe61..9e89b71473 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -94,6 +94,12 @@ DEF_TEST(SkSLConstructorTypeMismatch, r) {
"void main() { vec2 x = vec2(1.0, false); }",
"error: 1: expected 'float', but found 'bool'\n1 error\n");
test_failure(r,
+ "void main() { vec2 x = vec2(bvec2(false)); }",
+ "error: 1: 'bvec2' is not a valid parameter to 'vec2' constructor\n1 error\n");
+ test_failure(r,
+ "void main() { bvec2 x = bvec2(vec2(1)); }",
+ "error: 1: 'vec2' is not a valid parameter to 'bvec2' constructor\n1 error\n");
+ test_failure(r,
"void main() { bool x = bool(1.0); }",
"error: 1: cannot construct 'bool'\n1 error\n");
test_failure(r,
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index ad1fe0d901..610ff2b5ab 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -368,6 +368,30 @@ DEF_TEST(SkSLHex, r) {
"}\n");
}
+DEF_TEST(SkSLVectorConstructors, r) {
+ test(r,
+ "vec2 v1 = vec2(1);"
+ "vec2 v2 = vec2(1, 2);"
+ "vec2 v3 = vec2(vec2(1));"
+ "vec2 v4 = vec2(vec3(1));"
+ "vec3 v5 = vec3(vec2(1), 1.0);"
+ "vec3 v6 = vec3(vec4(1, 2, 3, 4));"
+ "ivec2 v7 = ivec2(1);"
+ "ivec2 v8 = ivec2(vec2(1, 2));"
+ "vec2 v9 = vec2(ivec2(1, 2));",
+ default_caps(),
+ "#version 400\n"
+ "vec2 v1 = vec2(1.0);\n"
+ "vec2 v2 = vec2(1.0, 2.0);\n"
+ "vec2 v3 = vec2(1.0);\n"
+ "vec2 v4 = vec2(vec3(1.0));\n"
+ "vec3 v5 = vec3(vec2(1.0), 1.0);\n"
+ "vec3 v6 = vec3(vec4(1.0, 2.0, 3.0, 4.0));\n"
+ "ivec2 v7 = ivec2(1);\n"
+ "ivec2 v8 = ivec2(vec2(1.0, 2.0));\n"
+ "vec2 v9 = vec2(ivec2(1, 2));\n");
+}
+
DEF_TEST(SkSLArrayConstructors, r) {
test(r,
"float test1[] = float[](1, 2, 3, 4);"