[Piglit] RFC [PATCH] shader: Test to check conditional component access in loops
Brian Paul
brianp at vmware.com
Thu Aug 3 13:27:48 UTC 2017
On 08/03/2017 02:19 AM, Gert Wollny wrote:
> Hello all,
>
> this is my first message to the list. About the patch below:
>
> Commit message:
> "This test verifies whether the optimizer, and here specifically
> the register merge step keeps the according register for the whole
> loop alife."
"alive"
>
> I created the test proposing a new register merge algorithm. I'm not
> sure though, whether the location for the test is correct in the piglit
> file hierarchy.
I'd suggest test/specs/glsl-1.10/execution/
>
> many thanks for any commens,
> Gert
>
> ---
> .../glsl-partial-write-in-if-in-loop.shader_test | 38 ++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
> create mode 100644 tests/shaders/glsl-partial-write-in-if-in-loop.shader_test
>
> diff --git a/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test b/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test
> new file mode 100644
> index 000000000..25e27c45d
> --- /dev/null
> +++ b/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test
> @@ -0,0 +1,38 @@
> +# test that a temporary that is written partially in a condition
> +# within a loop is properly kept alife for the full loop
"alive"
> +[require]
> +GLSL >= 1.10
> +
> +[fragment shader]
> +uniform int n;
> +uniform float m;
> +
> +void main()
> +{
> + vec4 u = vec4(0.1, 0.2, 0.1, 0.1);
> + vec4 v;
> + vec4 k;
> +
> + int a = 1;
> +
> + do {
> + k.x = float(a) * 0.1;
> + k.y = m;
> + if (a == 1) {
> + k.zw = u.zw;
> + }
> + a= a+1;
> + float b = 2.0 * k.y;
> + v = vec4(k.x, b, 2.0 * k.zw);
Looks like you have a mix of tabs/spaces here.
> + u.z = 0.0;
> + } while (a <= n);
Does the body of the loop need to be that complicated?
> +
> + gl_FragColor = v;
> +}
> +
> +[test]
> +uniform int n 2
> +uniform float m 0.5
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.2 1.0 0.2 0.2
>
-Brian
More information about the Piglit
mailing list