[Piglit] [PATCH 28/37] glean/tfragprog1: port SUB tests to shader_runner

Dylan Baker dylan at pnwbakers.com
Mon May 2 21:59:30 UTC 2016


This adds additionally a straight SUB test with no swizzles.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/all.py                                       |  2 --
 tests/glean/tfragprog1.cpp                         | 29 ----------------------
 .../built-in-functions/sub.shader_test             | 19 ++++++++++++++
 .../built-in-functions/sub_sat.shader_test         | 20 +++++++++++++++
 .../swizzle-and-mask/swizzled-sub.shader_test      | 24 ++++++++++++++++++
 5 files changed, 63 insertions(+), 31 deletions(-)
 create mode 100644 tests/spec/arb_fragment_program/built-in-functions/sub.shader_test
 create mode 100644 tests/spec/arb_fragment_program/built-in-functions/sub_sat.shader_test
 create mode 100644 tests/spec/arb_fragment_program/swizzle-and-mask/swizzled-sub.shader_test

diff --git a/tests/all.py b/tests/all.py
index 9d63f7f..21d6ac0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -376,8 +376,6 @@ glean_glsl_tests = ['Primary plus secondary color',
                     'texcoord varying']
 
 glean_fp_tests = [
-                  'SUB test (with swizzle)',
-                  'SUB with saturation',
                   'SWZ test',
                   'swizzled move test',
                   'swizzled add test',
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
index 02d5beb..342b17d 100644
--- a/tests/glean/tfragprog1.cpp
+++ b/tests/glean/tfragprog1.cpp
@@ -82,35 +82,6 @@ static GLfloat FogCoord = 50.0;  /* Between FogStart and FogEnd */
 // Alphabetical order, please
 static const FragmentProgram Programs[] = {
 	{
-		"SUB test (with swizzle)",
-		"!!ARBfp1.0\n"
-		"PARAM p1 = program.local[1]; \n"
-		"SUB result.color, p1.yxwz, fragment.color.yxwz; \n"
-		"END \n",
-		{ CLAMP01(Param1[1] - FragColor[1]),
-		  CLAMP01(Param1[0] - FragColor[0]),
-		  CLAMP01(Param1[3] - FragColor[3]),
-		  CLAMP01(Param1[2] - FragColor[2])
-		},
-		DONT_CARE_Z
-	},
-	{
-		"SUB with saturation",
-		"!!ARBfp1.0\n"
-		"PARAM p1 = program.local[1]; \n"
-                "PARAM bias = {0.1, 0.1, 0.1, 0.1}; \n"
-                "TEMP t; \n"
-		"SUB_SAT t, fragment.color, p1; \n"
-                "ADD result.color, t, bias; \n"
-		"END \n",
-		{ CLAMP01(FragColor[0] - Param1[1]) + 0.1,
-		  CLAMP01(FragColor[1] - Param1[1]) + 0.1,
-		  CLAMP01(FragColor[2] - Param1[2]) + 0.1,
-		  CLAMP01(FragColor[3] - Param1[3]) + 0.1
-		},
-		DONT_CARE_Z
-	},
-	{
 		"SWZ test",
 		"!!ARBfp1.0\n"
 		"PARAM p = program.local[1]; \n"
diff --git a/tests/spec/arb_fragment_program/built-in-functions/sub.shader_test b/tests/spec/arb_fragment_program/built-in-functions/sub.shader_test
new file mode 100644
index 0000000..8402fc3
--- /dev/null
+++ b/tests/spec/arb_fragment_program/built-in-functions/sub.shader_test
@@ -0,0 +1,19 @@
+[require]
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+PARAM p = program.local[0];
+PARAM q = program.local[1];
+SUB result.color, p, q;
+END
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 0 (-1.0, 1.0, 1.0, 0.5)
+parameter local_fp 1 (-1.0, 0.0, 1.0, 0.5)
+draw rect -1 -1 2 2
+# z will be clamped
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_fragment_program/built-in-functions/sub_sat.shader_test b/tests/spec/arb_fragment_program/built-in-functions/sub_sat.shader_test
new file mode 100644
index 0000000..84edb4d
--- /dev/null
+++ b/tests/spec/arb_fragment_program/built-in-functions/sub_sat.shader_test
@@ -0,0 +1,20 @@
+[require]
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+PARAM p = program.local[0];
+PARAM q = program.local[1];
+SUB result.color, p, q;
+END
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 0 (-1.0, 5.0, 1.0, 0.5)
+parameter local_fp 1 (-1.0, 0.0, 1.0, 0.5)
+draw rect -1 -1 2 2
+# z will be clamped
+# y will be saturated
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_fragment_program/swizzle-and-mask/swizzled-sub.shader_test b/tests/spec/arb_fragment_program/swizzle-and-mask/swizzled-sub.shader_test
new file mode 100644
index 0000000..c9abfae
--- /dev/null
+++ b/tests/spec/arb_fragment_program/swizzle-and-mask/swizzled-sub.shader_test
@@ -0,0 +1,24 @@
+[require]
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+PARAM p = program.local[0];
+PARAM q = program.local[1];
+SUB result.color, p.yxwz, q.yxwz;
+END
+
+[test]
+ortho
+clear color 0.5 0.5 0.5 0.5
+clear
+
+parameter local_fp 0 (1.0, 1.0, 1.0, 0.5)
+parameter local_fp 1 (0.0, 1.0, 1.0, 0.5)
+draw rect 10 10 30 30
+# z will be clamped
+probe rgba 10 10 0.0 1.0 0.0 0.0
+probe rgba 30 10 0.0 1.0 0.0 0.0
+probe rgba 10 30 0.0 1.0 0.0 0.0
+probe rgba 30 30 0.0 1.0 0.0 0.0
+probe rgba 20 20 0.0 1.0 0.0 0.0
-- 
2.8.2



More information about the Piglit mailing list