[Piglit] [PATCH 18/18] arb_geometry_shader4: Test that gl_VerticesIn is const.

Paul Berry stereotype441 at gmail.com
Sun Jun 16 22:15:57 PDT 2013


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

> Test that gl_VerticesIn can be used as a valid constant expression.
>
> Also test that it evaluates to 3 for triangles.
>

Ok, I've finished reviewing the series at last!  Thanks for your patience.

I sent responses on patches 1-8, 10, 12, 13, and 15-17.

Patches 9, 11, 14, and 18 are:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>

Thanks again for your hard work on this patch series.  I hope my review
comments aren't too onerous.  In general the series looks really good, and
I'm looking forward to merging it upstream!

>
> ---
>  .../compiler/verticesin-const-expression.geom      | 31 ++++++++
>  .../compiler/verticesin-const.geom                 | 31 ++++++++
>  .../linker/verticesin-const.shader_test            | 91
> ++++++++++++++++++++++
>  3 files changed, 153 insertions(+)
>  create mode 100644
> tests/spec/arb_geometry_shader4/compiler/verticesin-const-expression.geom
>  create mode 100644
> tests/spec/arb_geometry_shader4/compiler/verticesin-const.geom
>  create mode 100644
> tests/spec/arb_geometry_shader4/linker/verticesin-const.shader_test
>
> diff --git
> a/tests/spec/arb_geometry_shader4/compiler/verticesin-const-expression.geom
> b/tests/spec/arb_geometry_shader4/compiler/verticesin-const-expression.geom
> new file mode 100644
> index 0000000..f4b77f7
> --- /dev/null
> +++
> b/tests/spec/arb_geometry_shader4/compiler/verticesin-const-expression.geom
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.30
> +// require_extensions: GL_ARB_geometry_shader4
> +// [end config]
> +
> +#version 130
> +#extension GL_ARB_geometry_shader4: enable
> +
> +uniform int idx;
> +uniform sampler2D tex;
> +uniform sampler2D tex_array[10];
> +
> +void main()
> +{
> +       //All quotes are from the glsl 1.3 specification.
> +
> +       //"Samplers aggregated into arrays within a shader [...] can only
> be indexed with integral constant expressions"
> +       texture(tex_array[gl_VerticesIn * 2 - 2], vec2(0, 0));
> +
> +       //"When an array size is specified in a declaration, it must be an
> integral constant expression"
> +       float array[gl_VerticesIn * 2 - 2];
> +       array[idx];
> +
> +       //"Initializers for const declarations must be constant expression"
> +       const int var = gl_VerticesIn * 2 - 2;
> +
> +       //"The offset value must be a constant expression."
> +       textureOffset(tex, vec2(0, 0), ivec2(gl_VerticesIn * 2 - 2));
> +}
> +
> diff --git
> a/tests/spec/arb_geometry_shader4/compiler/verticesin-const.geom
> b/tests/spec/arb_geometry_shader4/compiler/verticesin-const.geom
> new file mode 100644
> index 0000000..f7aec2a
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/compiler/verticesin-const.geom
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.30
> +// require_extensions: GL_ARB_geometry_shader4
> +// [end config]
> +
> +#version 130
> +#extension GL_ARB_geometry_shader4: enable
> +
> +uniform int idx;
> +uniform sampler2D tex;
> +uniform sampler2D tex_array[7];
> +
> +void main()
> +{
> +       //All quotes are from the glsl 1.3 specification.
> +
> +       //"Samplers aggregated into arrays within a shader [...] can only
> be indexed with integral constant expressions"
> +       texture(tex_array[gl_VerticesIn], vec2(0, 0));
> +
> +       //"When an array size is specified in a declaration, it must be an
> integral constant expression"
> +       float array[gl_VerticesIn];
> +       array[idx];
> +
> +       //"Initializers for const declarations must be constant expression"
> +       const int var = gl_VerticesIn;
> +
> +       //"The offset value must be a constant expression."
> +       textureOffset(tex, vec2(0, 0), ivec2(gl_VerticesIn));
> +}
> +
> diff --git
> a/tests/spec/arb_geometry_shader4/linker/verticesin-const.shader_test
> b/tests/spec/arb_geometry_shader4/linker/verticesin-const.shader_test
> new file mode 100644
> index 0000000..5f697ee
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/linker/verticesin-const.shader_test
> @@ -0,0 +1,91 @@
> +[require]
> +GL >= 2.0
> +GLSL >= 1.30
> +GL_ARB_geometry_shader4
> +
> +[vertex shader]
> +#version 130
> +
> +in vec4 vertex;
> +
> +out float gs_input[6];
> +void main()
> +{
> +       for (int i = 0; i < 6; i++)
> +               gs_input[i] = 0.5;
> +       gl_Position = vertex;
> +}
> +
> +[geometry shader]
> +#version 130
> +#extension GL_ARB_geometry_shader4: enable
> +#line 22
> +
> +uniform int zero;
> +uniform sampler2D tex;
> +uniform sampler2D tex_array[7];
> +
> +in float gs_input[][6];
> +
> +out vec4 color;
> +
> +void main()
> +{
> +       for (int i = 0; i < gl_VerticesIn; i++) {
> +               vec4 c = vec4(0, 0, 0, 1);
> +               c.x = texture(tex_array[gl_VerticesIn], vec2(0.5, 0.5)).x;
> +
> +               const int three = gl_VerticesIn;
> +               if (three == 3)
> +                       c.y = 1.0;
> +               else
> +                       c.y = 0.0;
> +
> +               //We sample from a row of 8 pixels, the left 4 blue and
> the right 4 white.
> +               //Since we only use the red channel, the left 4 are 0, and
> the right 4 are 1.
> +               //sample twice from the fith pixel in the row:
> +               c.z = textureOffset(tex, vec2(3.0/16.0, 0.75),
> ivec2(gl_VerticesIn, 0)).x;
> +               c.z *= textureOffset(tex, vec2(15.0/16.0, 0.75),
> ivec2(gl_VerticesIn, 0)).x;
> +
> +               gl_Position = gl_PositionIn[i];
> +               color = c;
> +               EmitVertex();
> +       }
> +}
> +
> +[geometry layout]
> +input type GL_TRIANGLES
> +output type GL_TRIANGLE_STRIP
> +vertices out 3
> +
> +[fragment shader]
> +#version 130
> +
> +in vec4 color;
> +
> +void main()
> +{
> +  gl_FragColor = color;
> +}
> +
> +[vertex data]
> +vertex/float/2
> +-1.0 -1.0
> + 1.0 -1.0
> + 1.0  1.0
> +-1.0  1.0
> +
> +[test]
> +uniform int tex_array[0] 1
> +uniform int tex_array[1] 1
> +uniform int tex_array[2] 1
> +uniform int tex_array[3] 2
> +uniform int tex_array[4] 1
> +uniform int tex_array[5] 1
> +uniform int tex_array[6] 1
> +uniform int tex 0
> +texture rgbw 0 (8, 8)
> +texture checkerboard 1 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0)
> +texture checkerboard 2 0 (8, 8) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0)
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgb 1.0 1.0 1.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/765b3585/attachment-0001.html>


More information about the Piglit mailing list