From d5d323f45777c4766ddf4c74eedff36ee5d9bc56 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Mon, 12 Jun 2017 12:05:44 -0400 Subject: implemented mustImplementGSInvocationsWithLoop workaround in sksl Bug: skia: Change-Id: I8434be89537a8baf9e9c5c7a643d28c03108f4ea Reviewed-on: https://skia-review.googlesource.com/18154 Reviewed-by: Chris Dalton Commit-Queue: Ethan Nicholas --- tests/SkSLGLSLTest.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/SkSLGLSLTest.cpp') 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 -- cgit v1.2.3