aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-02 10:16:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-02 15:11:19 +0000
commitb4dc419f0bc3140cb4e0f5a2fe4db46c4306df86 (patch)
treeb47f7b59766c82d0a8c1edacf74e62650346738f /tests
parent7e910df7f133e80293117bdd069ed25998d10f8c (diff)
Re-land "Fixed an issue with sksl variable declarations"
This reverts commit affa6a3da87e9ea85f1d4fe3137b5bccbbc56f92. Bug: skia: Change-Id: I5864830e31acbf786f3ea7ae91f42f10aae6d855 Reviewed-on: https://skia-review.googlesource.com/18459 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/SkSLGLSLTest.cpp53
1 files changed, 34 insertions, 19 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index ba6bbbd13f..678ff13dd3 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -1340,24 +1340,39 @@ DEF_TEST(SkSLMultipleAssignments, r) {
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");
+ "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");
+}
+
+DEF_TEST(SkSLDependentInitializers, r) {
+ test(r,
+ "void main() {"
+ "float x = 0.5, y = x * 2;"
+ "sk_FragColor = vec4(y);"
+ "}",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(1.0);\n"
+ "}\n");
}
+
#endif