Add geometry shader test demonstrating max_vertices/invocations bug

Declaring max_vertices before invocations fails to adjust max_vertices
when invocation support is not present. (It should be 4, not 2 in this
case).

Bug: skia:10827
Change-Id: Ief7af97eabf5414ea8363808fc1ad2e9c480fe10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325664
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2020-10-12 15:26:20 -04:00 committed by Skia Commit-Bot
parent 6b4d5819af
commit 5d08a27530
4 changed files with 44 additions and 0 deletions

View File

@ -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",

View File

@ -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();
}

View File

@ -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();
}
}

View File

@ -0,0 +1,4 @@
### Compilation failed:
error: 1: unsupported kind of program
1 error