[Piglit] [PATCH] glsl-1.10/execution: Extend tests for early returns

Timothy Arceri timothy.arceri at collabora.com
Thu Apr 28 00:16:28 UTC 2016


On Tue, 2016-04-26 at 23:00 -0400, Lars Hamre wrote:
> Modifies existing early return tests to test both
> code paths (with and without an early return).
> 
> Adds an additional test where the early return ends
> up being the final instruction.
> 
> Per feedback on this mesa patch:
> https://lists.freedesktop.org/archives/mesa-dev/2016-April/114706.htm
> l
> 
> Signed-off-by: Lars Hamre <chemecse at gmail.com>
> 
> ---
> 
> CC: Timothy Arceri <timothy.arceri at collabora.com>
> 
> NOTE: someone with access will need to commit this
>       after the review process

Pushed thanks for doing this :)

> 
>  .../vs-float-main-return-at-end.shader_test        | 31
> ++++++++++++++++++++++
>  .../execution/vs-float-main-return.shader_test     |  3 +++
>  .../execution/vs-vec2-main-return.shader_test      |  3 +++
>  .../execution/vs-vec3-main-return.shader_test      |  3 +++
>  .../execution/vs-vec4-main-return.shader_test      |  3 +++
>  5 files changed, 43 insertions(+)
>  create mode 100644 tests/spec/glsl-1.10/execution/vs-float-main-
> return-at-end.shader_test
> 
> diff --git a/tests/spec/glsl-1.10/execution/vs-float-main-return-at-
> end.shader_test b/tests/spec/glsl-1.10/execution/vs-float-main-
> return-at-end.shader_test
> new file mode 100644
> index 0000000..a83fa7f
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/vs-float-main-return-at-
> end.shader_test
> @@ -0,0 +1,31 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +uniform int early_return;
> +varying float foo1;
> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +	foo1 = 0.5;
> +	if (early_return != 0) {
> +		foo1 = 0.2;
> +		return;
> +	}
> +}
> +
> +[fragment shader]
> +varying float foo1;
> +void main()
> +{
> +	gl_FragColor = vec4(foo1);
> +}
> +
> +[test]
> +
> +uniform int early_return 1
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 0.2 0.2 0.2
> +uniform int early_return 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.5 0.5 0.5 0.5
> diff --git a/tests/spec/glsl-1.10/execution/vs-float-main-
> return.shader_test b/tests/spec/glsl-1.10/execution/vs-float-main-
> return.shader_test
> index e15e12b..d385571 100644
> --- a/tests/spec/glsl-1.10/execution/vs-float-main-return.shader_test
> +++ b/tests/spec/glsl-1.10/execution/vs-float-main-return.shader_test
> @@ -25,3 +25,6 @@ void main()
>  uniform int early_return 1
>  draw rect -1 -1 2 2
>  probe all rgba 0.5 0.5 0.5 0.5
> +uniform int early_return 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 0.2 0.2 0.2
> diff --git a/tests/spec/glsl-1.10/execution/vs-vec2-main-
> return.shader_test b/tests/spec/glsl-1.10/execution/vs-vec2-main-
> return.shader_test
> index ada67ef..df74500 100644
> --- a/tests/spec/glsl-1.10/execution/vs-vec2-main-return.shader_test
> +++ b/tests/spec/glsl-1.10/execution/vs-vec2-main-return.shader_test
> @@ -26,4 +26,7 @@ void main()
>  uniform int early_return 1
>  draw rect -1 -1 2 2
>  probe all rgba 0.5 0.5 0.5 0.5
> +uniform int early_return 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 0.2 0.2 0.2
> 
> diff --git a/tests/spec/glsl-1.10/execution/vs-vec3-main-
> return.shader_test b/tests/spec/glsl-1.10/execution/vs-vec3-main-
> return.shader_test
> index a688934..28c3faa 100644
> --- a/tests/spec/glsl-1.10/execution/vs-vec3-main-return.shader_test
> +++ b/tests/spec/glsl-1.10/execution/vs-vec3-main-return.shader_test
> @@ -25,4 +25,7 @@ void main()
>  uniform int early_return 1
>  draw rect -1 -1 2 2
>  probe all rgba 0.5 0.5 0.5 0.5
> +uniform int early_return 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 0.2 0.2 0.2
> 
> diff --git a/tests/spec/glsl-1.10/execution/vs-vec4-main-
> return.shader_test b/tests/spec/glsl-1.10/execution/vs-vec4-main-
> return.shader_test
> index b5b02dc..fc22c4b 100644
> --- a/tests/spec/glsl-1.10/execution/vs-vec4-main-return.shader_test
> +++ b/tests/spec/glsl-1.10/execution/vs-vec4-main-return.shader_test
> @@ -25,4 +25,7 @@ void main()
>  uniform int early_return 1
>  draw rect -1 -1 2 2
>  probe all rgba 0.5 0.5 0.5 0.5
> +uniform int early_return 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 0.2 0.2 0.2
> 
> --
> 2.5.5
> 


More information about the Piglit mailing list