aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-05-05 10:04:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-05 14:26:38 +0000
commitc2371a4e325fd123f2d47a9b85d3c8405e8d5e29 (patch)
treef2055e2a857c400130f4ed2f2b0e35ac9f1064ae /tests/SkSLGLSLTest.cpp
parente12c69e78db3b6451c42e36524ae9e87f75f24fc (diff)
sksl optimizer fixes
The main issue was a use-after-free due to removing (and thus destroying) the binary expression prior to re-adding part of it. Also cleaned up the way dead assignments are handled and added the test that originally identified these problems. Bug: skia: Change-Id: Icda93d69a66c4e57850ecdc88fc4a4f634e1aac2 Reviewed-on: https://skia-review.googlesource.com/15383 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.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index b945211eca..32fd668dda 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -1213,4 +1213,21 @@ DEF_TEST(SkSLUnusedVars, r) {
"}\n");
}
+DEF_TEST(SkSLMultipleAssignments, r) {
+ test(r,
+ "void main() {"
+ "float x;"
+ "float y;"
+ "int z;"
+ "x = y = z = 1;"
+ "sk_FragColor = vec4(z);"
+ "}",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(1.0);\n"
+ "}\n");
+}
+
#endif