[Piglit] [PATCH] vulkan: test cases for large local arrays

Neil Roberts nroberts at igalia.com
Thu Nov 8 11:32:21 UTC 2018


Looks good to me 👍

Reviewed-by: Neil Roberts <nroberts at igalia.com>

- Neil

Alejandro Piñeiro <apinheiro at igalia.com> writes:

> Equivalent to the GLSL tests added with the series "Test cases for
> large GLSL local arrays". Quoting from the cover-letter of that
> series:
>
>    "Drivers typically need special handling for local array storage
>     when arrays exceed a certain size, this adds a few test cases for
>     exercising some corner cases that were useful when implementing
>     support for this in the r600g driver."
>
> Right now only two of the tests included on this series is passing
> (local-array and multiple). But all of them were working until the the
> following commit:
>    * b3c6146925595ec3a7eece3afb9ccaad32906d4c ("nir: Copy propagation between blocks")
>
> So it is fact, a regression. More info on
>   https://bugs.freedesktop.org/show_bug.cgi?id=108624
>
> Original GLSL series:
>   https://lists.freedesktop.org/archives/piglit/2017-March/021867.html
> ---
>  .../fs-large-local-array-vec2.vk_shader_test       | 38 +++++++++++++++++
>  .../fs-large-local-array-vec3.vk_shader_test       | 38 +++++++++++++++++
>  .../fs-large-local-array-vec4.vk_shader_test       | 38 +++++++++++++++++
>  .../shaders/fs-large-local-array.vk_shader_test    | 47 ++++++++++++++++++++++
>  .../fs-multiple-large-local-array.vk_shader_test   | 40 ++++++++++++++++++
>  5 files changed, 201 insertions(+)
>  create mode 100644 tests/vulkan/shaders/fs-large-local-array-vec2.vk_shader_test
>  create mode 100644 tests/vulkan/shaders/fs-large-local-array-vec3.vk_shader_test
>  create mode 100644 tests/vulkan/shaders/fs-large-local-array-vec4.vk_shader_test
>  create mode 100644 tests/vulkan/shaders/fs-large-local-array.vk_shader_test
>  create mode 100644 tests/vulkan/shaders/fs-multiple-large-local-array.vk_shader_test
>
> diff --git a/tests/vulkan/shaders/fs-large-local-array-vec2.vk_shader_test b/tests/vulkan/shaders/fs-large-local-array-vec2.vk_shader_test
> new file mode 100644
> index 000000000..6fbf71d50
> --- /dev/null
> +++ b/tests/vulkan/shaders/fs-large-local-array-vec2.vk_shader_test
> @@ -0,0 +1,38 @@
> +# Tests a large vec2 local array.
> +# Vulkan equivalent to tests/spec/glsl-1.30/execution/fs-large-local-array-vec2.shader_test
> +
> +[require]
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 450
> +
> +layout (binding = 5) uniform block {
> +       uint i;
> +};
> +
> +layout (location = 0) out vec4 out_color;
> +
> +void main()
> +{
> +	vec2 A[130];
> +	A[20].g = 0;
> +	A[i].g = 37;
> +	A[i].r = 1;
> +        out_color.rba = vec3(0.0, 0.0, 1.0);
> +	out_color.g = float(A[20].g == 37);
> +}
> +
> +[test]
> +clear color 1.0 0.0 0.0 1.0
> +clear
> +
> +uniform ubo 5 uint 0 19
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 1.0
> +
> +clear
> +uniform ubo 5 uint 0 20
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/vulkan/shaders/fs-large-local-array-vec3.vk_shader_test b/tests/vulkan/shaders/fs-large-local-array-vec3.vk_shader_test
> new file mode 100644
> index 000000000..8c00bc720
> --- /dev/null
> +++ b/tests/vulkan/shaders/fs-large-local-array-vec3.vk_shader_test
> @@ -0,0 +1,38 @@
> +# Tests a large vec3 local array.
> +# Vulkan equivalent to tests/spec/glsl-1.30/execution/fs-large-local-array-vec3.shader_test
> +
> +[require]
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 450
> +
> +layout (binding = 5) uniform block {
> +       uint i;
> +};
> +
> +layout (location = 0) out vec4 out_color;
> +
> +void main()
> +{
> +	vec3 A[130];
> +	A[20].g = 0;
> +	A[i].g = 37;
> +	A[i].r = 1;
> +        out_color.rba = vec3(0.0, 0.0, 1.0);
> +	out_color.g = float(A[20].g == 37);
> +}
> +
> +[test]
> +clear color 1.0 0.0 0.0 1.0
> +clear
> +
> +uniform ubo 5 uint 0 19
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 1.0
> +
> +clear
> +uniform ubo 5 uint 0 20
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/vulkan/shaders/fs-large-local-array-vec4.vk_shader_test b/tests/vulkan/shaders/fs-large-local-array-vec4.vk_shader_test
> new file mode 100644
> index 000000000..6239bfee6
> --- /dev/null
> +++ b/tests/vulkan/shaders/fs-large-local-array-vec4.vk_shader_test
> @@ -0,0 +1,38 @@
> +# Tests a large vec4 local array.
> +# Vulkan equivalent to tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test
> +
> +[require]
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 450
> +
> +layout (binding = 5) uniform block {
> +       uint i;
> +};
> +
> +layout (location = 0) out vec4 out_color;
> +
> +void main()
> +{
> +	vec4 A[130];
> +	A[20].g = 0;
> +	A[i].g = 37;
> +	A[i].r = 1;
> +        out_color.rba = vec3(0.0, 0.0, 1.0);
> +	out_color.g = float(A[20].g == 37);
> +}
> +
> +[test]
> +clear color 1.0 0.0 0.0 1.0
> +clear
> +
> +uniform ubo 5 uint 0 19
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 1.0
> +
> +clear
> +uniform ubo 5 uint 0 20
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/vulkan/shaders/fs-large-local-array.vk_shader_test b/tests/vulkan/shaders/fs-large-local-array.vk_shader_test
> new file mode 100644
> index 000000000..c62109ee1
> --- /dev/null
> +++ b/tests/vulkan/shaders/fs-large-local-array.vk_shader_test
> @@ -0,0 +1,47 @@
> +# Tests a large uint local array.
> +# Vulkan equivalent to tests/spec/glsl-1.30/execution/fs-large-local-array.shader_test
> +# And quoting from that test:
> +#
> +#    "Test correct handling of local-scope declared arrays large enough to
> +#     typically not fit into first level GPU memory such as its register file,
> +#     requiring storing/loading to some device-specific scratch space.
> +#
> +#     One hardware example is R600 where arrays larger than 124*vec4 cannot
> +#     fit into its GPR register file and has to be spilled to scratch memory.
> +#     As of 2017-03-06 this is the largest known register file of any GPU, so
> +#     the test uses that as a size to guarantee some form of spilling on any GPU."
> +
> +[require]
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 450
> +
> +layout (binding = 5) uniform block {
> +       uint i;
> +};
> +
> +layout (location = 0) out vec4 out_color;
> +
> +void main()
> +{
> +	uint A[130];
> +        A[20] = 0u;
> +	A[i] = 37u;
> +        out_color.rba = vec3(0.0, 0.0, 1.0);
> +	out_color.g = float(A[20] == 37u);
> +}
> +
> +[test]
> +clear color 1.0 0.0 0.0 1.0
> +clear
> +
> +uniform ubo 5 uint 0 19
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 1.0
> +
> +clear
> +uniform ubo 5 uint 0 20
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/vulkan/shaders/fs-multiple-large-local-array.vk_shader_test b/tests/vulkan/shaders/fs-multiple-large-local-array.vk_shader_test
> new file mode 100644
> index 000000000..658027876
> --- /dev/null
> +++ b/tests/vulkan/shaders/fs-multiple-large-local-array.vk_shader_test
> @@ -0,0 +1,40 @@
> +# Tests multiple large uint local arrays.
> +# Vulkan equivalent to tests/spec/glsl-1.30/execution/fs-multiple-large-local-array.shader_test
> +
> +[require]
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 450
> +
> +layout (binding = 5) uniform block {
> +       uint i;
> +};
> +
> +layout (location = 0) out vec4 out_color;
> +
> +void main()
> +{
> +	uint A[60];
> +	uint B[70];
> +	A[20] = 0u;
> +	A[i] = 37u;
> +	B[20] = 0u;
> +	B[i] = 39u;
> +	out_color.rba = vec3(0.0, 0.0, 1.0);
> +	out_color.g = float(A[20] == 37u && B[20] == 39u);
> +}
> +
> +[test]
> +clear color 1.0 0.0 0.0 1.0
> +clear
> +
> +uniform ubo 5 uint 0 19
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 1.0
> +
> +clear
> +uniform ubo 5 uint 0 20
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> -- 
> 2.14.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list