[Piglit] [PATCH 2/2] color-clamping.vpfp: test that VS output colors are clamped to [0, 1]

Ian Romanick idr at freedesktop.org
Thu Apr 5 12:18:55 PDT 2012


On 04/05/2012 11:19 AM, Brian Paul wrote:
> ---
>   tests/all.tests                           |    1 +
>   tests/shaders/generic/color-clamping.vpfp |   15 +++++++++++++++
>   2 files changed, 16 insertions(+), 0 deletions(-)
>   create mode 100644 tests/shaders/generic/color-clamping.vpfp
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 1a56b67..2eea411 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -512,6 +512,7 @@ def add_vpfpgeneric(name):
>   	vpfpgeneric[name] = PlainExecTest(['vpfp-generic', '-auto', testsDir + '/shaders/generic/' + name + '.vpfp'])
>   add_vpfpgeneric('arl')
>   add_vpfpgeneric('big-param')
> +add_vpfpgeneric('color-clamping')
>   add_vpfpgeneric('dataflow-bug')
>   add_vpfpgeneric('fdo30337a')
>   add_vpfpgeneric('fdo30337b')
> diff --git a/tests/shaders/generic/color-clamping.vpfp b/tests/shaders/generic/color-clamping.vpfp
> new file mode 100644
> index 0000000..10b90e5
> --- /dev/null
> +++ b/tests/shaders/generic/color-clamping.vpfp
> @@ -0,0 +1,15 @@
> +; Check that vertex shader color outputs are clamped to [0,1]
> +
> +!!ARBvp1.0
> +OPTION ARB_position_invariant;
> +# Emit any color larger than (1,1,1,1):
> +MOV result.color, {20.0, 20.0, 20.0, 20.0};
> +END
> +
> +!!ARBfp1.0
> +MUL result.color, fragment.color, {0.5, 0.5, 0.5, 0.5};
> +END
> +
> +!!test
> +expected          0.5     0.5      0.5      0.5
> +

I think it might be better to do this using shader runner.  It has been 
able to handle vertex / fragment programs for some time now, and I think 
most people are more familiar with it than with vpfpgeneric.


More information about the Piglit mailing list