aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-05-17 10:52:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-17 15:22:05 +0000
commit4b330dfd3334bf24bf93043acfcd31590a3cdbbf (patch)
tree59eb057e274889ee86e34be55129f2405c5bf055 /tests/SkSLGLSLTest.cpp
parentf76984445bbd40a0336e288bfea9c224767ef745 (diff)
skslc comma operator and optimizer fixes
Bug: skia: Change-Id: I732d4fba843c06af570d4a56cadfaa1cc565808c Reviewed-on: https://skia-review.googlesource.com/17125 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.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index ff1d5f5972..ba6bbbd13f 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -141,6 +141,8 @@ DEF_TEST(SkSLOperators, r) {
"z >>= 2;"
"z <<= 4;"
"z %= 5;"
+ "x = (vec2(sqrt(1)) , 6);"
+ "z = (vec2(sqrt(1)) , 6);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -164,6 +166,8 @@ DEF_TEST(SkSLOperators, r) {
" z >>= 2;\n"
" z <<= 4;\n"
" z %= 5;\n"
+ " x = float((vec2(sqrt(1.0)) , 6));\n"
+ " z = (vec2(sqrt(1.0)) , 6);\n"
"}\n");
}
@@ -1334,4 +1338,26 @@ DEF_TEST(SkSLMultipleAssignments, r) {
"}\n");
}
+DEF_TEST(SkSLComplexDelete, r) {
+ test(r,
+ "uniform mat4 colorXform;"
+ "uniform sampler2D sampler;"
+ "void main() {"
+ "vec4 tmpColor;"
+ "sk_FragColor = vec4(1.0) * (tmpColor = texture(sampler, vec2(1)) , "
+ "colorXform != mat4(1.0) ? vec4(clamp((mat4(colorXform) * vec4(tmpColor.xyz, 1.0)).xyz, "
+ "0.0, tmpColor.w), tmpColor.w) : tmpColor);"
+ "}",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "uniform mat4 colorXform;\n"
+ "uniform sampler2D sampler;\n"
+ "void main() {\n"
+ " vec4 tmpColor;\n"
+ " sk_FragColor = (tmpColor = texture(sampler, vec2(1.0)) , colorXform != mat4(1.0) ? "
+ "vec4(clamp((colorXform * vec4(tmpColor.xyz, 1.0)).xyz, 0.0, tmpColor.w), tmpColor.w) : "
+ "tmpColor);\n"
+ "}\n");
+}
#endif