[Piglit] [PATCH v2] spec/glsl-1.30/execution/fs-large-local-array-vec*: use all components in test
From: Gert Wollny The tests use large arrays that need likely to be spilled. In order to check correct spilling of all components actually use all components in the test. v2: - use uniforms to pass the test values to make it more likely that the writing to the array elements is done in one instruction group - simplify the vec4 test - also correct the vec3 test Signed-off-by: Gert Wollny --- The first version is probably stuck in the moderation pipeline because I used an e-mail that is not subscribed to the list. Thanks for reviewing, Gert .../execution/fs-large-local-array-vec2.shader_test | 9 ++--- .../execution/fs-large-local-array-vec3.shader_test | 9 ++--- .../execution/fs-large-local-array-vec4.shader_test | 13 - 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec2.shader_test b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec2.shader_test index d83c222e6..8aa8d60c6 100644 --- a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec2.shader_test +++ b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec2.shader_test @@ -5,23 +5,26 @@ GLSL >= 1.30 [fragment shader] uniform uint i; +uniform vec2 value; void main() { vec2 A[130]; - A[20].g = 0; - A[i].g = 37; + A[20].rg = vec2(0, 0); + A[i].rg = value; gl_FragColor.rba = vec3(0.0, 0.0, 1.0); - gl_FragColor.g = float(A[20].g == 37); + gl_FragColor.g = float(A[20] == value); } [test] clear color 1.0 0.0 0.0 1.0 clear uniform uint i 19 +uniform vec2 value 22.1 13.4 draw rect -1 -1 2 2 probe all rgba 0.0 0.0 0.0 1.0 clear uniform uint i 20 +uniform vec2 value 22.1 13.4 draw rect -1 -1 2 2 probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec3.shader_test b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec3.shader_test index 55a8c3dcf..272ad25ef 100644 --- a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec3.shader_test +++ b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec3.shader_test @@ -5,23 +5,26 @@ GLSL >= 1.30 [fragment shader] uniform uint i; +uniform vec3 value; void main() { vec3 A[130]; - A[20].g = 0; - A[i].g = 37; + A[20].rgb = vec3(0.0, 0.0, 0.0); + A[i].rgb = value; gl_FragColor.rba = vec3(0.0, 0.0, 1.0); - gl_FragColor.g = float(A[20].g == 37); + gl_FragColor.g = float(A[20] == value); } [test] clear color 1.0 0.0 0.0 1.0 clear uniform uint i 19 +uniform vec3 value 1.1 2.2 3.3 draw rect -1 -1 2 2 probe all rgba 0.0 0.0 0.0 1.0 clear uniform uint i 20 +uniform vec3 value 1.1 2.2 3.3 draw rect -1 -1 2 2 probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test index 29b222342..c2f8fc20e 100644 --- a/tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test +++ b/tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test @@ -5,24 +5,27 @@ GLSL >= 1.30 [fragment shader] uniform uint i; +uniform vec4 value; + void main() { vec4 A[130]; - A[20].g = 0; - A[i].g = 37; - A[i].r = 1; - gl_FragColor.rba = vec3(0.0, 0.0, 1.0); - gl_FragColor.g = float(A[20].g == 37); + A[20] = vec4(0.0, 0.0, 0.0, 0.0); + A[i] = value; + gl_FragColor.rba = vec3(0.0, 0.0, 1.0); + gl_FragColor.g = float(A[20] == value); } [test] clear color 1.0 0.0 0.0 1.0 clear uniform uint i 19 +uniform vec4 value 22.0 12.0 34.0 2.0 draw rect -1 -1 2 2 probe all rgba 0.0 0.0 0.0 1.0 clear uniform uint i 20 +uniform vec4 value 22.0 12.0 34.0 2.0 draw rect -1 -1 2 2 probe all rgba 0.0 1.0 0.0 1.0 -- 2.16.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2] shader: Test to check conditional component write access in loops
This test verifies that the register merge step keeps a register alive for the whole loop if at the beginning of this loop at least one component is written unconditionally, and later another component is written conditionally within the same loop, and the last read to the register also happens withing this loop. --- .../glsl-partial-write-in-if-in-loop.shader_test | 44 ++ 1 file changed, 44 insertions(+) create mode 100644 tests/spec/glsl-1.10/execution/glsl-partial-write-in-if-in-loop.shader_test diff --git a/tests/spec/glsl-1.10/execution/glsl-partial-write-in-if-in-loop.shader_test b/tests/spec/glsl-1.10/execution/glsl-partial-write-in-if-in-loop.shader_test new file mode 100644 index 0..a3799a4d6 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/glsl-partial-write-in-if-in-loop.shader_test @@ -0,0 +1,44 @@ +# test that a temporary that is written partially in a condition +# within a loop is properly kept alive for the full loop. +# +# The test is specifically designed to validate the correct behaviour +# of the register merge algorithm, it should fail if the temporary +# registers are not tracked on a per-component bases. To achieve +# this (1) one components of a temporary is written at the +# beginning of the loop unconditionally, (2) the other components are +# written conditionally and it is made sure that the condition is not met +# in the last pass of the loop, (3) the last read happens within the loop, +# and (4) the shader is complex enough to allow some register merging, +# especially if the registers are not tracked component wise. + +[require] +GLSL >= 1.10 + +[fragment shader] +uniform int n; + +void main() +{ +vec4 u = vec4(0.1, 0.2, 0.3, 0.4); +vec4 v; +vec4 k; + +int a = 1; + +do { +k.x = float(a) * 0.1; +if (a == 1) { +k.yzw = u.yzw; +} +a = a + 1; +v = vec4(k.x, 2.0 * k.yzw); +} while (a <= n); + +gl_FragColor = v; +} + +[test] +uniform int n 2 + +draw rect -1 -1 2 2 +probe all rgba 0.2 0.4 0.6 0.8 -- 2.13.0 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] RFC [PATCH] shader: Test to check conditional component access in loops
Hi Brian, thanks for the comments. > > > +u.z = 0.0; > > +} while (a <= n); > > Does the body of the loop need to be that complicated? The test must achieve two things: On one hand, at least one component of a temporary register must be written first at the beginning of the loop, and another component conditionally later, but not every time. Then the code must be complicated enough so that temporary registers could be merged and that the optimizer doesn't simplify the code too much before the merge step. Specifically, the test should fail if the register is not tracked component wise in the register merge step, and it actually took me some time to achieve this. I could add some comments to clarify this. best Gert ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] RFC [PATCH] shader: Test to check conditional component access in loops
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." 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. 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 0..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 +[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); +u.z = 0.0; +} while (a <= n); + +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 -- 2.13.0 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit