[Piglit] [PATCH v4 2/2] arb_shader_precision: add framework for calculating tolerances for complex functions

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 3 09:57:12 PDT 2015


Please split the fma tests from the generator stuff. [Will review the
generator in a separate email.]

On Fri, Apr 3, 2015 at 12:45 PM, Micah Fedke
<micah.fedke at collabora.co.uk> wrote:
> - update mako templates to support vectors of tolerances
> - include manually written tests for a*b+c and fma()
>
> ---
>  generated_tests/gen_shader_precision_tests.py      | 138 +++++++++++++++++----
>  .../templates/gen_shader_precision_tests/fs.mako   |  55 ++++----
>  .../templates/gen_shader_precision_tests/gs.mako   |  55 ++++----
>  .../templates/gen_shader_precision_tests/vs.mako   |  55 ++++----
>  .../fs-fma-float-float-float.shader_test           |  40 ++++++
>  .../fs-manual-fma-float-float-float.shader_test    |  40 ++++++
>  .../gs-fma-float-float-float.shader_test           |  59 +++++++++
>  .../gs-manual-fma-float-float-float.shader_test    |  59 +++++++++
>  .../vs-fma-float-float-float.shader_test           |  44 +++++++
>  .../vs-manual-fma-float-float-float.shader_test    |  44 +++++++
>  10 files changed, 502 insertions(+), 87 deletions(-)
>  create mode 100644 tests/spec/arb_shader_precision/fs-fma-float-float-float.shader_test
>  create mode 100644 tests/spec/arb_shader_precision/fs-manual-fma-float-float-float.shader_test
>  create mode 100644 tests/spec/arb_shader_precision/gs-fma-float-float-float.shader_test
>  create mode 100644 tests/spec/arb_shader_precision/gs-manual-fma-float-float-float.shader_test
>  create mode 100644 tests/spec/arb_shader_precision/vs-fma-float-float-float.shader_test
>  create mode 100644 tests/spec/arb_shader_precision/vs-manual-fma-float-float-float.shader_test
>
> diff --git a/tests/spec/arb_shader_precision/fs-fma-float-float-float.shader_test b/tests/spec/arb_shader_precision/fs-fma-float-float-float.shader_test
> new file mode 100644
> index 0000000..3501f46
> --- /dev/null
> +++ b/tests/spec/arb_shader_precision/fs-fma-float-float-float.shader_test
> @@ -0,0 +1,40 @@
> +
> +[require]
> +GLSL >= 4.00
> +
> +[vertex shader]
> +in vec4 piglit_vertex;
> +void main()
> +{
> +        gl_Position = piglit_vertex;
> +}

AKA [vertex shader passthrough]. Please just use that (here and elsewhere).

> +
> +[fragment shader]
> +#extension GL_ARB_shader_precision : require
> +uniform float arg0;
> +uniform float arg1;
> +uniform float arg2;
> +uniform float expected_a;
> +uniform float expected_b;
> +
> +void main()
> +{
> +  float result = fma(arg0, arg1, arg2);
> +  gl_FragColor = result == expected_a || result == expected_b ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[vertex data]
> +piglit_vertex/float/2
> +-1.0 -1.0
> + 1.0 -1.0
> + 1.0  1.0
> +-1.0  1.0
> +
> +[test]
> +uniform float arg0  -2.99999993e-02
> +uniform float arg1  -8.50000024e-01
> +uniform float arg2  -2.54999995e-02
> +uniform float expected_a  0.00000000e+00
> +uniform float expected_b  6.22123464e-10
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe rgba 0 0 0.0 1.0 0.0 1.0

Could I trouble you to do like 4 cases out by hand instead of just
one? This is a particularly nasty one since it works out to 0 one way
and not-0 in another, which makes it very difficult to talk about
ULP's.

  -ilia


More information about the Piglit mailing list