[Piglit] [PATCH v2 1/2] Test multiple inout parameters with indirect array indexing

Eduardo Lima Mitev elima at igalia.com
Mon May 30 09:42:11 UTC 2016


On 05/09/2016 04:51 PM, Juan A. Suarez Romero wrote:
> ---
>  ...vs-inout-index-inout-mat2-col-array.shader_test | 35 +++++++++++++++++++++
>  ...ndex-inout-vec4-array-element-array.shader_test | 36 ++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>  create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col-array.shader_test
>  create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element-array.shader_test
> 
> diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col-array.shader_test
> new file mode 100644
> index 0000000..14c5142
> --- /dev/null
> +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col-array.shader_test
> @@ -0,0 +1,35 @@
> +[require]
> +GLSL >= 1.20
> +
> +[vertex shader]
> +uniform int u = 1;
> +varying vec4 color;
> +
> +void func(inout int i, inout float f)
> +{
> +  i = 0;
> +  f = 1.;
> +}
> +
> +void main()
> +{
> +  mat2 m = mat2(0.);
> +  ivec4[] n = ivec4[](ivec4(0, 1, 1, 1), ivec4(1, 0, 0, 0));
> +  int i = u;
> +
> +  func(i, m[n[i].x][1]);
> +  color = vec4(m[1].x, m[1].y, m[0].x, m[0].y);
> +  gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +varying vec4 color;
> +
> +void main()
> +{
> +  gl_FragColor = color;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgb 0. 1. 0.

Since you are explicitly assigning the w component of 'color', you
should also probe it:

probe all rgba 0. 1. 0. 1.


The same comment applies to the rest of shaders in the series. It
doesn't hurt to tie it up and check all the components you are assigning.

Other than that, both patches are:

Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>

Thanks!

Eduardo

PS: JFTR, these tests fail with current master.

> diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element-array.shader_test
> new file mode 100644
> index 0000000..162ed51
> --- /dev/null
> +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element-array.shader_test
> @@ -0,0 +1,36 @@
> +[require]
> +GLSL >= 1.20
> +
> +[vertex shader]
> +
> +uniform int u = 1;
> +varying vec4 color;
> +
> +void func(inout int i, inout float f)
> +{
> +  i = 0;
> +  f = 1.;
> +}
> +
> +void main()
> +{
> +  vec4 v[] = vec4[](vec4(0.), vec4(0.));
> +  int w[] = int[](1, 0, 0, 0);
> +  int i = u;
> +
> +  func(i, v[1][w[i]]);
> +  color = v[1];
> +  gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +varying vec4 color;
> +
> +void main()
> +{
> +  gl_FragColor = color;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgb 1. 0. 0.
> 



More information about the Piglit mailing list