[Piglit] [PATCH 03/37] glean/tfragprog1: port ADD tests to shader_runner
Dylan Baker
dylan at pnwbakers.com
Thu Apr 28 21:38:25 UTC 2016
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 at intel.com>
---
tests/all.py | 5 --
tests/glean/tfragprog1.cpp | 75 ----------------------
.../built-in-functions/add-immediate.shader_test | 16 +++++
.../add-negative-immediate.shader_test | 16 +++++
.../built-in-functions/add.shader_test | 18 ++++++
.../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 110aef3..85c57b3 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..4bebccc
--- /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 ( 0.0, 0.5, 0.0, 0.0)
+parameter local_fp 1 ( 0.0, 0.2, 0.0, 0.0)
+parameter local_fp 2 ( 0.0, 0.3, 0.0, 0.0)
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
--
2.8.0
More information about the Piglit
mailing list