[Piglit] [PATCH v2 3/37] glean/tfragprog1: port ADD tests to shader_runner
Pohjolainen, Topi
topi.pohjolainen at gmail.com
Thu Sep 8 06:37:39 UTC 2016
On Tue, Sep 06, 2016 at 12:20:41PM -0700, Dylan Baker wrote:
> This ports the following tests:
> - ADD test
> - ADD with saturation
> - ADD an immediate
> - ADD negative immediate
>
> It does not port ADD negative "immediate (2)", which adds MOV, MUL, and
> swizzling. It might be a useful test but it's not really testing ADD
> other than that it tests that ADD can be used with a swizzle.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
>
> v2: - Cover more cases in the ADD_SAT test
> ---
> tests/all.py | 5 +-----
> tests/glean/tfragprog1.cpp | 75 +------------------------------------------------------------------------
> tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test | 16 +++++++++++++++-
> tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test | 16 +++++++++++++++-
> tests/spec/arb_fragment_program/built-in-functions/add.shader_test | 18 +++++++++++++++++-
> tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test | 22 +++++++++++++++++++++-
> 6 files changed, 72 insertions(+), 80 deletions(-)
> create mode 100644 tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
> create mode 100644 tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
> create mode 100644 tests/spec/arb_fragment_program/built-in-functions/add.shader_test
> create mode 100644 tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
>
> diff --git a/tests/all.py b/tests/all.py
> index 0f4a3c5..e655251 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -376,11 +376,6 @@ glean_glsl_tests = ['Primary plus secondary color',
> 'texcoord varying']
>
> glean_fp_tests = [
> - 'ADD test',
> - 'ADD with saturation',
> - 'ADD an immediate',
> - 'ADD negative immediate',
> - 'ADD negative immediate (2)',
> 'CMP test',
> 'COS test',
> 'COS test 2',
> diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
> index bc340ed..1cbe243 100644
> --- a/tests/glean/tfragprog1.cpp
> +++ b/tests/glean/tfragprog1.cpp
> @@ -82,81 +82,6 @@ static GLfloat FogCoord = 50.0; /* Between FogStart and FogEnd */
> // Alphabetical order, please
> static const FragmentProgram Programs[] = {
> {
> - "ADD test",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, fragment.color, p; \n"
> - "END \n",
> - { CLAMP01(FragColor[0] + Param1[0]),
> - CLAMP01(FragColor[1] + Param1[1]),
> - CLAMP01(FragColor[2] + Param1[2]),
> - CLAMP01(FragColor[3] + Param1[3])
> - },
> - DONT_CARE_Z
> - },
> - {
> - "ADD with saturation",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "TEMP t; \n"
> - "ADD t, p, p; \n"
> - "ADD_SAT result.color, t, p; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + Param1[0] + Param1[0]),
> - CLAMP01(Param1[1] + Param1[1] + Param1[1]),
> - CLAMP01(Param1[2] + Param1[2] + Param1[2]),
> - CLAMP01(Param1[3] + Param1[3] + Param1[3]),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD an immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {0.25, 0.0, 0.5, 0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + 0.25),
> - CLAMP01(Param1[1] + 0.0),
> - CLAMP01(Param1[2] + 0.5),
> - CLAMP01(Param1[3] + 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {-0.25, -0.2, 0.0, -0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] - 0.25),
> - CLAMP01(Param1[1] - 0.2),
> - CLAMP01(Param1[2] - 0.0),
> - CLAMP01(Param1[3] - 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate (2)",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "TEMP t; \n"
> - "MOV t, p; \n"
> - "MUL t.xyz, t, 2.0; \n"
> - "ADD t.xyz, t, -1.0; \n"
> - "MOV result.color, t; \n"
> - "END \n",
> - { CLAMP01(Param1[0] * 2.0 - 1.0),
> - CLAMP01(Param1[1] * 2.0 - 1.0),
> - CLAMP01(Param1[2] * 2.0 - 1.0),
> - CLAMP01(Param1[3] ),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> "CMP test",
> "!!ARBfp1.0\n"
> "PARAM zero = program.local[0]; \n"
> diff --git a/tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test b/tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
> new file mode 100644
> index 0000000..8a1cc7c
> --- /dev/null
> +++ b/tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
> @@ -0,0 +1,16 @@
> +[require]
> +GL_ARB_fragment_program
> +
> +[fragment program]
> +!!ARBfp1.0
> +PARAM p = program.local[0];
> +ADD result.color, p, {0.0, 0.5, 0.0, 0.0};
> +END
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +parameter local_fp 0 (0.0, 0.5, 0.0, 0.0)
This test adds: {0.0, 0.5, 0.0, 0.0} + {0.0, 0.5, 0.0, 0.0} while the original
does { 0.5, 0.25, 1.0, 0.5 } + {0.25, 0.0, 0.5, 0.25}. Functionally there are
hence two differences: new version uses values differing from zero only in
one channel, while original in addition requires the result in the third
channel to be saturated (1.0 + 0.5 -> 1.0).
I think I made similar comment with the original series in the spring time -
using non-zero values only for one channel instead of for all four makes the
test weaker.
More information about the Piglit
mailing list