[Piglit] [PATCH] arb_shader_storage_buffer_object: Test copying a large SSBO item

Ian Romanick idr at freedesktop.org
Thu Nov 19 17:32:37 PST 2015


On 11/19/2015 05:23 PM, Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Kristian Høgsberg <krh at bitplanet.net>
> Cc: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> Cc: Iago Toral Quiroga <itoral at igalia.com>
> ---
>  This fails to link on i965.
> 
>  .../execution/large-field-copy.shader_test         | 66 ++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
> 
> diff --git a/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test b/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
> new file mode 100644
> index 0000000..a949507
> --- /dev/null
> +++ b/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
> @@ -0,0 +1,66 @@
> +# Test that a 'large' field of an SSBO can be copied.
> +
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_shader_storage_buffer_object
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 330
> +#extension GL_ARB_shader_storage_buffer_object: require
> +
> +#define SIZE 16
> +
> +layout (std430) buffer SSBO {
> +    mat4 m1[SIZE];
> +    mat4 m2[SIZE];
> +};
> +
> +out vec4 color;
> +
> +uniform uint mode;
> +
> +void main() {
> +    bool pass = true;
> +    int i;
> +
> +    switch (mode) {
> +    case 0u:
> +        for (i = 0; i < SIZE; i++) {
> +	    m1[i] = mat4(vec4(i + 0), vec4(i + 1),
> +	                 vec4(i + 2), vec4(i + 3));
> +	}
> +	break;
> +    case 1u:
> +        m2 = m1;

Weird indentation.  Actually... I think this is the only line that's
right.  Everywhere else mixes tabs and space.  What is the standard in
piglit shaders these days anyway?

> +	break;
> +    case 2u:
> +        for (i = 0; i < SIZE; i++) {
> +	    pass = pass && (m2[i] == mat4(vec4(i + 0), vec4(i + 1),
> +	                                  vec4(i + 2), vec4(i + 3)));
> +	}
> +	break;
> +    }
> +
> +    if (pass)
> +        color = vec4(0.0, 1.0, 0.0, 1.0);
> +    else
> +        color = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +ssbo 2048
> +
> +uniform uint mode 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> +
> +uniform uint mode 1
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> +
> +uniform uint mode 2
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0

I prefer it if all results are visible at once.  If there was a pixel
wrong in the first subtest, the other subtests overwrite it.  That makes
it more annoying to debug.

Uh... wait... hmm.  This is probably okay, but I think the first two
passes should write a different color.  There should also be some
comments that explain that the first two passes only exist to get data
in the SSBO.  Why bother probing their result?



More information about the Piglit mailing list