[Piglit] [PATCH v2 32/37] glean/tfragprog1: port linear fog tests to shader_runner
Dylan Baker
dylan at pnwbakers.com
Tue Sep 6 19:21:10 UTC 2016
These make use of the new fog feature for shader_runner.
The ported tests differ slightly in that they use the non EXT version of
fog_coord, and thus require GL >= 1.4
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
tests/all.py | 2 --
tests/glean/tfragprog1.cpp | 41 -----------------------------------------
tests/spec/arb_fragment_program/fog/calculated-linear.shader_test | 35 +++++++++++++++++++++++++++++++++++
tests/spec/arb_fragment_program/fog/linear.shader_test | 24 ++++++++++++++++++++++++
4 files changed, 59 insertions(+), 43 deletions(-)
create mode 100644 tests/spec/arb_fragment_program/fog/calculated-linear.shader_test
create mode 100644 tests/spec/arb_fragment_program/fog/linear.shader_test
diff --git a/tests/all.py b/tests/all.py
index b2c41dd..84999e6 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_linear test',
- 'Computed fog linear test',
'ARB_fog_exp test',
'Computed fog exp test',
'ARB_fog_exp2 test',
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
index 9db40a4..feb6bdc 100644
--- a/tests/glean/tfragprog1.cpp
+++ b/tests/glean/tfragprog1.cpp
@@ -131,47 +131,6 @@ static const FragmentProgram Programs[] = {
},
// ============= Fog tests ============================================
- // Linear fog
-#define FOG_FACT ((FogEnd - FogCoord) / (FogEnd - FogStart))
- {
- "ARB_fog_linear test",
- "!!ARBfp1.0\n"
- "OPTION ARB_fog_linear; \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
- },
- {
- "Computed fog linear 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 numerator, f; \n"
- "# f = (end - coord) / (end - start) \n"
- "SUB numerator, fogParams.z, fogCoord.x; \n"
- "MUL_SAT f, numerator, fogParams.w; \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
-
// Exp fog
#define FOG_FACT 0.2231 // = exp(-Density * Coord)
{
diff --git a/tests/spec/arb_fragment_program/fog/calculated-linear.shader_test b/tests/spec/arb_fragment_program/fog/calculated-linear.shader_test
new file mode 100644
index 0000000..73018eb
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/calculated-linear.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;
+PARAM p = {0.2, 0.4, 0.6, 0.8};
+ATTRIB fogCoord = fragment.fogcoord;
+PARAM fogColor = state.fog.color;
+TEMP numerator, f;
+# f = (end - coord) / (end - start)
+SUB numerator, fogParams.z, fogCoord.x;
+MUL_SAT f, numerator, fogParams.w;
+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.5555 0.6666 0.3333 0.8
diff --git a/tests/spec/arb_fragment_program/fog/linear.shader_test b/tests/spec/arb_fragment_program/fog/linear.shader_test
new file mode 100644
index 0000000..083ecf0
--- /dev/null
+++ b/tests/spec/arb_fragment_program/fog/linear.shader_test
@@ -0,0 +1,24 @@
+[require]
+GL >= 1.4
+GL_ARB_fragment_program
+
+[fragment program]
+!!ARBfp1.0
+OPTION ARB_fog_linear;
+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.5555 0.6666 0.3333 0.8
--
git-series 0.8.10
More information about the Piglit
mailing list