[Piglit] [PATCH 13/18] arb_geometry_shader4: Test geometry shader that doesn't generate any primitives.

Paul Berry stereotype441 at gmail.com
Sun Jun 16 21:50:54 PDT 2013


On 25 May 2013 22:44, Fabian Bieler <fabianbieler at fastmail.fm> wrote:

> ---
>  .../execution/generate-zero-primitives.shader_test | 55
> ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644
> tests/spec/arb_geometry_shader4/execution/generate-zero-primitives.shader_test
>
> diff --git
> a/tests/spec/arb_geometry_shader4/execution/generate-zero-primitives.shader_test
> b/tests/spec/arb_geometry_shader4/execution/generate-zero-primitives.shader_test
> new file mode 100644
> index 0000000..d6d5b5b
> --- /dev/null
> +++
> b/tests/spec/arb_geometry_shader4/execution/generate-zero-primitives.shader_test
> @@ -0,0 +1,55 @@
> +[require]
> +GL >= 2.0
> +GLSL >= 1.10
> +GL_ARB_geometry_shader4
> +
> +[vertex shader]
> +#version 110
> +
> +attribute vec4 vertex;
> +
> +void main()
> +{
> +       gl_Position = vertex;
> +}
> +
> +[geometry shader]
> +#version 110
> +#extension GL_ARB_geometry_shader4: enable
> +
> +void main()
> +{
> +       int minus_one = -1;
> +       for (int i = 0; i < 3; i++) {
> +               minus_one += int(gl_PositionIn[i].x + gl_PositionIn[i].y);
> +       }
> +       /* minus_one should still be -1. */
> +       for (int i = 0; i < minus_one; i++) {
> +               gl_Position = gl_PositionIn[i];
> +               EmitVertex();
> +       }
> +}
>

This seems like a lot of effort to go to, when you could get the same
effect from:

void main()
{
}

What's the goal in doing the extra work?


> +
> +[geometry layout]
> +input type GL_TRIANGLES
> +output type GL_TRIANGLE_STRIP
> +vertices out 3
> +
> +[fragment shader]
> +#version 110
> +
> +void main()
> +{
> +       gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
> +}
> +
> +[vertex data]
> +vertex/float/2
> +-1.0 -1.0
> + 1.0 -1.0
> + 1.0  1.0
> +-1.0  1.0
> +
> +[test]
>

The contents of the back buffer are undefined at the start of the test.  To
make the test deterministic, you'll need to add this:

clear color 0.0 0.0 0.0 0.0
clear


> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgb 0.0 0.0 0.0
>
--
> 1.8.1.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130617/28bd5721/attachment.html>


More information about the Piglit mailing list