[Piglit] [PATCH] glsl-1.30: test modf

Dave Airlie airlied at gmail.com
Mon Jul 7 01:27:00 PDT 2014


From: Dave Airlie <airlied at redhat.com>

The generated tests don't test this due to its unusual output nature, and
we had no other tests that I could find for it. So plug that hole.

I just handcoded up this batch of tests in the same style as generated ones.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 .../glsl-1.30/execution/fs-modf-float.shader_test  | 45 ++++++++++++++++++++
 .../glsl-1.30/execution/fs-modf-vec2.shader_test   | 45 ++++++++++++++++++++
 .../glsl-1.30/execution/fs-modf-vec3.shader_test   | 45 ++++++++++++++++++++
 .../glsl-1.30/execution/fs-modf-vec4.shader_test   | 45 ++++++++++++++++++++
 .../glsl-1.30/execution/vs-modf-float.shader_test  | 49 ++++++++++++++++++++++
 .../glsl-1.30/execution/vs-modf-vec2.shader_test   | 49 ++++++++++++++++++++++
 .../glsl-1.30/execution/vs-modf-vec3.shader_test   | 49 ++++++++++++++++++++++
 .../glsl-1.30/execution/vs-modf-vec4.shader_test   | 49 ++++++++++++++++++++++
 8 files changed, 376 insertions(+)
 create mode 100644 tests/spec/glsl-1.30/execution/fs-modf-float.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/fs-modf-vec2.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/fs-modf-vec3.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/fs-modf-vec4.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-modf-float.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-modf-vec2.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-modf-vec3.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-modf-vec4.shader_test

diff --git a/tests/spec/glsl-1.30/execution/fs-modf-float.shader_test b/tests/spec/glsl-1.30/execution/fs-modf-float.shader_test
new file mode 100644
index 0000000..1fd3ed7
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-modf-float.shader_test
@@ -0,0 +1,45 @@
+# Test proper behavior of the modf(float) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform float value;
+uniform float expected1;
+uniform float expected2;
+uniform float tolerance;
+void main()
+{
+  float temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  gl_FragColor = vec4(b1, b2, 0.0, 1.0);
+}
+
+[test]
+uniform float value 2.5
+uniform float expected1 2.0
+uniform float expected2 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform float value -1.33
+uniform float expected1 -1.0
+uniform float expected2 -0.33
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/fs-modf-vec2.shader_test b/tests/spec/glsl-1.30/execution/fs-modf-vec2.shader_test
new file mode 100644
index 0000000..4ba7d6c
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-modf-vec2.shader_test
@@ -0,0 +1,45 @@
+# Test proper behavior of the modf(vec2) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform vec2 value;
+uniform vec2 expected1;
+uniform vec2 expected2;
+uniform float tolerance;
+void main()
+{
+  vec2 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  gl_FragColor = vec4(b1, b2, 0.0, 1.0);
+}
+
+[test]
+uniform vec2 value 1.5 2.5
+uniform vec2 expected1 1.0 2.0
+uniform vec2 expected2 0.5 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec2 value -1.33 10.3333
+uniform vec2 expected1 -1.0 10.0
+uniform vec2 expected2 -0.33 0.3333
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/fs-modf-vec3.shader_test b/tests/spec/glsl-1.30/execution/fs-modf-vec3.shader_test
new file mode 100644
index 0000000..343c282
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-modf-vec3.shader_test
@@ -0,0 +1,45 @@
+# Test proper behavior of the modf(vec3) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform vec3 value;
+uniform vec3 expected1;
+uniform vec3 expected2;
+uniform float tolerance;
+void main()
+{
+  vec3 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  gl_FragColor = vec4(b1, b2, 0.0, 1.0);
+}
+
+[test]
+uniform vec3 value 1.5 0.5 2.5
+uniform vec3 expected1 1.0 0.0 2.0
+uniform vec3 expected2 0.5 0.5 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec3 value -1.33 0.75 10.3333
+uniform vec3 expected1 -1.0 0.0 10.0
+uniform vec3 expected2 -0.33 0.75 0.3333
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/fs-modf-vec4.shader_test b/tests/spec/glsl-1.30/execution/fs-modf-vec4.shader_test
new file mode 100644
index 0000000..9ffa33e
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-modf-vec4.shader_test
@@ -0,0 +1,45 @@
+# Test proper behavior of the modf(vec4) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform vec4 value;
+uniform vec4 expected1;
+uniform vec4 expected2;
+uniform float tolerance;
+void main()
+{
+  vec4 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  gl_FragColor = vec4(b1, b2, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 value 1.5 0.5 2.5 0.0
+uniform vec4 expected1 1.0 0.0 2.0 0.0
+uniform vec4 expected2 0.5 0.5 0.5 0.0
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec4 value -1.33 0.75 10.3333 100.865
+uniform vec4 expected1 -1.0 0.0 10.0 100.0
+uniform vec4 expected2 -0.33 0.75 0.3333 0.865
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-modf-float.shader_test b/tests/spec/glsl-1.30/execution/vs-modf-float.shader_test
new file mode 100644
index 0000000..e3e6240
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-modf-float.shader_test
@@ -0,0 +1,49 @@
+# Test proper behavior of the modf(float) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+varying vec4 color;
+uniform float value;
+uniform float expected1;
+uniform float expected2;
+uniform float tolerance;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  float temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  color = vec4(b1, b2, 0.0, 1.0);
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+uniform float value 1.5
+uniform float expected1 1.0
+uniform float expected2 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform float value -1.33
+uniform float expected1 -1.0
+uniform float expected2 -0.33
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-modf-vec2.shader_test b/tests/spec/glsl-1.30/execution/vs-modf-vec2.shader_test
new file mode 100644
index 0000000..9ad6c34
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-modf-vec2.shader_test
@@ -0,0 +1,49 @@
+# Test proper behavior of the modf(vec2) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+varying vec4 color;
+uniform vec2 value;
+uniform vec2 expected1;
+uniform vec2 expected2;
+uniform float tolerance;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  vec2 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  color = vec4(b1, b2, 0.0, 1.0);
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+uniform vec2 value 1.5 2.5
+uniform vec2 expected1 1.0 2.0
+uniform vec2 expected2 0.5 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec2 value -1.33 10.3333
+uniform vec2 expected1 -1.0 10.0
+uniform vec2 expected2 -0.33 0.3333
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-modf-vec3.shader_test b/tests/spec/glsl-1.30/execution/vs-modf-vec3.shader_test
new file mode 100644
index 0000000..b655be9
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-modf-vec3.shader_test
@@ -0,0 +1,49 @@
+# Test proper behavior of the modf(vec3) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+varying vec4 color;
+uniform vec3 value;
+uniform vec3 expected1;
+uniform vec3 expected2;
+uniform float tolerance;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  vec3 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  color = vec4(b1, b2, 0.0, 1.0);
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+uniform vec3 value 1.5 0.5 2.5
+uniform vec3 expected1 1.0 0.0 2.0
+uniform vec3 expected2 0.5 0.5 0.5
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec3 value -1.33 0.75 10.3333
+uniform vec3 expected1 -1.0 0.0 10.0
+uniform vec3 expected2 -0.33 0.75 0.3333
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-modf-vec4.shader_test b/tests/spec/glsl-1.30/execution/vs-modf-vec4.shader_test
new file mode 100644
index 0000000..5c6184d
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-modf-vec4.shader_test
@@ -0,0 +1,49 @@
+# Test proper behavior of the modf(vec4) function.
+#
+# test modf splits the input values into the two pieces and
+# returns them correctly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+varying vec4 color;
+uniform vec4 value;
+uniform vec4 expected1;
+uniform vec4 expected2;
+uniform float tolerance;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  vec4 temp, tempi;
+  bool b1, b2;
+  temp = modf(value, tempi);
+  b1 = distance(tempi, expected1) < tolerance;
+  b2 = distance(temp, expected2) < tolerance;
+  color = vec4(b1, b2, 0.0, 1.0);
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+uniform vec4 value 1.5 0.5 2.5 0.0
+uniform vec4 expected1 1.0 0.0 2.0 0.0
+uniform vec4 expected2 0.5 0.5 0.5 0.0
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 0 0 1.0 1.0 0.0 1.0
+
+uniform vec4 value -1.33 0.75 10.3333 100.865
+uniform vec4 expected1 -1.0 0.0 10.0 100.0
+uniform vec4 expected2 -0.33 0.75 0.3333 0.865
+uniform float tolerance 0.0041452078
+draw rect -1 -1 2 2
+probe rgba 1 0 1.0 1.0 0.0 1.0
-- 
1.9.3



More information about the Piglit mailing list