[Piglit] [PATCH] glsl-1.10: add tests to exercise Mesa bug where output vars are not written

Tapani tapani.palli at intel.com
Thu Oct 23 22:17:21 PDT 2014


Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 10/23/2014 04:00 AM, Brian Paul wrote:
> Assignments to out/varying variables are sometimes implemented as writes
> to temporary registers.  When we return from main() we copy those temps
> to the real output variables.  This is also supposed to happen when a
> 'return' statement is executed.
>
> This seems to work for vec4 outputs, but not vec3, vec2 or float.  This
> is a set of four shader tests which exercise those out/varying types.
>
> This issue was found while debugging a problem reported on the mesa-users
> list titled "Texture coordinates are all zero".
> ---
>   .../execution/vs-float-main-return.shader_test     |   27 ++++++++++++++++++
>   .../execution/vs-vec2-main-return.shader_test      |   29 ++++++++++++++++++++
>   .../execution/vs-vec3-main-return.shader_test      |   28 +++++++++++++++++++
>   .../execution/vs-vec4-main-return.shader_test      |   28 +++++++++++++++++++
>   4 files changed, 112 insertions(+)
>   create mode 100644 tests/spec/glsl-1.10/execution/vs-float-main-return.shader_test
>   create mode 100644 tests/spec/glsl-1.10/execution/vs-vec2-main-return.shader_test
>   create mode 100644 tests/spec/glsl-1.10/execution/vs-vec3-main-return.shader_test
>   create mode 100644 tests/spec/glsl-1.10/execution/vs-vec4-main-return.shader_test
>
> 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
> new file mode 100644
> index 0000000..e15e12b
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/vs-float-main-return.shader_test
> @@ -0,0 +1,27 @@
> +[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)
> +		return;
> +	foo1 = 0.2;
> +}
> +
> +[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.5 0.5 0.5 0.5
> 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
> new file mode 100644
> index 0000000..ada67ef
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/vs-vec2-main-return.shader_test
> @@ -0,0 +1,29 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +uniform int early_return;
> +varying vec2 foo1;
> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +	foo1 = vec2(0.5);
> +	if (early_return != 0)
> +		return;
> +	foo1 = vec2(0.2);
> +}
> +
> +[fragment shader]
> +varying vec2 foo1;
> +void main()
> +{
> +	gl_FragColor.xy = foo1;
> +	gl_FragColor.zw = foo1;
> +}
> +
> +[test]
> +
> +uniform int early_return 1
> +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-vec3-main-return.shader_test b/tests/spec/glsl-1.10/execution/vs-vec3-main-return.shader_test
> new file mode 100644
> index 0000000..a688934
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/vs-vec3-main-return.shader_test
> @@ -0,0 +1,28 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +uniform int early_return;
> +varying vec3 foo1;
> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +	foo1 = vec3(0.5);
> +	if (early_return != 0)
> +		return;
> +	foo1 = vec3(0.2);
> +}
> +
> +[fragment shader]
> +varying vec3 foo1;
> +void main()
> +{
> +	gl_FragColor = foo1.xyzx;
> +}
> +
> +[test]
> +
> +uniform int early_return 1
> +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-vec4-main-return.shader_test b/tests/spec/glsl-1.10/execution/vs-vec4-main-return.shader_test
> new file mode 100644
> index 0000000..b5b02dc
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/vs-vec4-main-return.shader_test
> @@ -0,0 +1,28 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +uniform int early_return;
> +varying vec4 foo1;
> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +	foo1 = vec4(0.5);
> +	if (early_return != 0)
> +		return;
> +	foo1 = vec4(0.2);
> +}
> +
> +[fragment shader]
> +varying vec4 foo1;
> +void main()
> +{
> +	gl_FragColor = foo1;
> +}
> +
> +[test]
> +
> +uniform int early_return 1
> +draw rect -1 -1 2 2
> +probe all rgba 0.5 0.5 0.5 0.5
> +



More information about the Piglit mailing list