aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-04-25 14:42:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-25 19:39:13 +0000
commit3deaeb2dc0cfddfdf2e3b64736c860132619a051 (patch)
tree9349c336d5d6802de58e326dc89557047f631739 /tests/SkSLGLSLTest.cpp
parent7ab6a7f40b23610577bd64fbcb6121a2a715469b (diff)
sksl can now fold constant vector or matrix equality expressions
Bug: skia: Change-Id: Icaddae68e53ed3629bcdc04b5f0b541d9e4398e2 Reviewed-on: https://skia-review.googlesource.com/14260 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r--tests/SkSLGLSLTest.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 97d7acbce9..1dc522b07d 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -573,6 +573,34 @@ DEF_TEST(SkSLConstantFolding, r) {
"sk_FragColor = vec4(2) * vec4(1, 2, 3, 4);"
"sk_FragColor = vec4(12) / vec4(1, 2, 3, 4);"
"sk_FragColor.r = (vec4(12) / vec4(1, 2, 3, 4)).y;"
+ "sk_FragColor.x = vec4(1) == vec4(1) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec4(1) == vec4(2) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec2(1) == vec2(1, 1) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec2(1, 1) == vec2(1, 1) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec2(1) == vec2(1, 0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec4(1) == vec4(vec2(1), vec2(1)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec4(vec3(1), 1) == vec4(vec2(1), vec2(1)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec4(vec3(1), 1) == vec4(vec2(1), 1, 0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) == "
+ "mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(vec2(1.0, 0.0), vec2(1.0, 1.0)) == "
+ "mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1) == mat2(1) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1) == mat2(0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1) == mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(2) == mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat3x2(2) == mat3x2(vec2(2.0, 0.0), vec2(0.0, 2.0), vec2(0.0)) ? "
+ "1.0 : 0.0;"
+ "sk_FragColor.x = vec2(1) != vec2(1, 0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = vec4(1) != vec4(vec2(1), vec2(1)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1) != mat2(1) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1) != mat2(0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 0.0)) == "
+ "mat3(mat2(1.0)) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(mat3(1.0)) == mat2(1.0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(vec4(1.0, 0.0, 0.0, 1.0)) == mat2(1.0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(1.0, 0.0, vec2(0.0, 1.0)) == mat2(1.0) ? 1.0 : 0.0;"
+ "sk_FragColor.x = mat2(vec2(1.0, 0.0), 0.0, 1.0) == mat2(1.0) ? 1.0 : 0.0;"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -617,6 +645,30 @@ DEF_TEST(SkSLConstantFolding, r) {
" sk_FragColor = vec4(2.0, 4.0, 6.0, 8.0);\n"
" sk_FragColor = vec4(12.0, 6.0, 4.0, 3.0);\n"
" sk_FragColor.x = 6.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 0.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
+ " sk_FragColor.x = 1.0;\n"
"}\n");
}