[Piglit] [PATCH v2 34/37] glean/tfragprog1: port exp2 fog tests to shader_runner

Dylan Baker dylan at pnwbakers.com
Tue Sep 6 19:21:12 UTC 2016


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/all.py                                                    |  3 +-
 tests/glean/tfragprog1.cpp                                      | 47 +-------
 tests/spec/arb_fragment_program/fog/calculated-exp2.shader_test | 36 +++++-
 tests/spec/arb_fragment_program/fog/exp2.shader_test            | 24 ++++-
 4 files changed, 61 insertions(+), 49 deletions(-)
 create mode 100644 tests/spec/arb_fragment_program/fog/calculated-exp2.shader_test
 create mode 100644 tests/spec/arb_fragment_program/fog/exp2.shader_test

diff --git a/tests/all.py b/tests/all.py
index f533893..682b8c9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -379,8 +379,7 @@ glean_fp_tests = [
                   'Z-write test',
                   'Divide by zero test',
                   'Infinity and nan test',
-                  'ARB_fog_exp2 test',
-                  'Computed fog exp2 test']
+]
 
 glean_vp_tests = ['ABS test',
                   'ADD test',
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
index b34a348..abee647 100644
--- a/tests/glean/tfragprog1.cpp
+++ b/tests/glean/tfragprog1.cpp
@@ -130,53 +130,6 @@ static const FragmentProgram Programs[] = {
 		DONT_CARE_Z
 	},
 
-	// ============= Fog tests ============================================
-
-	// Exp2 fog
-#define FOG_FACT 0.1054   // = exp(-(Density * Coord)^2)
-	{
-		"ARB_fog_exp2 test",
-		"!!ARBfp1.0\n"
-		"OPTION ARB_fog_exp2; \n"
-		"MOV result.color, fragment.color; \n"
-		"END \n",
-		{ FragColor[0] * FOG_FACT + FogColor[0] * (1.0 - FOG_FACT),
-		  FragColor[1] * FOG_FACT + FogColor[1] * (1.0 - FOG_FACT),
-		  FragColor[2] * FOG_FACT + FogColor[2] * (1.0 - FOG_FACT),
-		  FragColor[3]
-		},
-		DONT_CARE_Z
-	},
-#undef FOG_FACT
-#define FOG_FACT 0.2102   // = ex2(-(Density * Coord)^2)
-	{
-		// NOTE: we could also do this with the POW instruction
-		"Computed fog exp2 test",
-		"!!ARBfp1.0\n"
-		"# fogParams.x = density \n"
-		"# fogParams.y = start \n"
-		"# fogParams.z = end \n"
-		"# fogParams.w = 1/(end-start) \n"
-		"PARAM fogParams = state.fog.params; \n"
-		"ATTRIB fogCoord = fragment.fogcoord; \n"
-		"PARAM fogColor = state.fog.color; \n"
-		"TEMP f, dc; \n"
-		"# f = exp(-(density * coord)^2) \n"
-		"MUL dc.x, fogParams.x, fogCoord.x; \n"
-		"MUL dc.x, dc.x, dc.x; \n"
-		"EX2_SAT f, -dc.x; \n"
-		"LRP result.color.rgb, f, fragment.color, fogColor; \n"
-		"MOV result.color.a, fragment.color.a; \n"
-		"END \n",
-		{ FragColor[0] * FOG_FACT + FogColor[0] * (1.0 - FOG_FACT),
-		  FragColor[1] * FOG_FACT + FogColor[1] * (1.0 - FOG_FACT),
-		  FragColor[2] * FOG_FACT + FogColor[2] * (1.0 - FOG_FACT),
-		  FragColor[3]
-		},
-		DONT_CARE_Z
-	},
-#undef FOG_FACT
-
 	// XXX add lots more tests here!
 	{ NULL, NULL, {0,0,0,0}, 0 } // end of list sentinal
 };
diff --git a/tests/spec/arb_fragment_program/fog/calculated-exp2.shader_test b/tests/spec/arb_fragment_program/fog/calculated-exp2.shader_test
new file mode 100644
index 0000000..34ec794
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/calculated-exp2.shader_test
@@ -0,0 +1,36 @@
+[require]
+GL >= 1.4
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+# fogParams.x = density
+# fogParams.y = start
+# fogParams.z = end
+# fogParams.w = 1/(end-start)
+PARAM fogParams = state.fog.params;
+ATTRIB fogCoord = fragment.fogcoord;
+PARAM fogColor = state.fog.color;
+PARAM p = {0.2, 0.4, 0.6, 0.8};
+TEMP f, dc;
+# f = exp(-(density * coord)^2)
+MUL dc.x, fogParams.x, fogCoord.x;
+MUL dc.x, dc.x, dc.x;
+EX2_SAT f, -dc.x;
+LRP result.color.rgb, f, p, fogColor;
+MOV result.color.a, p.a;
+END
+
+[test]
+fog start 10.0
+fog end 100.0
+fog density 0.03
+fog color (1.0, 1.0, 0.0, 0.0)
+fog coord_src fog_coord
+fog coord 50.0
+
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2 
+probe all rgba 0.8318 0.8739 0.1261 0.8
diff --git a/tests/spec/arb_fragment_program/fog/exp2.shader_test b/tests/spec/arb_fragment_program/fog/exp2.shader_test
new file mode 100644
index 0000000..6d7b09a
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/exp2.shader_test
@@ -0,0 +1,24 @@
+[require]
+GL >= 1.4
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+OPTION ARB_fog_exp2;
+PARAM color = {0.2, 0.4, 0.6, 0.8};
+MOV result.color, color;
+END
+
+[test]
+fog start 10.0
+fog end 100.0
+fog density 0.03
+fog color (1.0, 1.0, 0.0, 0.0)
+fog coord_src fog_coord
+fog coord 50.0
+
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2 
+probe all rgba 0.9157 0.9368 0.06324 0.8
-- 
git-series 0.8.10


More information about the Piglit mailing list