[Piglit] [PATCH 2/2] arb_gpu_shader_fp64: add non-uniform control flow test for indirect addressing

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Feb 27 08:11:21 UTC 2017



On 24/02/17 20:39, Anuj Phogat wrote:
> On Tue, Feb 14, 2017 at 2:20 AM, Samuel Iglesias Gonsálvez
> <siglesias at igalia.com> wrote:
>> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
>> ---
>>  ...t-indirect-non-uniform-control-flow.shader_test | 52 +++++++++++++++++
>>  ...t-indirect-non-uniform-control-flow.shader_test | 68 ++++++++++++++++++++++
>>  2 files changed, 120 insertions(+)
>>  create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/fs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>>  create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>>
>> diff --git a/tests/spec/arb_gpu_shader_fp64/execution/fs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/fs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>> new file mode 100644
>> index 000000000..f2d4ac592
>> --- /dev/null
>> +++ b/tests/spec/arb_gpu_shader_fp64/execution/fs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>> @@ -0,0 +1,52 @@
>> +[require]
>> +GLSL >= 4.00
>> +GL_ARB_gpu_shader_fp64
>> +
>> +[vertex shader passthrough]
>> +
>> +[fragment shader]
>> +#extension GL_ARB_gpu_shader_fp64 : enable
>> +
>> +uniform double arg0;
>> +uniform double tolerance;
>> +uniform dvec4 expected;
>> +
>> +uniform double arg[7];
>> +out vec4 color;
>> +
>> +void main()
>> +{
>> +       int index;
>> +       double tol = tolerance;
>> +       vec4 color2 = vec4(0.0, 1.0, 0.0, 1.0);
>> +       float cx = gl_FragCoord.x;
>> +       float cy = gl_FragCoord.y;
>> +       if (cx == cy) {
>> +         index = int(arg[6]);
>> +       } else {
>> +         index = int(arg[5]);
>> +         tol = 0.35;
> tol = 0.1; ?

Good catch but actually tolerance should be 0.2 in this case:

* Distance is calculated as length(p1 - p0)
* Length is calculated as sqrt(x²+y²+z²+w²) for a 4-component vector.

In this case:

p1 - p0 = (0.1, 0.1, 0.1, 0.1)
distance = sqrt(x²+y²+z²+w²) = sqrt(0.01 + 0.01 + 0.01 + 0.01) =
sqrt(0.04) = 0.2


>> +         color2 = vec4(0.0, 0.0, 1.0, 1.0);
>> +       }
>> +       dvec4 result = dvec4(arg[index] + arg0);
>> +       color = distance(result, expected) <= tol
>> +               ? color2 : vec4(1.0, 0.0, 0.0, 1.0);
>> +}
>> +
>> +[test]
>> +clear color 0.0 0.0 0.0 0.0
>> +
>> +clear
>> +uniform double arg0 0.25
>> +uniform double tolerance 0.0
>> +uniform dvec4 expected 0.65 0.65 0.65 0.65
>> +uniform double arg[0] 0.1
>> +uniform double arg[1] 0.2
>> +uniform double arg[2] 0.3
>> +uniform double arg[3] 0.4
>> +uniform double arg[4] 0.5
>> +uniform double arg[5] 2.0
>> +uniform double arg[6] 3.0
>> +draw rect -1 -1 2 2
>> +probe rgba 1 1 0.0 1.0 0.0 1.0
>> +probe rgba 1 0 0.0 0.0 1.0 1.0
>> diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>> new file mode 100644
>> index 000000000..80bcec7fc
>> --- /dev/null
>> +++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-double-uniform-array-direct-indirect-non-uniform-control-flow.shader_test
>> @@ -0,0 +1,68 @@
>> +[require]
>> +GLSL >= 1.50
>> +GL_ARB_gpu_shader_fp64
>> +
>> +[vertex shader]
>> +#version 150
>> +#extension GL_ARB_gpu_shader_fp64 : require
>> +
>> +uniform double arg0;
>> +uniform dvec4 expected;
>> +
>> +uniform double arg[7];
>> +
>> +in vec4 piglit_vertex;
>> +flat out vec4 v;
>> +
>> +void main()
>> +{
>> +       gl_Position = piglit_vertex;
>> +
>> +       int index;
>> +       vec4 color2;
>> +       dvec4 result;
>> +       dvec4 exp;
>> +       double tol = 0.01;
>> +       if (gl_VertexID % 2 == 1) {
>> +          index = int(arg[6]);
>> +          color2 = vec4(0.0, 1.0, 0.0, 1.0);
>> +          result = dvec4(arg[index] + arg0);
>> +          exp = expected;
>> +       } else {
>> +          index = int(arg[5]);
>> +          color2 = vec4(0.0, 0.0, 1.0, 1.0);
>> +          result = dvec4(arg[index] + arg0);
> You can move above statement out of if-else block.

Right

>> +          exp = dvec4(0.55, 0.55, 0.55, 0.55);
>> +          tol = 0.01;
> Remove above statement.

OK

With these changes, does this patch get your R-b?

Sam

>> +       }
>> +       v = distance(result, exp) <= tol
>> +               ? color2 : vec4(1.0, 0.0, 0.0, 1.0);
>> +}
>> +
>> +[fragment shader]
>> +#version 150
>> +
>> +flat in vec4 v;
>> +out vec4 color;
>> +
>> +void main()
>> +{
>> +       color = v;
>> +}
>> +
>> +[test]
>> +clear color 0.0 0.0 0.0 0.0
>> +
>> +clear
>> +uniform double arg0 0.25
>> +uniform dvec4 expected 0.65 0.65 0.65 0.65
>> +uniform double arg[0] 0.1
>> +uniform double arg[1] 0.2
>> +uniform double arg[2] 0.3
>> +uniform double arg[3] 0.4
>> +uniform double arg[4] 0.5
>> +uniform double arg[5] 2.0
>> +uniform double arg[6] 3.0
>> +draw rect -1 -1 2 2
>> +probe rgba 127 127 0.0 1.0 0.0 1.0
>> +probe rgba 1 1 0.0 0.0 1.0 1.0
>> --
>> 2.11.0
>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/piglit
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 862 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170227/03459bb6/attachment.sig>


More information about the Piglit mailing list