aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-21 11:25:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-21 15:55:06 +0000
commit7da6dfabc44891c51dedcb4754477b662d8c8a0a (patch)
treef64e1e88cbeb67319490ae138eb5afdb6175e627 /tests/SkSLGLSLTest.cpp
parentce57552e11776c8f93798c3a2244fa378604b4af (diff)
implemented mustImplementGSInvocationsWithLoop workaround in sksl
Third time's the charm This reverts commit 84cda40bd7e98f4e19574c6e946395e244901408. Bug: skia: Change-Id: I2c0f4425122a94beb7b4053ee6e891faa8a5f290 Reviewed-on: https://skia-review.googlesource.com/20441 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.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 2ea6c7ec71..a4a3c0e04f 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -1393,4 +1393,39 @@ DEF_TEST(SkSLDeadLoopVar, r) {
);
}
+DEF_TEST(SkSLInvocations, r) {
+ test(r,
+ "layout(points) in;"
+ "layout(invocations = 2) in;"
+ "layout(line_strip, max_vertices = 2) out;"
+ "void test() {"
+ "gl_Position = sk_in[0].gl_Position + vec4(0.5, 0, 0, sk_InvocationID);"
+ "EmitVertex();"
+ "}"
+ "void main() {"
+ "gl_Position = sk_in[0].gl_Position + vec4(-0.5, 0, 0, sk_InvocationID);"
+ "EmitVertex();"
+ "}",
+ *SkSL::ShaderCapsFactory::MustImplementGSInvocationsWithLoop(),
+ "#version 400\n"
+ "int sk_InvocationID;\n"
+ "layout (points) in ;\n"
+ "layout (line_strip, max_vertices = 4) out ;\n"
+ "void test() {\n"
+ " gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(sk_InvocationID));\n"
+ " EmitVertex();\n"
+ "}\n"
+ "void _invoke() {\n"
+ " gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(sk_InvocationID));\n"
+ " EmitVertex();\n"
+ "}\n"
+ "void main() {\n"
+ " for (sk_InvocationID = 0;sk_InvocationID < 2; sk_InvocationID++) {\n"
+ " _invoke();\n"
+ " EndPrimitive();\n"
+ " }\n"
+ "}\n",
+ SkSL::Program::kGeometry_Kind);
+}
+
#endif