[Piglit] [PATCH 1/3] GS: Test that geometry ins/outs can have flat/smooth/noperspective qualifiers
Paul Berry
stereotype441 at gmail.com
Mon Sep 16 09:36:19 PDT 2013
On 12 September 2013 10:47, Nicholas Mack <nichmack at gmail.com> wrote:
> ---
> .../gs-also-uses-smooth-flat-noperspective.geom | 25 ++++++
> ...also-uses-smooth-flat-noperspective.shader_test | 91
> ++++++++++++++++++++++
> 2 files changed, 116 insertions(+)
> create mode 100644
> tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
> create mode 100644
> tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
>
> diff --git
> a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
> b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
> new file mode 100644
> index 0000000..f1ab41e
> --- /dev/null
> +++
> b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
> @@ -0,0 +1,25 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// check_link: true
> +// [end config]
> +
> +#version 150
> +
> +layout(points) in;
> +layout(points, max_vertices = 1) out;
> +
> +flat in int a[];
> +noperspective in int b[];
> +smooth in int c[];
> +
> +flat out int aa;
> +noperspective out int bb;
> +smooth out int cc;
> +
> +void main()
> +{
> + aa = a[0];
> + bb = b[0];
> + cc = c[0];
> +}
>
This test looks good to me.
> diff --git
> a/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
> b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
> new file mode 100644
> index 0000000..e302806
> --- /dev/null
> +++
> b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
> @@ -0,0 +1,91 @@
> +# Test that the qualifiers 'smooth', 'flat', and 'noperspective' can
> appear on
> +# geometry shader ins and outs.
> +#
> +# From the GLSL 1.50 specification, section 4.3 ("Storage Qualifiers"):
> +#
> +# "Outputs from shader (out) and inputs to a shader (in) can be further
> +# qualified with one of these interpolation qualifiers:
> +# smooth
> +# flat
> +# noperspective"
> +
> +[require]
> +GL >= 3.2
> +GLSL >= 1.50
> +
> +[vertex shader]
> +
> +uniform float ref;
> +
> +in vec4 vertex;
> +
> +out vec4 pos;
> +flat out float a;
> +noperspective out float b;
> +smooth out float c;
> +
> +void main()
> +{
> + gl_Position = vertex;
> + pos = vertex;
> + a = ref + 1;
> + b = ref + 2;
> + c = ref + 3;
> +}
> +
> +[geometry shader]
> +
> +uniform float ref;
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +in vec4 pos[];
> +flat in float a[];
> +noperspective in float b[];
> +smooth in float c[];
> +
> +flat out float aa;
> +noperspective out float bb;
> +smooth out float cc;
> +
> +void main()
> +{
> + for(int i = 0; i < 3; i++) {
> + gl_Position = pos[i];
> + aa = a[i] + 1;
> + bb = b[i] + 2;
> + cc = c[i] + 3;
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +
> +uniform float ref;
> +
> +flat in float aa;
> +noperspective in float bb;
> +smooth in float cc;
> +
> +out vec4 color;
> +
> +void main()
> +{
> + if ((aa != ref + 2) || (bb != ref + 4) || (cc != ref + 6))
> + color = vec4(1.0, 0.0, 0.0, 1.0);
> + else
> + color = vec4(0.0, 1.0, 0.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]
> +uniform float ref 37.29060007
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgba 0.0 1.0 0.0 1.0
>
For this test, I think we need to go a step further and actually verify
that aa, bb, and cc are properly interpolated. (As is, the test would pass
even if the compiler just ignored the interpolation qualifiers and did
smooth interpolation on everything). I'd recommend doing something like
what's done in
tests/spec/glsl-1.30/execution/interpolation/interpolation-mixed.shader_test,
but with a geometry shader also present in the pipeline. (Note that
interpolation-mixed.shader_test currently makes use of
gl_ModelViewProjectionMatrix and the "frustum" command, which only exist in
the compatibility profile. These will have to be translated into their
core profile equivalents.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130916/ada27f97/attachment.html>
More information about the Piglit
mailing list