[Piglit] [PATCH v2] arb_gs5: add nonconst sampler access tests

Chris Forbes chrisf at ijw.co.nz
Wed Sep 17 23:14:26 PDT 2014


Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

On Thu, Sep 18, 2014 at 6:10 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> These test some of the annoying cases of fermi/kepler instruction
> encodings.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> v1 -> v2:
>  - "proj" -> "grad" in filename
>  - replaced zero-like constant with zero uniform which should cause the code
>    to remain.
>
>  .../sampler-nonconst-2d-array-grad.shader_test     | 49 +++++++++++++++++++
>  .../sampler-nonconst-2d-array.shader_test          | 49 +++++++++++++++++++
>  .../sampler-nonconst-2d-grad.shader_test           | 55 ++++++++++++++++++++++
>  .../sampler-nonconst-2d.shader_test                | 55 ++++++++++++++++++++++
>  4 files changed, 208 insertions(+)
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test
>
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test
> new file mode 100644
> index 0000000..3336143
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test
> @@ -0,0 +1,49 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out vec4 texcoords;
> +
> +void main()
> +{
> +       gl_Position = piglit_vertex;
> +       texcoords = (piglit_vertex + 1.0) / 2.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +in vec4 texcoords;
> +
> +/* The idea is that the tex array doesn't come first (and so 'other' must get
> + * some sort of usage), and we also want to ensure that the index is actually
> + * respected.
> + */
> +uniform sampler2DArray other;
> +uniform sampler2DArray tex[3];
> +uniform int n;
> +uniform float zero = 0.0;
> +
> +void main()
> +{
> +       gl_FragColor = textureGrad(tex[n], vec3(texcoords.xy, 1.0), vec2(0), vec2(0)) +
> +               texture(other, vec3(texcoords.xy, 1.0)) * zero;
> +}
> +
> +[test]
> +uniform int other 2
> +uniform int tex[0] 3
> +uniform int tex[1] 1
> +uniform int tex[2] 4
> +uniform int n 1
> +
> +texture rgbw 2DArray 1 (8, 8, 4)
> +texture junk 2DArray 2 (8, 8, 4)
> +texture junk 2DArray 3 (8, 8, 4)
> +texture junk 2DArray 4 (8, 8, 4)
> +
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test
> new file mode 100644
> index 0000000..5a96189
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test
> @@ -0,0 +1,49 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out vec4 texcoords;
> +
> +void main()
> +{
> +       gl_Position = piglit_vertex;
> +       texcoords = (piglit_vertex + 1.0) / 2.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +in vec4 texcoords;
> +
> +/* The idea is that the tex array doesn't come first (and so 'other' must get
> + * some sort of usage), and we also want to ensure that the index is actually
> + * respected.
> + */
> +uniform sampler2DArray other;
> +uniform sampler2DArray tex[3];
> +uniform int n;
> +uniform float zero = 0.0;
> +
> +void main()
> +{
> +       gl_FragColor = texture(tex[n], vec3(texcoords.xy, 1.0)) +
> +               texture(other, vec3(texcoords.xy, 1.0)) * zero;
> +}
> +
> +[test]
> +uniform int other 2
> +uniform int tex[0] 3
> +uniform int tex[1] 1
> +uniform int tex[2] 4
> +uniform int n 1
> +
> +texture rgbw 2DArray 1 (8, 8, 4)
> +texture junk 2DArray 2 (8, 8, 4)
> +texture junk 2DArray 3 (8, 8, 4)
> +texture junk 2DArray 4 (8, 8, 4)
> +
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test
> new file mode 100644
> index 0000000..72c5ffc
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test
> @@ -0,0 +1,55 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out vec4 texcoords;
> +
> +void main()
> +{
> +       gl_Position = piglit_vertex;
> +       texcoords = (piglit_vertex + 1.0) / 2.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +in vec4 texcoords;
> +
> +/* The idea is that the tex array doesn't come first (and so 'other' must get
> + * some sort of usage), and we also want to ensure that the index is actually
> + * respected.
> + */
> +uniform sampler2D other;
> +uniform sampler2D tex[3];
> +uniform int n;
> +uniform float zero = 0.0;
> +
> +void main()
> +{
> +       gl_FragColor = textureGrad(tex[n], texcoords.xy, vec2(0), vec2(0)) +
> +               texture(other, texcoords.xy) * zero;
> +}
> +
> +[test]
> +uniform int other 2
> +uniform int tex[0] 3
> +uniform int tex[1] 1
> +uniform int tex[2] 4
> +uniform int n 1
> +
> +texture rgbw 1 (8, 8)
> +texture checkerboard 2 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 1.0, 0.0, 0.0)
> +texparameter 2D min linear
> +texture checkerboard 3 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (0.0, 1.0, 1.0, 0.0)
> +texparameter 2D min linear
> +texture checkerboard 4 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 0.0, 1.0, 0.0)
> +texparameter 2D min linear
> +
> +draw rect -1 -1 2 2
> +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
> +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
> +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
> +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
> diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test
> new file mode 100644
> index 0000000..483911a
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test
> @@ -0,0 +1,55 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out vec4 texcoords;
> +
> +void main()
> +{
> +       gl_Position = piglit_vertex;
> +       texcoords = (piglit_vertex + 1.0) / 2.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +in vec4 texcoords;
> +
> +/* The idea is that the tex array doesn't come first (and so 'other' must get
> + * some sort of usage), and we also want to ensure that the index is actually
> + * respected.
> + */
> +uniform sampler2D other;
> +uniform sampler2D tex[3];
> +uniform int n;
> +uniform float zero = 0.0;
> +
> +void main()
> +{
> +       gl_FragColor = texture(tex[n], texcoords.xy) +
> +               texture(other, texcoords.xy) * zero;
> +}
> +
> +[test]
> +uniform int other 2
> +uniform int tex[0] 3
> +uniform int tex[1] 1
> +uniform int tex[2] 4
> +uniform int n 1
> +
> +texture rgbw 1 (8, 8)
> +texture checkerboard 2 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 1.0, 0.0, 0.0)
> +texparameter 2D min linear
> +texture checkerboard 3 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (0.0, 1.0, 1.0, 0.0)
> +texparameter 2D min linear
> +texture checkerboard 4 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 0.0, 1.0, 0.0)
> +texparameter 2D min linear
> +
> +draw rect -1 -1 2 2
> +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
> +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
> +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
> +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
> --
> 1.8.5.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list