[Piglit] [PATCH 1/2] arb_gpu_shader5: Test variable sampler indexing under non-uniform control flow.

Ian Romanick idr at freedesktop.org
Thu Feb 19 11:03:39 PST 2015


I'm going to spend some quality time with these tests before I send back
full review.  In the meantime, I have a question.  Do any of these tests
pass on AMD?  I'm sure that they pass on NVIDIA because NVIDIA goes to
extra effort to even make non-uniform indexing work.

On 02/19/2015 07:55 AM, Francisco Jerez wrote:
> Both the FS and VS cases currently fail on Intel hardware with the i965 driver.
> ---
>  .../fs-nonuniform-control-flow.shader_test         | 107 +++++++++++++
>  .../vs-nonuniform-control-flow.shader_test         | 171 +++++++++++++++++++++
>  2 files changed, 278 insertions(+)
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nonuniform-control-flow.shader_test
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-nonuniform-control-flow.shader_test
> 
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nonuniform-control-flow.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nonuniform-control-flow.shader_test
> new file mode 100644
> index 0000000..0593283
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nonuniform-control-flow.shader_test
> @@ -0,0 +1,107 @@
> +# The spec requires sampler array indexing expressions to be
> +# dynamically uniform, as defined in section 3.8.3 of the GLSL 4.50
> +# specification:
> +#
> +# "A fragment-shader expression is dynamically uniform if all
> +#  fragments evaluating it get the same resulting value. [...] This
> +#  is similarly defined for other shader stages, based on the
> +#  per-instance data they process."
> +#
> +# This however doesn't have any implications on the control flow that
> +# leads to the evaluation of that expression being uniform, so it's
> +# easy to get wrong.  This test verifies that dynamically uniform
> +# sampler indexing expressions are evaluated correctly in the fragment
> +# shader under non-uniform control flow.
> +#
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: require
> +
> +uniform sampler2D s[4];
> +
> +uniform uint n;
> +
> +out vec4 color;
> +
> +void main()
> +{
> +        vec4 v = vec4(0);
> +
> +        if (int(gl_FragCoord.x) % 2 != int(gl_FragCoord.y) % 3) {
> +                for (uint i = 0; i < 4; ++i)
> +                       v[i] = texture(s[(n + i) % 4u], vec2(0.5, 0.5)).x;
> +        }
> +
> +        color = v;
> +}
> +
> +[test]
> +clear color 0.2 0.2 0.2 0.2
> +clear
> +
> +uniform int s[0] 0
> +uniform int s[1] 1
> +uniform int s[2] 2
> +uniform int s[3] 3
> +
> +texture checkerboard 0 0 (32, 32) (0.2, 0.0, 0.0, 0.0) (0.2, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 1 0 (32, 32) (0.4, 0.0, 0.0, 0.0) (0.4, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 2 0 (32, 32) (0.6, 0.0, 0.0, 0.0) (0.6, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 3 0 (32, 32) (0.8, 0.0, 0.0, 0.0) (0.8, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +uniform uint n 1
> +draw rect -1 -1 1 1
> +
> +# This is likely to give the expected result for some fragments even
> +# if the implementation doesn't take this possibility into account.
> +# Probe a bunch of pixels for good measure.
> +#
> +probe rgba 1 0 0.4 0.6 0.8 0.2
> +probe rgba 3 0 0.4 0.6 0.8 0.2
> +probe rgba 5 0 0.4 0.6 0.8 0.2
> +probe rgba 7 0 0.4 0.6 0.8 0.2
> +probe rgba 0 1 0.4 0.6 0.8 0.2
> +probe rgba 2 1 0.4 0.6 0.8 0.2
> +probe rgba 4 1 0.4 0.6 0.8 0.2
> +probe rgba 6 1 0.4 0.6 0.8 0.2
> +probe rgba 0 2 0.4 0.6 0.8 0.2
> +probe rgba 1 2 0.4 0.6 0.8 0.2
> +probe rgba 2 2 0.4 0.6 0.8 0.2
> +probe rgba 3 2 0.4 0.6 0.8 0.2
> +probe rgba 4 2 0.4 0.6 0.8 0.2
> +probe rgba 5 2 0.4 0.6 0.8 0.2
> +probe rgba 6 2 0.4 0.6 0.8 0.2
> +probe rgba 7 2 0.4 0.6 0.8 0.2
> +probe rgba 1 3 0.4 0.6 0.8 0.2
> +probe rgba 3 3 0.4 0.6 0.8 0.2
> +probe rgba 5 3 0.4 0.6 0.8 0.2
> +probe rgba 7 3 0.4 0.6 0.8 0.2
> +probe rgba 0 4 0.4 0.6 0.8 0.2
> +probe rgba 2 4 0.4 0.6 0.8 0.2
> +probe rgba 4 4 0.4 0.6 0.8 0.2
> +probe rgba 6 4 0.4 0.6 0.8 0.2
> +probe rgba 0 5 0.4 0.6 0.8 0.2
> +probe rgba 1 5 0.4 0.6 0.8 0.2
> +probe rgba 2 5 0.4 0.6 0.8 0.2
> +probe rgba 3 5 0.4 0.6 0.8 0.2
> +probe rgba 4 5 0.4 0.6 0.8 0.2
> +probe rgba 5 5 0.4 0.6 0.8 0.2
> +probe rgba 6 5 0.4 0.6 0.8 0.2
> +probe rgba 7 5 0.4 0.6 0.8 0.2
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-nonuniform-control-flow.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-nonuniform-control-flow.shader_test
> new file mode 100644
> index 0000000..07710db
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/vs-nonuniform-control-flow.shader_test
> @@ -0,0 +1,171 @@
> +# The spec requires sampler array indexing expressions to be
> +# dynamically uniform, as defined in section 3.8.3 of the GLSL 4.50
> +# specification:
> +#
> +# "A fragment-shader expression is dynamically uniform if all
> +#  fragments evaluating it get the same resulting value. [...] This
> +#  is similarly defined for other shader stages, based on the
> +#  per-instance data they process."
> +#
> +# This however doesn't have any implications on the control flow that
> +# leads to the evaluation of that expression being uniform, so it's
> +# easy to get wrong.  This test verifies that dynamically uniform
> +# sampler indexing expressions are evaluated correctly in the vertex
> +# shader under non-uniform control flow.
> +#
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: require
> +
> +uniform sampler2D s[4];
> +
> +uniform uint n;
> +
> +in vec4 vertex;
> +out vec4 color;
> +
> +void main()
> +{
> +        vec4 v = vec4(0);
> +
> +        if (int(round(10 * vertex.x)) % 2 != int(round(10 * vertex.y)) % 3) {
> +                for (uint i = 0; i < 4; ++i)
> +                       v[i] = texture(s[(n + i) % 4u], vec2(0.5, 0.5)).x;
> +        }
> +
> +        gl_Position = vec4(-1 + 1.0 / 250.0 + vertex.x * 2,
> +                           -1 + 1.0 / 250.0 + vertex.y * 2,
> +                           0, 1);
> +        color = v;
> +}
> +
> +[fragment shader]
> +#version 150
> +
> +in vec4 color;
> +out vec4 out_color;
> +
> +void main()
> +{
> +        out_color = color;
> +}
> +
> +[vertex data]
> +vertex/float/3
> +0.0 0.0 0.0
> +0.0 0.1 0.0
> +0.0 0.2 0.0
> +0.0 0.3 0.0
> +0.0 0.4 0.0
> +0.0 0.5 0.0
> +0.1 0.0 0.0
> +0.1 0.1 0.0
> +0.1 0.2 0.0
> +0.1 0.3 0.0
> +0.1 0.4 0.0
> +0.1 0.5 0.0
> +0.2 0.0 0.0
> +0.2 0.1 0.0
> +0.2 0.2 0.0
> +0.2 0.3 0.0
> +0.2 0.4 0.0
> +0.2 0.5 0.0
> +0.3 0.0 0.0
> +0.3 0.1 0.0
> +0.3 0.2 0.0
> +0.3 0.3 0.0
> +0.3 0.4 0.0
> +0.3 0.5 0.0
> +0.4 0.0 0.0
> +0.4 0.1 0.0
> +0.4 0.2 0.0
> +0.4 0.3 0.0
> +0.4 0.4 0.0
> +0.4 0.5 0.0
> +0.5 0.0 0.0
> +0.5 0.1 0.0
> +0.5 0.2 0.0
> +0.5 0.3 0.0
> +0.5 0.4 0.0
> +0.5 0.5 0.0
> +0.6 0.0 0.0
> +0.6 0.1 0.0
> +0.6 0.2 0.0
> +0.6 0.3 0.0
> +0.6 0.4 0.0
> +0.6 0.5 0.0
> +0.7 0.0 0.0
> +0.7 0.1 0.0
> +0.7 0.2 0.0
> +0.7 0.3 0.0
> +0.7 0.4 0.0
> +0.7 0.5 0.0
> +
> +[test]
> +clear color 0.2 0.2 0.2 0.2
> +clear
> +
> +uniform int s[0] 0
> +uniform int s[1] 1
> +uniform int s[2] 2
> +uniform int s[3] 3
> +
> +texture checkerboard 0 0 (32, 32) (0.2, 0.0, 0.0, 0.0) (0.2, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 1 0 (32, 32) (0.4, 0.0, 0.0, 0.0) (0.4, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 2 0 (32, 32) (0.6, 0.0, 0.0, 0.0) (0.6, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +texture checkerboard 3 0 (32, 32) (0.8, 0.0, 0.0, 0.0) (0.8, 0.0, 0.0, 0.0)
> +texparameter 2D min nearest
> +texparameter 2D mag nearest
> +
> +uniform uint n 1
> +draw arrays GL_POINTS 0 48
> +
> +# This is likely to give the expected result for some vertices even if
> +# the implementation doesn't take this possibility into account.
> +# Probe a bunch of pixels for good measure.
> +#
> +relative probe rgba (0.1, 0.0) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.3, 0.0) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.5, 0.0) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.7, 0.0) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.0, 0.1) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.2, 0.1) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.4, 0.1) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.6, 0.1) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.0, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.1, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.2, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.3, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.4, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.5, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.6, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.7, 0.2) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.1, 0.3) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.3, 0.3) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.5, 0.3) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.7, 0.3) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.0, 0.4) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.2, 0.4) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.4, 0.4) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.6, 0.4) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.0, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.1, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.2, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.3, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.4, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.5, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.6, 0.5) (0.4, 0.6, 0.8, 0.2)
> +relative probe rgba (0.7, 0.5) (0.4, 0.6, 0.8, 0.2)
> 



More information about the Piglit mailing list