diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-02-27 13:26:45 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-27 19:01:55 +0000 |
commit | af19769831f1c4c3b90c85aa9f8851cd8bbf86d5 (patch) | |
tree | 5dd063830d41aff45eefcb524c868ac210016467 /tests/SkSLGLSLTest.cpp | |
parent | 578f064a60b63ddfb00831e9e59a47060bfcefe0 (diff) |
Re-land of skslc switch support
This reverts commit 7d975fc200bbbea991ec4c04c08f3a5ea7b847af.
BUG=skia:
Change-Id: I57521f7a291a35cfed58d623ea4f8da29582d2c5
Reviewed-on: https://skia-review.googlesource.com/8993
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r-- | tests/SkSLGLSLTest.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp index a0fdb98dcf..53e5c6badf 100644 --- a/tests/SkSLGLSLTest.cpp +++ b/tests/SkSLGLSLTest.cpp @@ -777,4 +777,91 @@ DEF_TEST(SkSLGeometry, r) { SkSL::Program::kGeometry_Kind); } +DEF_TEST(SkSLSwitch, r) { + test(r, + "void main() {" + " float x;" + " switch (1) {" + " case 0:" + " x = 0.0;" + " break;" + " case 1:" + " x = 1.0;" + " break;" + " default:" + " x = 2.0;" + " }" + " sk_FragColor = vec4(x);" + "}", + *SkSL::ShaderCapsFactory::Default(), + "#version 400\n" + "out vec4 sk_FragColor;\n" + "void main() {\n" + " float x;\n" + " switch (1) {\n" + " case 0:\n" + " x = 0.0;\n" + " break;\n" + " case 1:\n" + " x = 1.0;\n" + " break;\n" + " default:\n" + " x = 2.0;\n" + " }\n" + " sk_FragColor = vec4(x);\n" + "}\n"); + test(r, + "void main() {" + " float x;" + " switch (2) {" + " case 0:" + " x = 0.0;" + " case 1:" + " x = 1.0;" + " default:" + " x = 2.0;" + " }" + " sk_FragColor = vec4(x);" + "}", + *SkSL::ShaderCapsFactory::Default(), + "#version 400\n" + "out vec4 sk_FragColor;\n" + "void main() {\n" + " float x;\n" + " switch (2) {\n" + " case 0:\n" + " x = 0.0;\n" + " case 1:\n" + " x = 1.0;\n" + " default:\n" + " x = 2.0;\n" + " }\n" + " sk_FragColor = vec4(2.0);\n" + "}\n"); + test(r, + "void main() {" + " float x = 0.0;" + " switch (3) {" + " case 0:" + " x = 0.0;" + " case 1:" + " x = 1.0;" + " }" + " sk_FragColor = vec4(x);" + "}", + *SkSL::ShaderCapsFactory::Default(), + "#version 400\n" + "out vec4 sk_FragColor;\n" + "void main() {\n" + " float x = 0.0;\n" + " switch (3) {\n" + " case 0:\n" + " x = 0.0;\n" + " case 1:\n" + " x = 1.0;\n" + " }\n" + " sk_FragColor = vec4(x);\n" + "}\n"); +} + #endif |