[Piglit] [PATCH] glsl-vs-copy-propagation-1: New test for i965 driver bug.

Kenneth Graunke kenneth at whitecape.org
Tue Dec 27 14:17:13 PST 2011


On 12/27/2011 12:19 PM, Eric Anholt wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42032
> ---
> 
> Ken: Here's a regression test for the bug.  Thanks for figuring it out!
> 
> I think it was easier for me to read the squash of the 2/3 and 3/3
> than to read them separately, though.
> 
>  .../shaders/glsl-vs-copy-propagation-1.shader_test |   44 ++++++++++++++++++++
>  1 files changed, 44 insertions(+), 0 deletions(-)
>  create mode 100644 tests/shaders/glsl-vs-copy-propagation-1.shader_test
> 
> diff --git a/tests/shaders/glsl-vs-copy-propagation-1.shader_test b/tests/shaders/glsl-vs-copy-propagation-1.shader_test
> new file mode 100644
> index 0000000..2261287
> --- /dev/null
> +++ b/tests/shaders/glsl-vs-copy-propagation-1.shader_test
> @@ -0,0 +1,44 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +/* Tests for a bug in the 965 vertex shader backend where kills of
> + * overwritten copy propagation sources didn't happen when new
> + * propagation entries were being created.
> + */
> +
> +uniform vec4 u;
> +uniform int j;
> +varying vec4 color;
> +
> +void main()
> +{
> +	float a;
> +	float b = u.y;
> +
> +	color = u;
> +
> +	/* This loop tricks core GLSL into not optimizing out the
> +	 * pattern for hitting the driver bug.
> +	 */
> +	for (int i = 0; i < j; i++) {
> +		a = b; /* a = 1.0 */
> +		b = color.z; /* b = 0 */
> +		color.z = a; /* color.z = 0.5, but the bug makes it 0. */
> +	}
> +	gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +varying vec4 color;
> +
> +void main()
> +{
> +	gl_FragColor = color;
> +}
> +
> +[test]
> +uniform vec4 u 0 1 0 0
> +uniform int j 1
> +draw rect -1 -1 2 2
> +probe all rgba 0 1 1 0

Yep, this would indeed reproduce the issue.  Looks great Eric, thanks so
much for implementing this.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the Piglit mailing list