[Piglit] [PATCH 15/18] arb_geometry_shader4: Add basic 2d array tests.

Paul Berry stereotype441 at gmail.com
Sun Jun 16 22:02:04 PDT 2013


On 31 May 2013 14:49, Fabian Bieler <fabianbieler at fastmail.fm> wrote:

> Test basic indexing operations with 2d arrays.
> ---
>  .../arb_geometry_shader4/compiler/2darray01.geom   | 63
> +++++++++++++++++++
>  .../linker/2darray01.shader_test                   | 70
> ++++++++++++++++++++++
>  2 files changed, 133 insertions(+)
>  create mode 100644 tests/spec/arb_geometry_shader4/compiler/2darray01.geom
>  create mode 100644
> tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
>

We're trying to move away from the convention of naming tests with numbers
like "01", and instead use more descriptive names.  I'd recommend naming
these something like "2darray_basic.geom" and "2darray_basic.shader_test".
A similar comment applies to patches 16 and 17.


>
> diff --git a/tests/spec/arb_geometry_shader4/compiler/2darray01.geom
> b/tests/spec/arb_geometry_shader4/compiler/2darray01.geom
> new file mode 100644
> index 0000000..953d8af
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/compiler/2darray01.geom
> @@ -0,0 +1,63 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.20
> +// require_extensions: GL_ARB_geometry_shader4
> +// [end config]
> +
> +#version 120
> +#extension GL_ARB_geometry_shader4: enable
> +
> +uniform int zero;
> +
> +varying in float gs_input1[][6];
> +varying in float gs_input2[gl_VerticesIn][6];
> +
> +varying out float scalar;
> +varying out float array[6];
> +
> +float fs(float input_)
> +{
> +       return input_;
> +}
> +
> +float fa(float input_[6])
> +{
> +       return input_[zero];
> +}
> +
> +void main()
> +{
> +       //check implicitly sized input
> +       {
> +       //check assignments to local variables
> +       float a1[] = gs_input1[zero];
> +       float a2[6] = gs_input1[zero];
> +       float s = gs_input1[zero][zero];
> +
> +       //check passing as function parameters
> +       fa(gs_input1[zero]);
> +       fs(gs_input1[zero][zero]);
> +
> +       //check assignments to output variables
> +       array = gs_input1[zero];
> +       scalar = gs_input1[zero][zero];
> +       }
> +
> +
> +       //check explicitly sized input
> +       {
> +       //check assignments to local variables
> +       float a1[] = gs_input2[zero];
> +       float a2[6] = gs_input2[zero];
> +       float s = gs_input2[zero][zero];
> +
> +       //check passing as function parameters
> +       fa(gs_input2[zero]);
> +       fs(gs_input2[zero][zero]);
> +
> +       //check assignments to output variables
> +       array = gs_input2[zero];
> +       scalar = gs_input2[zero][zero];
> +       }
> +}
> +
> diff --git a/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
> b/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
> new file mode 100644
> index 0000000..42362f2
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
> @@ -0,0 +1,70 @@
> +#Basic test of gs 2d input arrays
> +[require]
> +GL >= 2.0
> +GLSL >= 1.20
> +GL_ARB_geometry_shader4
> +
> +[vertex shader]
> +#version 120
> +
> +attribute vec4 vertex;
> +
> +varying float gs_input[6];
> +
> +void main()
> +{
> +       for (int i = 0; i < 6; i++)
> +               gs_input[i] = 0.5;
>

Let's assign different values to the different elements of gl_input, and
make them depend on vertex.  That way we can verify, in the geometry
shader, that the correct values were received in each element of the
array.  For an existing test that does something similar, see
tests/spec/arb_geometry_shader4/execution/clip-distance-in-values.shader_test
(from http://lists.freedesktop.org/archives/piglit/2013-June/005986.html,
which I haven't had a chance to push upstream yet).


> +       gl_Position = vertex;
> +}
> +
> +[geometry shader]
> +#version 120
> +#extension GL_ARB_geometry_shader4: enable
> +
> +uniform int zero;
> +
> +varying in float gs_input[][6];
> +
> +varying out float scalar;
> +varying out float array[6];
> +
> +void main()
> +{
> +       for (int i = 0; i < gl_VerticesIn; i++) {
> +               array = gs_input[zero];
> +               scalar = gs_input[zero][zero];
> +
> +               gl_Position = gl_PositionIn[i];
> +               EmitVertex();
> +       }
> +}
> +
> +[geometry layout]
> +input type GL_TRIANGLES
> +output type GL_TRIANGLE_STRIP
> +vertices out 3
> +
> +[fragment shader]
> +#version 120
> +
> +const int gs_VerticesIn = 3;
> +
> +varying float scalar;
> +varying float array[6];
> +
> +void main()
> +{
> +  gl_FragColor = vec4(scalar, array[0], 0.5, 1.0);
> +}
> +
> +[vertex data]
> +vertex/float/2
> +-1.0 -1.0
> + 1.0 -1.0
> + 1.0  1.0
> +-1.0  1.0
> +
> +[test]
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgb 0.5 0.5 0.5
> --
> 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/05db672b/attachment.html>


More information about the Piglit mailing list