aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-02-16 14:49:57 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-16 20:27:43 +0000
commit50afc1765511a8d4850fe97aacf8714b609bfd5a (patch)
treefd7b6874542c53463b856f3ff8d1258dc389a21d /tests/SkSLGLSLTest.cpp
parent3bf12c60e265b09f282c9cc0fea1219b0b1b1088 (diff)
Fixed a couple of spots where sksl didn't have proper array support.
vec2 x[3] worked, but vec2[3] x didn't. Interface blocks also did not work with array sizes. BUG=skia: Change-Id: I45b424891db46804f1e3c1f4793470b7b501a6de Reviewed-on: https://skia-review.googlesource.com/8523 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.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 533c203036..a57fd9d4fb 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -187,6 +187,7 @@ DEF_TEST(SkSLInterfaceBlock, r) {
"bool w;"
"};"
"void main() {"
+ " sk_FragColor = vec4(x, y[0], y[1], 0);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -198,6 +199,39 @@ DEF_TEST(SkSLInterfaceBlock, r) {
" bool w;\n"
"};\n"
"void main() {\n"
+ " sk_FragColor = vec4(x, y[0], y[1], 0.0);\n"
+ "}\n");
+ test(r,
+ "uniform testBlock {"
+ "float x;"
+ "} test;"
+ "void main() {"
+ " sk_FragColor = vec4(test.x);"
+ "}",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "uniform testBlock {\n"
+ " float x;\n"
+ "} test;\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(test.x);\n"
+ "}\n");
+ test(r,
+ "uniform testBlock {"
+ "float x;"
+ "} test[2];"
+ "void main() {"
+ " sk_FragColor = vec4(test[1].x);"
+ "}",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "uniform testBlock {\n"
+ " float x;\n"
+ "} test[2];\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(test[1].x);\n"
"}\n");
}
@@ -702,4 +736,18 @@ DEF_TEST(SkSLClipDistance, r) {
" sk_FragColor = vec4(gl_ClipDistance[0]);\n"
"}\n");
}
+
+DEF_TEST(SkSLArrayTypes, r) {
+ test(r,
+ "void main() { vec2 x[2] = vec2[2](vec2(1), vec2(2));"
+ "vec2[2] y = vec2[2](vec2(3), vec2(4)); }",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "void main() {\n"
+ " vec2 x[2] = vec2[2](vec2(1.0), vec2(2.0));\n"
+ " vec2[2] y = vec2[2](vec2(3.0), vec2(4.0));\n"
+ "}\n");
+}
+
#endif