[Piglit] [PATCH] gs: Test that a single shader can redeclare both gl_PerVertex input and output.
Jordan Justen
jljusten at gmail.com
Tue Oct 8 23:36:56 CEST 2013
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
On Tue, Oct 8, 2013 at 1:59 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> ---
> ...gs-redeclares-both-pervertex-blocks.shader_test | 67 ++++++++++++++++++++++
> 1 file changed, 67 insertions(+)
> create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test
>
> diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test
> new file mode 100644
> index 0000000..7b8aafb
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test
> @@ -0,0 +1,67 @@
> +# This test verifies that a single geometry shader can redeclare both
> +# the gl_PerVertex input and gl_PerVertex output interface blocks
> +# without error, and that data is properly exchanged with the vertex
> +# and fragment shaders.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +out gl_PerVertex {
> + float gl_PointSize;
> +};
> +
> +void main()
> +{
> + gl_PointSize = float(gl_VertexID);
> +}
> +
> +[geometry shader]
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 4) out;
> +
> +in gl_PerVertex {
> + float gl_PointSize;
> +} gl_in[];
> +
> +out gl_PerVertex {
> + vec4 gl_Position;
> +};
> +
> +out vec4 color;
> +
> +void main()
> +{
> + const vec4 vertices[4] = vec4[4](
> + vec4(-1.0, -1.0, 0.0, 1.0),
> + vec4(-1.0, 1.0, 0.0, 1.0),
> + vec4( 1.0, -1.0, 0.0, 1.0),
> + vec4( 1.0, 1.0, 0.0, 1.0)
> + );
> +
> + bool pass = true;
> + for (int i = 0; i < 3; i++) {
> + if (gl_in[i].gl_PointSize != float(i))
> + pass = false;
> + }
> +
> + for (int i = 0; i < 4; i++) {
> + color = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> + gl_Position = vertices[i];
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +in vec4 color;
> +
> +void main()
> +{
> + gl_FragColor = color;
> +}
> +
> +[test]
> +clear color 0.0 0.0 0.0 0.0
> +clear
> +draw arrays GL_TRIANGLES 0 3
> +probe all rgba 0.0 1.0 0.0 1.0
> --
> 1.8.4
>
More information about the Piglit
mailing list