diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni index b231f54a4e..61f3ddb9ed 100644 --- a/gn/sksl_tests.gni +++ b/gn/sksl_tests.gni @@ -174,6 +174,7 @@ sksl_shared_tests = [ "$_tests/sksl/shared/GeometryExtension.geom", "$_tests/sksl/shared/GeometryGSInvocations.geom", "$_tests/sksl/shared/GeometryNoGSInvocations.geom", + "$_tests/sksl/shared/GeometryNoGSInvocationsReorder.geom", "$_tests/sksl/shared/Height.sksl", "$_tests/sksl/shared/HelloWorld.sksl", "$_tests/sksl/shared/Hex.sksl", diff --git a/tests/sksl/shared/GeometryNoGSInvocationsReorder.geom b/tests/sksl/shared/GeometryNoGSInvocationsReorder.geom new file mode 100644 index 0000000000..a2ca7a0599 --- /dev/null +++ b/tests/sksl/shared/GeometryNoGSInvocationsReorder.geom @@ -0,0 +1,20 @@ +/*#pragma settings NoGSInvocationsSupport*/ + +layout(points) in; + +// Subtle error: Declaring max_vertices before invocations causes us not to +// apply the workaround fixup to max_vertices. It *should* be 4 (2*2) in the +// GLSL, but is currently only 2. (skbug.com/10827) +layout(line_strip, max_vertices = 2) out; +layout(invocations = 2) in; + +void test() { + sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID); + EmitVertex(); +} + +void main() { + test(); + sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID); + EmitVertex(); +} diff --git a/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.glsl b/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.glsl new file mode 100644 index 0000000000..e0f06a7c4f --- /dev/null +++ b/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.glsl @@ -0,0 +1,19 @@ +#version 400 +int sk_InvocationID; +layout (points) in ; +layout (line_strip, max_vertices = 2) out ; +void _invoke() { + { + gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(sk_InvocationID)); + EmitVertex(); + } + + gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(sk_InvocationID)); + EmitVertex(); +} +void main() { + for (sk_InvocationID = 0;sk_InvocationID < 2; sk_InvocationID++) { + _invoke(); + EndPrimitive(); + } +} diff --git a/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.metal b/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.metal new file mode 100644 index 0000000000..def1023ea8 --- /dev/null +++ b/tests/sksl/shared/golden/GeometryNoGSInvocationsReorder.metal @@ -0,0 +1,4 @@ +### Compilation failed: + +error: 1: unsupported kind of program +1 error