[v2,3/37] glean/tfragprog1: port ADD tests to shader_runner

Submitted by Dylan Baker on Sept. 6, 2016, 7:20 p.m.

Details

Message ID fd556834b9c3dcb6d0894582b5875e6ebde97b06.1473189647.git-series.dylan@pnwbakers.com
State New
Headers show
Series "Port Glean Frag-prog tests to shader_runner" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Dylan Baker Sept. 6, 2016, 7:20 p.m.
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@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

Patch hide | download patch | download mbox

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)
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test b/tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
new file mode 100644
index 0000000..67c6e75
--- /dev/null
+++ b/tests/spec/arb_fragment_program/built-in-functions/add-negative-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, {-1.0, 0.0, 0.0, 0.0};
+END
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 0 (1.0, 1.0, 0.0, 0.0)
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_fragment_program/built-in-functions/add.shader_test b/tests/spec/arb_fragment_program/built-in-functions/add.shader_test
new file mode 100644
index 0000000..0312d29
--- /dev/null
+++ b/tests/spec/arb_fragment_program/built-in-functions/add.shader_test
@@ -0,0 +1,18 @@ 
+[require]
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+PARAM p = program.local[0];
+PARAM q = program.local[1];
+ADD result.color, p, q;
+END
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 1 ( 1.0, 0.0, 0.0, 0.0)
+parameter local_fp 0 (-2.0, 1.0, 0.0, 0.0)
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test b/tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
new file mode 100644
index 0000000..6081a0e
--- /dev/null
+++ b/tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
@@ -0,0 +1,22 @@ 
+[require]
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+PARAM p = program.local[0];
+PARAM q = program.local[1];
+PARAM r = program.local[2];
+TEMP s;
+ADD s, p, q;
+ADD_SAT result.color, r, s;
+END
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 0 (-1.0, 0.7, -0.5, 0.5)
+parameter local_fp 1 ( 1.0, 0.5,  0.0, 0.0)
+parameter local_fp 2 (-0.5, 0.3,  0.2, 0.2)
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.7

Comments

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@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.