[Piglit] [PATCH v2 33/37] glean/tfragprog1: port exp-fog tests to shader_runner

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


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/all.py                                                   |  2 +-
 tests/glean/tfragprog1.cpp                                     | 43 +-------
 tests/spec/arb_fragment_program/fog/calculated-exp.shader_test | 35 ++++++-
 tests/spec/arb_fragment_program/fog/exp.shader_test            | 24 ++++-
 4 files changed, 59 insertions(+), 45 deletions(-)
 create mode 100644 tests/spec/arb_fragment_program/fog/calculated-exp.shader_test
 create mode 100644 tests/spec/arb_fragment_program/fog/exp.shader_test

diff --git a/tests/all.py b/tests/all.py
index 84999e6..f533893 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -379,8 +379,6 @@ glean_fp_tests = [
                   'Z-write test',
                   'Divide by zero test',
                   'Infinity and nan test',
-                  'ARB_fog_exp test',
-                  'Computed fog exp test',
                   'ARB_fog_exp2 test',
                   'Computed fog exp2 test']
 
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
index feb6bdc..b34a348 100644
--- a/tests/glean/tfragprog1.cpp
+++ b/tests/glean/tfragprog1.cpp
@@ -131,49 +131,6 @@ static const FragmentProgram Programs[] = {
 	},
 
 	// ============= Fog tests ============================================
-	// Exp fog
-#define FOG_FACT 0.2231   // = exp(-Density * Coord)
-	{
-		"ARB_fog_exp test",
-		"!!ARBfp1.0\n"
-		"OPTION ARB_fog_exp; \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.3535   // = ex2(-Density * Coord)
-	{
-		// NOTE: we could also do this with the POW instruction
-		"Computed fog exp 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) \n"
-		"MUL dc.x, fogParams.x, fogCoord.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
 
 	// Exp2 fog
 #define FOG_FACT 0.1054   // = exp(-(Density * Coord)^2)
diff --git a/tests/spec/arb_fragment_program/fog/calculated-exp.shader_test b/tests/spec/arb_fragment_program/fog/calculated-exp.shader_test
new file mode 100644
index 0000000..0602d24
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/calculated-exp.shader_test
@@ -0,0 +1,35 @@
+[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 p = {0.2, 0.4, 0.6, 0.8};
+PARAM fogColor = state.fog.color;
+TEMP f, dc;
+# f = exp(-density * coord)
+MUL dc.x, fogParams.x, fogCoord.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.7127 0.7879 0.2121 0.8
diff --git a/tests/spec/arb_fragment_program/fog/exp.shader_test b/tests/spec/arb_fragment_program/fog/exp.shader_test
new file mode 100644
index 0000000..8448d72
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/exp.shader_test
@@ -0,0 +1,24 @@
+[require]
+GL >= 1.4
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+OPTION ARB_fog_exp;
+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.8215 0.8661 0.1339 0.8
-- 
git-series 0.8.10


More information about the Piglit mailing list