aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r--tests/SkSLGLSLTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 2ea6c7ec71..23888e0fbf 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -1393,4 +1393,34 @@ 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 main() {"
+ "gl_Position = sk_in[0].gl_Position + vec4(-0.5, 0, 0, sk_InvocationID);"
+ "EmitVertex();"
+ "gl_Position = sk_in[0].gl_Position + vec4(0.5, 0, 0, sk_InvocationID);"
+ "EmitVertex();"
+ "}",
+ *SkSL::ShaderCapsFactory::MustImplementGSInvocationsWithLoop(),
+ "#version 400\n"
+ "layout (points) in ;\n"
+ "layout (line_strip, max_vertices = 4) out ;\n"
+ "void _invoke(int sk_InvocationID) {\n"
+ " gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(sk_InvocationID));\n"
+ " EmitVertex();\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 (int i = 0;i < 2; i++) {\n"
+ " _invoke(i);\n"
+ " EndPrimitive();\n"
+ " }\n"
+ "}\n",
+ SkSL::Program::kGeometry_Kind);
+}
+
#endif